In [2]:
from __future__ import print_function
from netscan.lib import WhoIs, GetHostName, MacLookup, Commands
import pprint as pp
In [3]:
print(GetHostName('192.168.1.13').name)
print(GetHostName('127.0.0.1').name)
WhoIs uses a REST API to recover a current record of an external IP address.
In [10]:
pp.pprint(WhoIs('216.58.217.4').record)
In [8]:
info = WhoIs('216.58.217.4')
print('CIDR:', info.CIDR)
print('Organization:', info.Organization)
MacLookup uses a REST API to turn a MAC address into a vendor name.
In [40]:
print(MacLookup('58:b0:35:f2:55:88').vendor)
In [9]:
cmd = Commands()
ret = cmd.getoutput('ls -alh')
print(ret)
print(Commands().getoutput('echo hi'))
In [31]:
from netscan.PassiveScan import PassiveMapper
In [32]:
nmap = []
pm = PassiveMapper()
nmap = pm.pcap('../tests/test.pcap')
nmap = pm.filter(nmap)
nmap = pm.combine(nmap)
nmap = pm.combine(nmap)
pp.pprint(nmap)
In [34]:
from netscan.ActiveScan import ActiveMapper
In [35]:
am = ActiveMapper(range(1, 1024))
hosts = am.scan('en1')
pp.pprint(hosts)
In [37]:
print(GetHostName('192.168.1.13').name)
In [ ]: