Seclists Password __link__ File

return result def sample_passwords(passwords: List[str], n: int, unique: bool = True) -> List[str]: """Randomly sample n passwords.""" if n <= 0: return [] if n >= len(passwords): return passwords[:] if unique: return random.sample(passwords, n) else: return [random.choice(passwords) for _ in range(n)]

try: resp = requests.get(url, timeout=15) resp.raise_for_status() cache_file.write_bytes(resp.content) print(f"[✓] Saved to cache_file") return cache_file except Exception as e: raise RuntimeError(f"Failed to download name: e") def load_passwords(name: str, cache_dir: Path = DEFAULT_CACHE_DIR) -> List[str]: """Return list of passwords (stripped, non-empty).""" path = download_wordlist(name, cache_dir) passwords = [] with open(path, "r", encoding="utf-8", errors="ignore") as f: for line in f: pwd = line.strip() if pwd: passwords.append(pwd) return passwords Search / Filter / Sample ---------------------------------------------------------------------- def filter_passwords( passwords: List[str], min_len: Optional[int] = None, max_len: Optional[int] = None, pattern: Optional[str] = None, only_digits: bool = False, only_alpha: bool = False, only_lower: bool = False, only_upper: bool = False, exclude_special: bool = False, must_contain: Optional[str] = None, ) -> List[str]: """Apply various filters to password list.""" result = passwords seclists password

# Load passwords try: all_passwords = load_passwords(args.list, cache_dir) except Exception as e: print(f"Error: e", file=sys.stderr) sys.exit(1) return result def sample_passwords(passwords: List[str]

if min_len is not None: result = [p for p in result if len(p) >= min_len] if max_len is not None: result = [p for p in result if len(p) <= max_len] if pattern: regex = re.compile(pattern) result = [p for p in result if regex.search(p)] if only_digits: result = [p for p in result if p.isdigit()] if only_alpha: result = [p for p in result if p.isalpha()] if only_lower: result = [p for p in result if p.islower()] if only_upper: result = [p for p in result if p.isupper()] if exclude_special: result = [p for p in result if p.isalnum()] if must_contain: result = [p for p in result if must_contain in p] unique: bool = True) -&gt

# Show stats if args.stats: print("\n=== Statistics ===") print(f"Total in wordlist : len(all_passwords)") print(f"After filters/search : len(filtered)") if args.sample: print(f"Sampled : len(result)") if len(result) > 0: lengths = [len(p) for p in result] print(f"Min length : min(lengths)") print(f"Max length : max(lengths)") print(f"Avg length : sum(lengths)/len(lengths):.1f") print(f"Unique results : len(set(result))") print("==================\n")