python的arp扫描
from optparse import *
from scapy.all import *
parser = OptionParser()
parser.add_option("-p",action="store",dest="host",default=None,help="please imput a newwork")
(options,args)=parser.parse_args()
if options.host==None:
print "host is null"
else:
host=options.host
print host
import time,treading
balance=0
def change_it(n):
global balance
balance=balance+n
balance=balance-n
def run_thread(n):
for i in range(100000):
change_it(n)
t1=treading.Thread(target=run_thread,args=(5,))
t2=treading.Thread(target=run_thread,args=(8,))
t1.start()
t2.start()
t1.join()
t2.join()
print(balance)from scapy.all import *
import sys
def worker():
for ipfix in range(1,100):
ip="211.70.4."+str(ipfix)
arpPKT=Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=ip,hwdst="ff:ff:ff:ff:ff:ff")
res=srp1(arpPKT,timeout=1,verbose=False)
if res:
print"IP:"+res.psrc+" MAC:"+res.hwsrc
if _name_=="_main_"
worker()