|
25 Years of Programming Community Forum Blog Sitemap Services |
|
May 24, 2013, 08:39:32 PM
|
|||
|
|||
| News: Admin gets an email whenever a new message is posted or a new member joins. |
| Home | Help | Search | Login | Register |
|
This is a link to the Chat Room (for Firefox+ChatZilla) when you are logged in. View help topic about using Live Chat |
|
71
on: September 30, 2011, 04:55:50 AM
|
||
| Started by SteveW - Last post by ciara1 | ||
|
Try to use "Access-to-MySQL" software to convert it for you, make sure you unhide all the access files you want to convert, a free trial is available on internet...just google search
|
||
|
72
General Category / Website Security / Re: Support thread for "lookforbadguys" PHP script to find malicious text in files
on: September 30, 2011, 12:14:58 AM
|
||
| Started by SteveW - Last post by isd.jouie | ||
|
hi! can you help me with these? im not a programmer and i dont know about msql. my was hacked and all of my addon sites are compromised. i dont know what to do. i tried using your lookforbadguys.php in my site. but i dont know what to do after that. here is the result after i ran the program..
hope you can help me please... |
||
|
73
on: September 26, 2011, 04:54:43 PM
|
||
| Started by randyg - Last post by randyg | ||
|
Yeh I hear you, its not worth it. I didn't initially think emailing the
results was as complicated as turned out. I found and modified another script that checks time miss matches, and for new or deleted files, I included a link inside that script in my emailed results so if there are hits, I can just run this script for maybe a more detailed look. this is the best way to go anyway Thanks Randy |
||
|
74
on: September 24, 2011, 02:52:44 PM
|
||
| Started by randyg - Last post by SteveW | ||
|
It's not just the function. You need new code outside the function, and what you posted above is only part of the function. In addition, it sounds like you're underestimating what the thing you want to do really involves. It's not just a couple of lines of code. It's a partial rewrite of the whole script.
You'll need to study the script, understand its flow, and change all the HTML output so that some alternative text, written by you, goes into your plain text array instead of being written to the page... throughout the script. Accumulate ALL the lines in your array instead of echoing them to the page. Then, at the very end of the script, implode the array and put it into the email. If you're determined to go through with this, go back to a simpler starting point and build up to the result you want by taking it one new step at a time. To at least summarize some of the points from previous posts, the following program contains examples of the basic principles for the code you'll need to use for the task. Start by making sure this works for you: <?php # This must be global $PlainTextLines = array(); // redeclare with some contents, for this one test program only $PlainTextLines = array ( 'line1', 'line2', 'line3', 'line4' ); // this just demonstrates how to declare variables global function SampleFunctionThatUsesGlobalVariables() { global $PlainTextLines; } // I got rid of $msg entirely. mail('YourEmailAddress', 'Test Subject', implode("\n", $PlainTextLines)); ?> Make sure your mail() call is not inside the FindMaliciousCodeSnippets() function. That function is called once for each file. If you have 5,000 files, you could send yourself 5,000 emails. |
||
|
75
on: September 24, 2011, 11:28:31 AM
|
||
| Started by randyg - Last post by randyg | ||
|
Please edit my function above with the corrections, I'm still getting no value
I don't know whats going on with me and php lately. Thanks Randy |
||
|
76
on: September 24, 2011, 11:10:19 AM
|
||
| Started by randyg - Last post by SteveW | ||
|
My array $OutputText is declared inside the function because it's only used inside the function, and only for 1 file at a time.
Your $PlainTextLines array, because it accumulates the lines for all files processed, must be a global. Put this line $PlainTextLines = array(); somewhere before the function FindMaliciousCodeSnippets($filename), not inside any function. and you must declare it as global within FindMaliciousCodeSnippets() with this line: global $PlainTextLines; Your call to mail() should not be inside the function, or else you'll get an email for each file. In addition, because your mail call must be outside the function, your declaration of $msg = ''; must also be in a global location, and you must declare it global inside any function that uses it, too: global $msg; |
||
|
77
on: September 24, 2011, 10:45:49 AM
|
||
| Started by randyg - Last post by SteveW | ||
|
Aha! Your script was probably generating a warning that wasn't being displayed...
Before you start appending lines to $msg, you must declare it first. Try this: $msg = ''; // two single quotes, or two double quotes if(count($PlainTextLines ) > 1) { foreach($PlainTextLines as $s) $msg .= ($s . "\n"); } Or shorter: // you still need to declare this, so it has a value to use in mail(), even if it's an empty string $msg = ''; if(count($PlainTextLines ) > 1) $msg = implode("\n", $PlainTextLines); I tested this (by itself, not as part of a larger script), and it correctly sends me the email with the lines in it. |
||
|
78
on: September 24, 2011, 09:26:34 AM
|
||
| Started by randyg - Last post by randyg | ||
|
Yes, that's the only problem I could see. Except that I now notice that the "i" in "if" was missing in the code you posted earlier. Try doing the mail() call unconditionally (outside the "if"), with a static text string for $msg, and see if that works. Then take it one step at a time to build up from there. I'll try to test it here, but am not sure I can use mail() on my test machine. I haven't tried to do that before. I always echo $msg outside the if as well, when I test, if I can echo, I should be able to mail it, nothing is being put in $msg for some reason. do you get a echo value from msg with that function ? Randy PS missing "i" was just a typo here pasting |
||
|
79
on: September 24, 2011, 09:17:53 AM
|
||
| Started by randyg - Last post by SteveW | ||
|
Yes, that's the only problem I could see.
Except that I now notice that the "i" in "if" was missing in the code you posted earlier. Try doing the mail() call unconditionally (outside the "if"), with a static text string for $msg, and see if that works. Then take it one step at a time to build up from there. I'll try to test it here, but am not sure I can use mail() on my test machine. I haven't tried to do that before. |
||
|
80
on: September 24, 2011, 08:37:15 AM
|
||
| Started by randyg - Last post by randyg | ||
|
Since you're not accumulating text lines into $OutputText anymore, you'll need to test $PlainTextLines instead. Try changing if(count($OutputText) > 1) to if(count($PlainTextLines ) > 1) Thanks, missed that, changed it, still no results in $msg I did try global $msg as well, does everything in that modified function above look right? that's the only part of the script I edited. Randy |
||