Python Forum
Trying to Scan multiple IPs with python-nmap
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to Scan multiple IPs with python-nmap
#6
After your scan:

for host in np.all_hosts():
    for port in np[host].all_tcp():
        print("{} => {:<5} {}".format(host, port, np[host]['tcp'][port]['state']))
Output:
127.0.0.1 => 4433  open 127.0.0.1 => 4434  open
Here I am scaning ports 22 to 5000

If that is what you want.

n.scan() returns a dictionary with all info within. If you pprint.pprint() it, you will see how to get all you need.
Sorry for the delay but I am not aware with this module.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
RE: Trying to Scan multiple IPs with python-nmap - by wavic - Apr-09-2017, 06:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  scapy wifi scan to get payload \ data korenron 0 2,200 Nov-16-2021, 01:47 PM
Last Post: korenron
  can I set scan interval for scapy? korenron 0 2,376 Dec-31-2020, 01:43 PM
Last Post: korenron
  nmap sagpal 2 2,506 Jun-04-2020, 05:20 PM
Last Post: sagpal
  FIN scan with scapy peterkl 0 5,416 Feb-13-2017, 09:10 PM
Last Post: peterkl

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020