python脚本基于ARP主机信息搜集
1.源码如下:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import nmap
import optparse
def NmapScan(targetIP):
# 实例化PortScanner对象
nm = nmap.PortScanner()
try:
# hosts为目标IP地址,argusments为Nmap的扫描参数
# -PR:使用ARP进行扫描
result = nm.scan(hosts=targetIP, arguments='-PR')
# 对结果进行切片,提取主机状态信息
state = result['scan'][targetIP]['status']['state']
print("[{}] is [{}]".format(targetIP, state))
except Exception as e:
pass
if __name__ == '__main__':
parser = optparse.OptionPa
共有 0 条评论