Guest User

Untitled

a guest
Jan 11th, 2025
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. import time
  2. import binascii
  3. import socket
  4. import threading
  5. import random
  6.  
  7. times = []
  8. # connectivitycheck.gstatic.com, nuq04s42
  9. host = '142.250.191.35'
  10. message = 'GET /generate_204 HTTP/1.1\r\nHost: connectivitycheck.gstatic.com:80\r\nConnection: close\r\n\r\n'
  11. message = message.encode()
  12.  
  13. script_start = time.time()
  14.  
  15. def send_and_measure():
  16. send_start = time.time()
  17. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  18. sock.settimeout(1)
  19. try:
  20. sock.connect((host, 80))
  21. sock.send(message)
  22. sock.recvfrom(4096)
  23. except:
  24. pass
  25. finally:
  26. sock.close()
  27. now = time.time()
  28. pair = (now - script_start, now - send_start)
  29. print(*pair)
  30. times.append(pair)
  31.  
  32. for i in range(10000):
  33. threading.Thread(target=send_and_measure).start()
  34. time.sleep(0.01)
Advertisement
Add Comment
Please, Sign In to add comment