Sep-12-2018, 10:24 AM
(Sep-12-2018, 08:11 AM)buran Wrote: it's because your file name is scapy.py. You import your own file, not scapy package. Rename your file.
okay thank u its working now ... but i have another issue i need to get all the mac address from the arp_scan() function ... and pass them to another to get the vendor for each mac this is my code ... :
#! /usr/bin/python import urllib2 import json import codecs def arp_scan(): from scapy.all import srp,Ether,ARP,conf conf.verb=0 ans, unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.20.0/24"),timeout=2) for snd,rcv in ans: d = rcv.sprintf("%Ether.src%") print(d) arp_scan() #API base url,you can also use https if you need url = "http://macvendors.co/api/" #Mac address to lookup vendor from mac_address = arp_scan() request = urllib2.Request(url+mac_address, headers={'User-Agent' : "API Browser"}) response = urllib2.urlopen( request ) #Fix: json object must be str, not 'bytes' reader = codecs.getreader("utf-8") obj = json.load(reader(response)) #Print company name print (obj['result']['company']);error :
Error:Traceback (most recent call last):
File "/tmp/ArpScanner/arp.py", line 26, in <module>
request = urllib2.Request(url+mac_address, headers={'User-Agent' : "API Browser"})
TypeError: cannot concatenate 'str' and 'NoneType' objects