from scapy.all import *
import sys
from socket import *
import os
from threading import *
screenlock=Semaphore(value=500)
def gsd():
print '[*]TCP routing'
try:
r2,unans=traceroute([sys.argv[1]],dport=[sys.argv[2]],maxttl=20)
except Exception,e:
print '[-]I\'m sorry for the mistake. The reason is:{}'.format(e)
def IPall():
try:
a = IP(dst=sys.argv[1]+'/30')
print '[*]Target all IP'
print [p for p in a]
except Exception,a:
print '[-]Im sorry for the mistake. The reason is:{}'.format(a)
def os(host,port):
try:
s=socket(AF_INET,SOCK_STREAM)
s.connect((host,port))
print('[+] %d open' % port)
s.close()
except:
pass
gsd()
IPall()
if __name__ == '__main__':
setdefaulttimeout(1)
for p in range(1,1024):
t=Thread(target=os,args=(sys.argv[1],p))
t.start()
其实就是实现cmd情况下的traceroute的路由追踪。可以用于网络数据取证和数据收集阶段。