0

I am Using Kali Linux to run this programme

scapy is not able to scan my network . In my Router there is about 5 device connected . 2 are pc and rest are mobile phone . But scapy only shows a Router Ip and My Windows Machine IP. here is the code :

from scapy.all import ARP, Ether, srp

target_ip = "192.168.31.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']))

scapy version is :-- 2.4.3

Output

enter image description here

Ramesh A
  • 13
  • 4
  • Yes Phone screen are on . And sometime scapy also don't scan my winodws machine – Ramesh A Dec 27 '20 at 11:52
  • Have you watched over Wireshark to see what's going on? Also, I can't see how this would lead to the precise behaviour you're describing, but you should really always specify the `iface` parameter to make sure that it's using the right interface. Try supplying it to `srp` (`iface="eth0"` likely), and see if it helps. – Carcigenicate Dec 27 '20 at 15:31
  • I provided I face Parameter And after that i scan and it detect the mobile phone but only 1 , In My home there is about 5 mobile device connected . scapy is able to detect computer but not mobile – Ramesh A Dec 28 '20 at 00:29

0 Answers0