kickthemout/scan.py
2017-03-11 10:53:38 +01:00

18 lines
455 B
Python

#!/usr/bin/env python
# -.- coding: utf-8 -.-
# scan.py
def scanNetwork(network):
returnlist = []
import nmap
nm = nmap.PortScanner()
a = nm.scan(hosts=network, arguments='-sP')
for k, v in a['scan'].iteritems():
if str(v['status']['state']) == 'up':
try:
returnlist.append([str(v['addresses']['ipv4']), str(v['addresses']['mac'])])
except:
pass
return returnlist