-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathArp_Scanner.py
More file actions
31 lines (18 loc) · 784 Bytes
/
Arp_Scanner.py
File metadata and controls
31 lines (18 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# arp scanner written with scapy ..
import sys , os
from scapy.all import *
interface = raw_input("Network interface here ...")
ip_range = raw_input("Enter ip range in exact CIDR format...")
broadcastMac = "ff:ff:ff:ff:ff:ff" # braodcast mac address ..
# small funtion for monitoring on the arp packet ...
def parsePacket(pkt):
if ARP in pkt and pkt[ARP].op in (1,2):
return pkt.sprintf("%ARP.hwsrc% %ARP.psrc%")
# verbosity equals to 0 here...
conf.verb = 0
ans, unans = srp(Ether(dst=broadcastMac)/ARP(pdst = ip_rage), timeout =2, iface=interface, inter=0.1)
for send,recive in ans:
print (recive.sprintf(r"%Ether.src% - %ARP.psrc%"))
# calling paersepacket function through sniff function
sniff(prn=parsePacket, filter="arp", store=0)
# end .. /