Instacracker-cli -
def brute_force_attack(self, target_hash: str, hash_type: str = "md5", max_length: int = 6, charset: str = None) -> Tuple[Optional[str], int]: """Perform brute force attack""" charset = charset or string.ascii_lowercase + string.digits self.attempts = 0 self.start_time = time.time() print(f"[*] Starting brute force attack (max length: max_length)...") for length in range(1, max_length + 1): for combo in itertools.product(charset, repeat=length): word = ''.join(combo) self.attempts += 1 if self._check_hash(word, target_hash, hash_type): elapsed = time.time() - self.start_time return word, self.attempts, elapsed # Progress indicator if self.verbose and self.attempts % 10000 == 0: print(f"[*] Attempts: self.attempts, Current: word") elapsed = time.time() - self.start_time return None, self.attempts, elapsed
I'll generate a comprehensive instacracker-cli tool - a command-line password strength testing tool for educational purposes.
#!/usr/bin/env python3 """ instacracker-cli - A command-line password strength testing tool For educational and security assessment purposes only """ import hashlib import itertools import string import time import sys import argparse import re from typing import Dict, List, Tuple, Optional import json
if args.command == 'hash': cracker = InstaCrackerCLI(verbose=args.verbose) # Load custom wordlist if provided wordlist = None if args.wordlist: with open(args.wordlist, 'r') as f: wordlist = [line.strip() for line in f] if args.method == 'dict': result, attempts, elapsed = cracker.dictionary_attack( args.target, args.type, wordlist ) elif args.method == 'brute': result, attempts, elapsed = cracker.brute_force_attack( args.target, args.type, args.max_length ) else: # hybrid result, attempts, elapsed = cracker.hybrid_attack( args.target, args.type, wordlist ) print(f"\n[+] Results:") print(f" Password found: result if result else 'Not found'") print(f" Attempts: attempts:,") print(f" Time: elapsed:.2f seconds") print(f" Speed: attempts/elapsed:.0f attempts/second") elif args.command == 'analyze': cracker = InstaCrackerCLI() analysis = cracker.analyze_password(args.password) print(f"\n[+] Password Analysis for: args.password") print(f" Strength: analysis['strength']") print(f" Score: analysis['score']/6") print(f" Entropy: analysis['entropy_bits']:.0f bits") print(f" Length: analysis['length']") print(f" Contains:") print(f" - Uppercase: analysis['has_upper']") print(f" - Lowercase: analysis['has_lower']") print(f" - Digits: analysis['has_digits']") print(f" - Special: analysis['has_special']") if analysis['feedback']: print(f"\n Suggestions:") for suggestion in analysis['feedback']: print(f" - suggestion") elif args.command == 'generate': cracker = InstaCrackerCLI() base_words = args.words.split(',') cracker.generate_wordlist( base_words, args.output, add_numbers=not args.no_numbers, add_special=not args.no_special ) elif args.command == 'interactive': print(""" ╔══════════════════════════════════════════════════════════════╗ ║ InstaCracker CLI - Interactive Mode ║ ║ For Educational Use Only ║ ╚══════════════════════════════════════════════════════════════╝ """) instacracker-cli
def generate_wordlist(self, base_words: List[str], output_file: str, add_numbers: bool = True, add_special: bool = True): """Generate custom wordlist with mutations""" words = set(base_words) if add_numbers: for word in base_words: for num in range(1, 100): words.add(f"wordnum") words.add(f"wordnum:02d") if add_special: specials = ["!", "@", "#", "$", "123", "2023"] for word in base_words: for special in specials: words.add(f"wordspecial") words.add(f"specialword") with open(output_file, 'w') as f: for word in sorted(words): f.write(f"word\n") print(f"[+] Generated len(words) words to output_file") return len(words)
class InstaCrackerCLI: def (self, verbose=False): self.verbose = verbose self.common_passwords = self._load_common_passwords() self.attempts = 0 self.start_time = None
args = parser.parse_args()
# Generate wordlist command generate_parser = subparsers.add_parser('generate', help='Generate custom wordlist') generate_parser.add_argument('--words', required=True, help='Comma-separated base words') generate_parser.add_argument('--output', required=True, help='Output file') generate_parser.add_argument('--no-numbers', action='store_true', help='Don\'t add numbers') generate_parser.add_argument('--no-special', action='store_true', help='Don\'t add special characters')
# Analyze command analyze_parser = subparsers.add_parser('analyze', help='Analyze password strength') analyze_parser.add_argument('--password', required=True, help='Password to analyze')
def analyze_password(self, password: str) -> Dict: """Analyze password strength and provide feedback""" score = 0 feedback = [] # Length check if len(password) >= 12: score += 2 elif len(password) >= 8: score += 1 else: feedback.append("Password is too short (minimum 8 characters)") # Complexity checks if re.search(r'[A-Z]', password): score += 1 else: feedback.append("Add uppercase letters") if re.search(r'[a-z]', password): score += 1 else: feedback.append("Add lowercase letters") if re.search(r'\d', password): score += 1 else: feedback.append("Add numbers") if re.search(r'[!@#$%^&*(),.?":{}|<>]', password): score += 1 else: feedback.append("Add special characters") # Check against common passwords if password.lower() in self.common_passwords: score -= 2 feedback.append("Password is too common") # Entropy calculation (simplified) charset_size = 0 if re.search(r'[a-z]', password): charset_size += 26 if re.search(r'[A-Z]', password): charset_size += 26 if re.search(r'\d', password): charset_size += 10 if re.search(r'[!@#$%^&*(),.?":{}|<>]', password): charset_size += 32 entropy = len(password) * (charset_size.bit_length() - 1) if charset_size > 0 else 0 # Strength rating if score >= 5: strength = "Very Strong" elif score >= 4: strength = "Strong" elif score >= 3: strength = "Moderate" elif score >= 2: strength = "Weak" else: strength = "Very Weak" return { "score": score, "strength": strength, "entropy_bits": entropy, "feedback": feedback, "length": len(password), "has_upper": bool(re.search(r'[A-Z]', password)), "has_lower": bool(re.search(r'[a-z]', password)), "has_digits": bool(re.search(r'\d', password)), "has_special": bool(re.search(r'[!@#$%^&*(),.?":{}|<>]', password)) } def main(): parser = argparse.ArgumentParser( description='InstaCracker CLI - Password Security Testing Tool', formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" Examples: %(prog)s hash --target 5f4dcc3b5aa765d61d8327deb882cf99 --type md5 %(prog)s analyze --password "MySecurePass123!" %(prog)s brute --hash 5f4dcc3b5aa765d61d8327deb882cf99 --max-length 5 %(prog)s generate --words admin,password,test --output wordlist.txt """ ) hash_type: str = "md5"
def _load_common_passwords(self) -> List[str]: """Load common passwords from built-in list""" return [ "password", "123456", "123456789", "qwerty", "abc123", "admin", "letmein", "welcome", "monkey", "dragon", "master", "sunshine", "iloveyou", "football", "baseball" ]
def dictionary_attack(self, target_hash: str, hash_type: str = "md5", wordlist: List[str] = None) -> Tuple[Optional[str], int]: """Perform dictionary attack against hash""" wordlist = wordlist or self.common_passwords self.attempts = 0 self.start_time = time.time() print(f"[*] Starting dictionary attack with len(wordlist) words...") for word in wordlist: self.attempts += 1 if self._check_hash(word, target_hash, hash_type): elapsed = time.time() - self.start_time return word, self.attempts, elapsed elapsed = time.time() - self.start_time return None, self.attempts, elapsed
subparsers = parser.add_subparsers(dest='command', help='Commands') max_length: int = 6
# Interactive mode subparsers.add_parser('interactive', help='Interactive mode')
def hybrid_attack(self, target_hash: str, hash_type: str = "md5", base_words: List[str] = None) -> Tuple[Optional[str], int]: """Hybrid attack combining dictionary with mutations""" base_words = base_words or self.common_passwords mutations = [ lambda x: x + "123", lambda x: x + "1234", lambda x: x + "!", lambda x: x.capitalize(), lambda x: x.upper(), lambda x: x + "2023", lambda x: x + "@", ] self.attempts = 0 self.start_time = time.time() print(f"[*] Starting hybrid attack...") for word in base_words: # Check original self.attempts += 1 if self._check_hash(word, target_hash, hash_type): elapsed = time.time() - self.start_time return word, self.attempts, elapsed # Check mutations for mutation in mutations: mutated = mutation(word) self.attempts += 1 if self._check_hash(mutated, target_hash, hash_type): elapsed = time.time() - self.start_time return mutated, self.attempts, elapsed elapsed = time.time() - self.start_time return None, self.attempts, elapsed