这段代码是justinseitz(2014)写的一本叫做“黑帽python”的书中脚本的一部分。它是为Linux操作系统编写的,是ARP欺骗程序的一部分。如果我想在windows操作系统上运行它,如何为windows机器找到正确的接口?在
from scapy.all import *
import os, sys, threading, signal
interface = "wlan0"
(...)
# set our interface
conf.iface = interface
# turn off output
conf.verb = 0
print(("[*] Setting up %s" % interface))
(...)
try:
print(("[*] Starting program for %d packets" % packet_count))
bpf_filter = "ip host %s" % target_ip
packets = sniff(count=packet_count, filter=bpf_filter, iface=interface)
谢谢:)
在windows上,scapy库检测您的接口并将它们存储在IFACES变量中。在
安装/下载scapy之后,启动scapyshell(命令:
scapy
,如果是手动下载的话,run_scapy.bat
),然后输入IFACES
它将为您提供已安装接口的列表。然后您可以使用
interface = "[The full interface name as shown in scapy]"
interface = IFACES.dev_from_index([the index of the interface as shown by scapy])
如果除了WiFi接口之外没有其他接口,您甚至可以使用
interface = conf.iface
相关问题 更多 >
编程相关推荐