mirror of
https://github.com/k4m4/kickthemout.git
synced 2024-11-22 21:14:25 +01:00
26 lines
673 B
Python
26 lines
673 B
Python
#!/usr/bin/env python3
|
|
# -.- coding: utf-8 -.-
|
|
# scan.py
|
|
|
|
"""
|
|
Copyright (C) 2017-18 Nikolaos Kamarinakis (nikolaskam@gmail.com) & David Schütz (xdavid@protonmail.com)
|
|
See License at nikolaskama.me (https://nikolaskama.me/kickthemoutproject)
|
|
"""
|
|
|
|
import nmap
|
|
|
|
# perform a network scan with nmap
|
|
def scanNetwork(network):
|
|
returnlist = []
|
|
nm = nmap.PortScanner()
|
|
a = nm.scan(hosts=network, arguments='-sn')
|
|
|
|
for k, v in a['scan'].items():
|
|
if str(v['status']['state']) == 'up':
|
|
try:
|
|
returnlist.append([str(v['addresses']['ipv4']), str(v['addresses']['mac'])])
|
|
except:
|
|
pass
|
|
|
|
return returnlist
|