Python & nmap
Jon Ribbens
jon+usenet at unequivocal.eu
Wed May 18 18:00:38 EDT 2022
On 2022-05-18, ^Bart <gabriele1NOSPAM at hotmail.com> wrote:
> THE INPUT
> -------------------------------------------------------------------------
> import nmap
> nm.scan(hosts='192.168.205.0/24', arguments='-n -sP -PE -PA21,23,80,3389')
> hosts_list = [(x, nm[x]['status']['state']) for x in nm.all_hosts()]
> for host, status in hosts_list:
> print('{0}:{1}'.host)
>
> THE OUTPUT
> ---------------------------------------------------------------------
> Traceback (most recent call last):
> File "/home/gabriele/Documenti/Python/nmap.py", line 1, in <module>
> import nmap
> File "/home/gabriele/Documenti/Python/nmap.py", line 2, in <module>
> nm.scan(hosts='192.168.205.0/24', arguments='-n -sP -PE
> -PA21,23,80,3389')
> NameError: name 'nm' is not defined
You forgot the second line (after 'import nmap' and before 'nm.scan()'):
nm = nmap.PortScanner()
More information about the Python-list
mailing list