我尝试使用以下代码将 TCP SYN 数据包从远程 IP 地址发送到我的本地 IP 地址。
from kamene.all import *
print("Send SYN from remote to local")
ip=IP(src=remote_ip,dst=local_ip,frag=0,tos=0x0)
tcp=TCP(sport=remote_port,dport=local_port, flags="S", seq=1111)
SYN_pkt = ip/tcp
SYNACK_pkt = srp(SYN_pkt,verbose=0)
ls(SYNACK_pkt)
但是代码给出了以下错误。
Send SYN from remote to local
WARNING: DNS RR prematured end (ofs=16116, len=26)
WARNING:kamene.runtime:DNS RR prematured end (ofs=16116, len=26)
WARNING: wrong value: DNS.ancount=51411
WARNING:kamene.runtime:wrong value: DNS.ancount=51411
WARNING: wrong value: DNS.nscount=41893
WARNING:kamene.runtime:wrong value: DNS.nscount=41893
WARNING: more wrong value: DNS.arcount=778
WARNING:kamene.runtime:more wrong value: DNS.arcount=778
Not a packet class. Type 'ls()' to list packet classes.
如果我将 srp() 更改为 sr1() 以发送/接收数据包,则会出现以下错误。
Send SYN from remote to local
WARNING: Mac address to reach destination not found. Using broadcast.
WARNING:kamene.runtime:Mac address to reach destination not found. Using broadcast.
WARNING: DNS RR prematured end (ofs=16116, len=26)
WARNING:kamene.runtime:DNS RR prematured end(ofs=16116, len=26)
WARNING: wrong value: DNS.ancount=51411
WARNING:kamene.runtime:wrong value: DNS.ancount=51411
WARNING: wrong value: DNS.nscount=41893
WARNING:kamene.runtime:wrong value: DNS.nscount=41893
WARNING: more wrong value: DNS.arcount=778
WARNING:kamene.runtime:more wrong value: DNS.arcount=778