import re from urllib.parse import urlparse def main(): print("=== Domain & IP Sorter ===") input_file = raw_input("Enter your list filename (e.g. list.txt): ").strip() try: with open(input_file, "r") as f: lines = f.read().splitlines() except IOError: print("[!] File not found or unreadable.") return ip_pattern = re.compile(r"^(?:\d{1,3}\.){3}\d{1,3}$") domain_pattern = re.compile(r"^(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$") valid_domains = set() valid_ips = set() for raw in lines: parsed = urlparse(raw.strip()) host = parsed.netloc or parsed.path host = host.strip(".").lower() if ip_pattern.match(host): parts = host.split(".") if all(0 <= int(p) <= 255 for p in parts): valid_ips.add(host) elif domain_pattern.match(host): valid_domains.add(host) sorted_domains = sorted(valid_domains) sorted_ips = sorted(valid_ips, key=lambda ip: list(map(int, ip.split(".")))) with open("val.txt", "w") as out: out.write("=== VALID DOMAINS ===\n") for d in sorted_domains: out.write(d + "\n") out.write("\n=== VALID IPS ===\n") for i in sorted_ips: out.write(i + "\n") print("[+] Done! Results saved to val.txt") if __name__ == "__main__": main()
43
|
|
REPORT ABUSE
10/23/2025
Not all user generated content is reviewed by AnonPaste. If you believe this paste violates our community guideline or terms of service, please report it here.
Initializing...
Preparing the app. This may take a moment before app is ready.
AnonPaste is a user-generated content hosting service. The platform and its operators are not responsible for content posted by users.
Comments
No comments yet
Please complete the captcha