I'm trying to use the output of nmap command in linux (shell output):
sudo nmap -sn 192.168.1.0/24
------
Nmap scan report for 192.168.1.98
Host is up (0.094s latency).
MAC Address: B8:27:EB:CE:0A:9F (Raspberry Pi Foundation)
In a python script via subprocess:
import subprocess
p = subprocess.Popen(["nmap", "-sn", "192.168.1.0/24"], stdout=subprocess.PIPE)
output, err = p.communicate()
print ("*** Running nmap -sn 192.168.1.0/24 ***\n", output)
Which works pretty well except from the fact that I NEED the MAC line that shell output has and subprocess doesn't.
subprocess output:
\nNmap scan report for 192.168.1.98\nHost is up (0.015s latency).\n
I'm working on an idea of getting IP via MAC/Name and I can't see how to do it without that line...