#!/usr/bin/env python3

import os
import sys
from colorama import init, Fore, Back, Style

init(autoreset=True)

def display_banner():
    print()
    banner = [
        ""
        "Telegram: https://t.me/Exploit_0x\n"
    ]
    
    for line in banner:
        print(line)

def read_file(filename):
    try:
        with open(filename, 'r', encoding='utf-8') as file:
            return [line.strip() for line in file.readlines() if line.strip() and not line.startswith('#')]
    except:
        print(f"{Fore.RED}File Error: {filename}")
        sys.exit(1)

def remove_duplicates(items):
    seen = set()
    return [item for item in items if item and item not in seen and not seen.add(item)]

def generate_dork_combinations(templates, keywords):
    return [f'("{template}"){keyword}' for template in templates for keyword in keywords if template and keyword]

def main():
    display_banner()
    
    dork_templates = [
        "Comentarios en Hello world!", "author/admin", "uncategorized/hello-world",
        "category/sin-categoria", "uncategorized", "non-classé", "Proudly powered by WordPress",
        "Welcome to WordPress. This is your first post.", "Just another WordPress site",
        "Mr WordPress on Hello world!", "/wp/hello-world/", "wp-content/uploads",
        "wp-includes/js", "wp-json/wp", "wp-login.php", "wp-admin", "powered by WordPress",
        "Leave a reply", "Posted in Uncategorized", "Sample Page", "Archives", "Hello world!",
        "meta/wp", "wp-content/plugins", "wp-content/themes", "Site is proudly powered by WordPress",
        "Log in to your site", "Edit or delete it, then start writing!", "You may delete this page.",
        "Search for:", "Nothing Found", "index of /wp-content/", "index of /wp-includes/",
        "inurl:/wp-content/plugins/", "inurl:/wp-content/themes/", "inurl:/wp-json/wp/v2/",
        "inurl:?s=", "inurl:tag/hello-world", "inurl:author=", "intitle:Hello world! site:wordpress.com",
        "intitle:Sample Page", "intitle:Welcome", "intitle:Index of /wp-admin",
        "intext:'This site uses Akismet to reduce spam'", "intext:'Powered by WordPress and the'",
        "intext:'You can log in using the admin area'", "inurl:/wp-comments-post.php",
        "inurl:/xmlrpc.php", "inurl:/wp-content/cache/", "inurl:/wp-content/backups/",
        "inurl:/wp-config.php.bak"
    ]
    
    print(f"{Fore.WHITE}Input file path: ", end="")
    input_file = input().strip()
    
    if not input_file:
        print(f"{Fore.RED}No input")
        sys.exit(1)
    
    print(f"{Fore.BLUE}Processing...")
    keywords = read_file(input_file)
    unique_keywords = remove_duplicates(keywords)
    
    print(f"{Fore.GREEN}Keywords: {len(unique_keywords)} | Templates: {len(dork_templates)}")
    
    dork_combinations = remove_duplicates(generate_dork_combinations(dork_templates, unique_keywords))
    
    output_file = "Dorks.txt"
    try:
        with open(output_file, 'w', encoding='utf-8') as file:
            for dork in dork_combinations:
                file.write(dork + '\n')
        
        print(f"{Fore.GREEN}Generated: {len(dork_combinations)}")
        print(f"{Fore.GREEN}Location: {os.path.abspath(output_file)}")
        
        print(f"{Fore.YELLOW}\nSample output:")
        print(f"{Fore.YELLOW}{'-'*50}")
        for i, dork in enumerate(dork_combinations[:6], 1):
            print(f"{Fore.CYAN}{i:2d}. {dork}")
        if len(dork_combinations) > 6:
            print(f"{Fore.WHITE}   +{len(dork_combinations) - 6} more entries")
        
        print(f"{Fore.YELLOW}{'-'*50}")
        print(f"{Fore.GREEN}Operation complete")
            
    except Exception as e:
        print(f"{Fore.RED}Write error: {e}")
        sys.exit(1)

if __name__ == "__main__":
    main()
