Created
March 13, 2019 12:00
-
-
Save amitness/1ddd563099bb8afe683d44f9c750e98c to your computer and use it in GitHub Desktop.
Get the IP address of all device on the local network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
output = os.popen('arp -a').read().splitlines() | |
ips = [re.search(r'\d+\.\d+\d+.\d+.\d+', b).group(0) for b in output] | |
for ip in ips: | |
print(os.popen('nmblookup -A {}'.format(ip)).read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment