Created
April 24, 2025 06:24
-
-
Save RajChowdhury240/58bbd59d2d231eae74934de1ee41fdab 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
from rich.console import Console | |
from rich.prompt import Prompt | |
from rich.progress import track | |
from rich.panel import Panel | |
import hashlib | |
import sys | |
import os | |
console = Console() | |
def compute_nt_hash(password): | |
# NT hash is MD4 of UTF-16LE encoded password | |
return hashlib.new('md4', password.encode('utf-16le')).hexdigest() | |
def print_banner(): | |
console.print("[bold magenta]███╗ ██╗████████╗[/bold magenta]") | |
console.print("[bold magenta]████╗ ██║╚══██╔══╝[/bold magenta]") | |
console.print("[bold magenta]██╔██╗ ██║ ██║ [/bold magenta]") | |
console.print("[bold magenta]██║╚██╗██║ ██║ [/bold magenta]") | |
console.print("[bold magenta]██║ ╚████║ ██║ [/bold magenta]") | |
console.print("[bold magenta]╚═╝ ╚═══╝ ╚═╝ [/bold magenta]\n") | |
console.print("[bold red]🔐 NT HASH Generator[/bold red]\n") | |
def main(): | |
print_banner() | |
mode = Prompt.ask("[bold cyan]Choose mode[/bold cyan]", choices=["single", "file"], default="single") | |
if mode == "single": | |
password = Prompt.ask("[bold yellow]Enter password[/bold yellow]") | |
with console.status("[bold green]Computing NT hash...[/bold green]", spinner="bouncingBar"): | |
nt_hash = compute_nt_hash(password) | |
console.print(f"\n[bold green]✔ NT Hash:[/bold green] [bold white on black]{nt_hash}[/bold white on black]") | |
elif mode == "file": | |
file_path = Prompt.ask("[bold yellow]Enter path to password list[/bold yellow]") | |
if not os.path.isfile(file_path): | |
console.print(f"[bold red]File not found:[/bold red] {file_path}") | |
sys.exit(1) | |
with open(file_path, 'r', encoding='utf-8', errors='ignore') as f: | |
passwords = [line.strip() for line in f if line.strip()] | |
results = [] | |
console.print(f"\n[bold cyan]🔄 Hashing {len(passwords)} password(s)...[/bold cyan]\n") | |
for pwd in track(passwords, description="[bold green]Generating NT hashes[/bold green]"): | |
nt_hash = compute_nt_hash(pwd) | |
results.append((pwd, nt_hash)) | |
console.print("\n[bold magenta]🎉 Results:[/bold magenta]\n") | |
for pwd, nt_hash in results: | |
console.print(f"[bold yellow]{pwd}[/bold yellow] → [bold green]{nt_hash}[/bold green]") | |
console.print(Panel("[bold green]All hashes generated successfully![/bold green] 🚀", style="bold cyan")) | |
if __name__ == "__main__": | |
try: | |
main() | |
except KeyboardInterrupt: | |
console.print("\n[bold red]User interrupted. Exiting.[/bold red]") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment