python 例子

socket 编程  例子代码中s.recv 如果接受不到数据,会阻塞,需要对这块代码进行优化,否则循环不会结束。 


import socket
ports = [21, 22, 53, 445, 80, 443, 3389, 8080]
hosts = ['127.0.0.1', '10.10.10.10', '192.168.1.1']
for host in hosts:
    for port in ports:
        try:
            s = socket.socket()
            print "[+] Attempting to connect to " + host + ":" + str(port)
            s.connect((host, port))
            s.send('absdkfbsdafblabldsfdbfhasdflbf /n')
            banner = s.recv(1024)
            if banner:
                print "[+] " + host + ":" + str(port) + " open: \n" + banner
            s.close()
        except: 
            pass

反向shell

http://www.freebuf.com/news/topnews/58048.html




猜你喜欢

转载自blog.csdn.net/freshfox/article/details/79171873