toucan.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Toucan-IDS 作者: collinsullivanhub 项目源码 文件源码
def arp_network_range(iprange):

    logging.info('Sending ARPs to network range')

    ans, unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=iprange), timeout=5)

    ip_collection = []

    eth_collection = []

    for snd, rcv in ans:

        host_ip_address = rcv.sprintf(r"%ARP.psrc%")

        host_eth_address = rcv.sprintf(r"%Ether.src%")

        logging.info('%s' % host_ip_address)

        logging.info('%s' % host_eth_address)

        ip_collection.append(host_ip_address)

        eth_collection.append(host_eth_address)

    print "Host List IP Addresses:"

    for host_ip in ip_collection:

        print host_ip

    print "Host List Ethernet Addresses:"

    for host_eth in eth_collection:

        print host_eth

    with open("toucan_hosts.txt", "w") as output:

        output.write(str(ip_collection))
        output.write(str(eth_collection))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号