henryj320 / network_glance

Script to output various details about the network and hardware connected to the network.
GNU General Public License v3.0
0 stars 0 forks source link

net_glance: Investigate into the use of scapy #9

Open henryj320 opened 1 year ago

henryj320 commented 1 year ago

Figure out how to use scapy.

To prove you know it, output all devices on the network (in any format).

henryj320 commented 1 year ago

Completed the investigation. Seems useful.

Only limit of Scapy is that it cannot get the hostname. socket.gethostbyaddr() is an option, but seems to fail on anything that is not localhost.

My solution is a JSON file containing key : value pairs of MAC-address : hostname which can be accessed. It will work for all of my devices, but will have to say "Unknown device" for anything not usually on the network.

{
     MAC-address: [ hostname , alias ]
     "C0:33:5E:2E:CC:0B": ["ubuntu-surface-3", "henry-ubuntu-surface-3"]
}

The format for aliases should be: person-os-model

On Ubuntu, you can use hostname to get the hostname or just look in the setings for hostname and MAC address.

henryj320 commented 1 year ago

List of MAC addresses

(MAC-Address, IP, hostname, Model)

Poppy

Phone: 8e:cf:44:27:dd:5f, 192.168.1.106, Poppy's S20 FE, Samsung Galaxy S20 FE Macbook: a4:83:e7:64:3a:2e, 192.168.1.117, Poppy's Macbook Pro Amazon Alexa: a4:08:01:cd:30:9b, 192.168.1.115, Poppy's Echo Dot, Amazon Echo Dot

Henry

Gaming PC: 20:16:B9:90:2E:4B, 192.168.1.103, Be-Quiet-M2, Gaming PC Phone: 96:1a:29:79:b9:62, 192.168.1.100, Oppo2021, Oppo Reno4 5G Surface: C0:33:5E:2E:CC:0B, 192.168.1.108, ubuntu-surface-3, Microsoft Surface 3 Kindle Paperwhite: 48:78:5E:70:AF:92, Umknown IP, Unknown Hostname, Kindle Paperwhite (10th Gen) Kindle Fire: d8:54:b8:d0:00:19, 192.168.1.104, Henry's 3rd Fire, Kindle Fire HD 8 Raspberry Pi: b8:27:eb:e8:b3:dc, 192.168.1.109, rpi4b, Raspberry Pi 4 Model B Laptop: 14:5a:fc:48:98:1d, 192.168.1.101, Henry-Ideapad-Ubuntu, Lenovo Ideapad 3 Amazon Alexa: 08:12:a5:27:21:aa, 192.168.1.102, Henry's Echo Dot, Amazon Echo Dot Amazon Firestick: 2c:71:ff:81:12:47, 192.168.1.113, Henry's Fire TV, Amazon Fire TV

Other

Router: 10:47:38:62:9a:90, 192.168.1.1, Router, Router