kali python3安装scapy库_Kali-Python scapy模块-扫描

Kali Python3环境安装scapy模块pip3 install scapy

本地网卡网段arp_scan脚本import logging

import subprocess

logging.getLogger("scapy.runtime").setLevel(logging.ERROR)

from scapy.all import *

if len(sys.argv) != 2:

print("Usage - ./arp_ping.py [interface]")

print("Example - ./arp_ping.py eth0")

print("Example will perform an ARP scan of the local subnet to which eth0 is assigned")

sys.exit()

interface = str(sys.argv[1])

ip = str(subprocess.check_output("ifconfig "+ interface + " | grep 'broadcast' | cut -d ' ' -f 10 | cut -d '.' -f 1-3", shell=True).strip(), encoding='utf-8')

prefix = str(ip + '.')

for addr in range(0,254):

answer = sr1(ARP(pdst = prefix+str(addr)),timeout = 1, verbose = 0)

if answer == None:

pass

else:

print(prefix+str(addr))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值