Advertisement
fagci

Untitled

Sep 16th, 2021
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.58 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. from http.client import HTTPConnection
  3. from ipaddress import IPv4Address
  4. from random import randrange as _rr
  5. from threading import Event, Lock, Thread
  6.  
  7. HEADERS = {'User-Agent': 'Mozilla/5.0'}
  8.  
  9. print_lock = Lock()
  10. run_event = Event()
  11.  
  12.  
  13. def bust():
  14.     while run_event.is_set():
  15.         ip_address = IPv4Address(_rr(0x1000000, 0xE0000000))
  16.         if ip_address.is_global:
  17.             try:
  18.                 c = HTTPConnection(str(ip_address), timeout=1)
  19.                 c.request('GET', '/%08x' % _rr(16**8), headers=HEADERS)
  20.                 r = c.getresponse()
  21.                 if 200 <= r.status < 300:
  22.                     continue
  23.                 r.read()
  24.  
  25.                 print('not SPA')
  26.  
  27.                 c.request('GET', '/wp-content/uploads/', headers=HEADERS)
  28.                 r = c.getresponse()
  29.                 if not 200 <= r.status < 300:
  30.                     continue
  31.                 text = r.read().decode(errors='ignore')
  32.  
  33.                 with print_lock:
  34.                     print(ip_address, text, sep='\n', end='\n---\n')
  35.             except KeyboardInterrupt:
  36.                 run_event.clear()
  37.                 raise
  38.             except:
  39.                 continue
  40.  
  41.  
  42. if __name__ == '__main__':
  43.     threads = []
  44.     run_event.set()
  45.  
  46.     print('run')
  47.  
  48.     for _ in range(32):
  49.         t = Thread(target=bust)
  50.         threads.append(t)
  51.         t.start()
  52.  
  53.     try:
  54.         for t in threads:
  55.             t.join()
  56.     except KeyboardInterrupt:
  57.         run_event.clear()
  58.         print('\rInterrupt')
  59.         exit(130)
  60.  
  61.     print('stop')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement