File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Network Scanner
2
+
3
+ This is a simple Python script that uses the Scapy library to scan the local network and find connected devices.
4
+
5
+ ## Usage
6
+
7
+ 1 . Install the Scapy library. You can install it using pip:
8
+
9
+ ``` shell
10
+ pip install scapy
11
+
12
+ 2. Run the script by executing the following command:
13
+
14
+ ` ` ` shell
15
+ python network-scanner.py
16
+
17
+ 3. When prompted, enter the target IP address or IP range in the format " ip_address/24" . For example, " 192.168.1.0/24" .
18
+
19
+ 4. The script will send ARP requests to the specified IP range and display the list of available devices along with their IP and MAC addresses.
Original file line number Diff line number Diff line change
1
+ from scapy .all import ARP , Ether , srp
2
+
3
+ t_ip = input ("Enter the Target IP (ip_address/24): " )
4
+ arp = ARP (pdst = t_ip )
5
+ ether = Ether (dst = "ff:ff:ff:ff:ff:ff" )
6
+ packet = ether / arp
7
+ result = srp (packet , timeout = 3 , verbose = 0 )[0 ]
8
+ clients = []
9
+ for sent , received in result :
10
+ clients .append ({'ip' : received .psrc , 'mac' : received .hwsrc })
11
+
12
+ print ("Available Devices: " )
13
+ print ("IP" + " " * 18 + "MAC" )
14
+
15
+ for client in clients :
16
+ print (("{:16} {}" .format (client ['ip' ], client ['mac' ])))
You can’t perform that action at this time.
0 commit comments