-1

If I do this code(below) to get a IP address from a URL, how do I get the Nmap scan from that Ip address? import socket

def get_ips_for_host(url):
    try:
        ips = socket.gethostbyname_ex(url)
    except socket.gaierror:
        ips = []
    return ips

ips = get_ips_for_host('www.facebook.com')
print(repr(ips))

1 Answers1

0

Use python-nmap https://bitbucket.org/xael/python-nmap

import nmap                         
nm = nmap.PortScanner()             
nm.scan('127.0.0.1')

More infos https://bitbucket.org/xael/python-nmap/src/98be13ac29560b0ed26370fec148c2b25a221166/example.py?at=default&fileviewer=file-view-default

David
  • 131
  • 1
  • 7