Thursday, July 28, 2022

[SOLVED] Get all connected device name on the network - Python

Issue

I try to get all connected device name and IP on my network.

I've a raspberry pi and I want to use it as a "Network supervisor". For example if a new device is connected I want to display its IP and name.

I tried some libraries like nmap and scapy but isn't really what I try to do.

Thanks for your help.


Solution

You can get the nmap data into python by using subprocess

import subprocess
nmap = subprocess.Popen('nmap', stdout=subprocess.PIPE)
ipout = nmap.communicate()[0]

from there you can use basic python to strip down what you have in ipout and check if there are any differences and if so state those differences.



Answered By - Scott Paterson
Answer Checked By - Mary Flores (WPSolving Volunteer)