Skip to content

Commit

Permalink
ARP scan by janneck
Browse files Browse the repository at this point in the history
  • Loading branch information
FischLord committed Feb 25, 2024
1 parent a7d178f commit 02c9cc7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ IP Navigator is a Flask application designed for the efficient management of IP
## Prerequisites
- Python 3
- Node.js and npm
- Scapy
- https://rootinstall.com/tutorial/how-to-install-scapy-on-windows/
- https://rootinstall.com/tutorial/how-to-install-scapy-on-ubuntu/

## Setup
1. Clone the repository:
Expand Down
28 changes: 28 additions & 0 deletions ip-atlas/utils/netscan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from scapy.all import ARP, Ether, srp

# https://thepythoncode.com/article/building-network-scanner-using-scapy

target_ip = "192.69.69.1/24"
# IP Address for the destination
# create ARP packet
arp = ARP(pdst=target_ip)
# create the Ether broadcast packet
# ff:ff:ff:ff:ff:ff MAC address indicates broadcasting
ether = Ether(dst="ff:ff:ff:ff:ff:ff")
# stack them
packet = ether/arp

result = srp(packet, timeout=3, verbose=0)[0]

# a list of clients, we will fill this in the upcoming loop
clients = []

for sent, received in result:
# for each response, append ip and mac address to `clients` list
clients.append({'ip': received.psrc, 'mac': received.hwsrc})

# print clients
print("Available devices in the network:")
print("IP" + " "*18+"MAC")
for client in clients:
print("{:16} {}".format(client['ip'], client['mac']))

0 comments on commit 02c9cc7

Please sign in to comment.