Untitled

 avatar
unknown
plain_text
a year ago
1.4 kB
4
Indexable
import sys

def to_hex_string(s):
    return '$HEX[' + s.encode('utf-8').hex() + ']'

def read_combolists(file_paths):
    passwords = set()

    for file_path in file_paths:
        try:
            with open(file_path, 'r') as file:
                for line in file:
                    if ':' in line:
                        parts = line.strip().split(':', 1)
                        # Convert each password to hex format
                        hex_password = to_hex_string(parts[1])
                        passwords.add(hex_password)
        except FileNotFoundError:
            print(f"File not found: {file_path}")
        except Exception as e:
            print(f"Error processing file {file_path}: {e}")

    return passwords

def write_passwords_to_file(passwords, output_file):
    try:
        with open(output_file, 'w') as file:
            for password in passwords:
                file.write(password + '\n')
    except Exception as e:
        print(f"Error writing to file {output_file}: {e}")

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python script.py file1.txt file2.txt ...")
    else:
        file_paths = sys.argv[1:]
        passwords = read_combolists(file_paths)
        output_file = 'unique_passwords.txt'
        write_passwords_to_file(passwords, output_file)
        print(f"Unique passwords extracted in hex format to '{output_file}'")
Editor is loading...
Leave a Comment