from scapy.all import *
import optparse
from threading import *
def sweep(packet):
try:
reply = srp1(packet,timeout=1,verbose=0,iface='en5')
#print reply
print 'ip:'+reply.psrc+"mac:"+reply.hwsrc
except:
pass
def main():
parser = optparse.OptionParser('asdasdad')
parser.add_option("-H", dest="tgtHost",help="target host")
(options, args) = parser.parse_args()
host = options.tgtHost
if host == None:
print parser.usage
exit(0)
eth = Ether()
eth.dst = 'FF:FF:FF:FF:FF:FF'
eth.type = 0x0806
arp = ARP()
for n in range (254):
arp.pdst = host + str(n)
packet = eth/arp
t = Thread(target=sweep,args=(packet))
t.start()
if __name__ == '__main__':
main()