From 66f713667fb8431adc17c6eccf6968380e07cd16 Mon Sep 17 00:00:00 2001 From: SofiaPetronelle <279085014+MercilessMarcel@users.noreply.github.com> Date: Tue, 12 May 2026 23:10:44 +0330 Subject: [PATCH] feat(scanner): dedupe output; add gitignore --- .gitignore | 23 ++++++++++++++++++++ IR NETLIFY SCANNER.py | 49 ++++++++++++++++++++++++------------------- README.md | 2 +- 3 files changed, 51 insertions(+), 23 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..08e9c7e --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +scan_results.txt +*.log +.env +.env.* +!.env.example +*.pem +*.key +id_rsa +id_rsa.pub +*.p12 +*.pfx +secrets.* +credentials.* +*.local +Thumbs.db +Desktop.ini +.DS_Store +.vscode/settings.json +.vscode/launch.json +.idea/workspace.xml +.idea/tasks.xml +.idea/dictionaries/ +.cursor/ diff --git a/IR NETLIFY SCANNER.py b/IR NETLIFY SCANNER.py index d7100d3..c1d4616 100644 --- a/IR NETLIFY SCANNER.py +++ b/IR NETLIFY SCANNER.py @@ -83,30 +83,35 @@ def main(): completed = 0 found_count = 0 ip_stats = Counter() + seen_domains = set() + seen_ips = set() + + with ThreadPoolExecutor(max_workers=MAX_THREADS) as executor: + try: + futures = {executor.submit(check_pair, ip, domain): (ip, domain) for ip, domain in tasks} + for future in as_completed(futures): + res = future.result() + completed += 1 + + sys.stdout.write(f"\r{BOLD}{C_MAGENTA} [PROGRESS]{RESET} {completed}/{total} | {BOLD}{C_GREEN}FOUND: {found_count}{RESET} ") + sys.stdout.flush() + + if res: + ip, dom, status = res + found_count += 1 + ip_stats[ip] += 1 + seen_domains.add(dom) + seen_ips.add(ip) + sys.stdout.write(f"\r{' ' * 80}\r") + status_color = C_GREEN if status == "OK" else C_RED + print(f" {C_GREEN}✔{RESET} {BOLD}{ip:<15}{RESET} → {dom:<25} ({status_color}{status}{RESET})") + except KeyboardInterrupt: + print(f"\n\n{C_RED}[!] Operation cancelled by user.{RESET}") + executor.shutdown(wait=False) with open("scan_results.txt", "w") as f: - with ThreadPoolExecutor(max_workers=MAX_THREADS) as executor: - try: - futures = {executor.submit(check_pair, ip, domain): (ip, domain) for ip, domain in tasks} - for future in as_completed(futures): - res = future.result() - completed += 1 - - sys.stdout.write(f"\r{BOLD}{C_MAGENTA} [PROGRESS]{RESET} {completed}/{total} | {BOLD}{C_GREEN}FOUND: {found_count}{RESET} ") - sys.stdout.flush() - - if res: - ip, dom, status = res - found_count += 1 - ip_stats[ip] += 1 - sys.stdout.write(f"\r{' ' * 80}\r") # Clear current line - status_color = C_GREEN if status == "OK" else C_RED - print(f" {C_GREEN}✔{RESET} {BOLD}{ip:<15}{RESET} → {dom:<25} ({status_color}{status}{RESET})") - f.write(f"{ip} {dom} {status}\n") - f.flush() - except KeyboardInterrupt: - print(f"\n\n{C_RED}[!] Operation cancelled by user.{RESET}") - executor.shutdown(wait=False) + if seen_domains or seen_ips: + f.write("\n".join(sorted(seen_domains)) + "\n\n\n" + "\n".join(sorted(seen_ips))) if found_count > 0: top_ip = ip_stats.most_common(1)[0] diff --git a/README.md b/README.md index 00d915e..df43a08 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ python IR NETLIFY SCANNER.py ## 📁 خروجی -نتایج معتبر داخل فایل زیر ذخیره می‌شوند: +نتایج معتبر داخل فایل زیر ذخیره می‌شوند؛ هر دامنه و هر IP یک‌بار (بدون تکرار)، بدون متن وضعیت، با دو خط خالی بین بلوک دامنه‌ها و بلوک IPها: ```bash id="8m0jlr" scan_results.txt