Skip to content

Commit 684987f

Browse files
committed
Create arp_scan.py
1 parent c1b4b3e commit 684987f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

arp_scan.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
# Arp scanner
3+
4+
# Suppress warning messages from Scapy, but show errors.
5+
import logging
6+
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
7+
8+
from scapy.all import *
9+
10+
SUBNET = "192.168.1."
11+
HOST_RANGE_START = 1
12+
HOST_RANGE_END = 254
13+
14+
for host in range(HOST_RANGE_START,HOST_RANGE_END):
15+
ip = SUBNET +str(host)
16+
arpRequest = Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=ip, hwdst="ff:ff:ff:ff:ff:ff")
17+
arpResponse = srp1(arpRequest, timeout=1, verbose=0)
18+
if arpResponse:
19+
print "IP: " + arpResponse.psrc + " MAC: " + arpResponse.hwsrc

0 commit comments

Comments
 (0)