-1

如果我执行此代码(如下)从 URL 获取 IP 地址,如何从该 IP 地址获取 Nmap 扫描?导入套接字

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))
4

1 回答 1

0

使用 python-nmap https://bitbucket.org/xael/python-nmap

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

更多信息 https://bitbucket.org/xael/python-nmap/src/98be13ac29560b0ed26370fec148c2b25a221166/example.py?at=default&fileviewer=file-view-default

于 2015-11-17T10:56:02.123 回答