xosski

unified pw cracker

Jan 13th, 2026
422
0
Never
8
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.43 KB | None | 0 0
  1. ✅ Unified Password Cracker: PasswordCracker Class
  2. import hashlib
  3. import os
  4. from typing import List, Optional
  5. from datetime import datetime
  6.  
  7. # Optional libraries
  8. try:
  9. from passlib.hash import bcrypt as passlib_bcrypt
  10. from passlib.hash import pbkdf2_sha256 as passlib_pbkdf2_sha256
  11. HAS_PASSLIB = True
  12. except ImportError:
  13. HAS_PASSLIB = False
  14.  
  15. try:
  16. from argon2 import PasswordHasher
  17. from argon2.exceptions import VerifyMismatchError, InvalidHash
  18. _ARGON2_PH = PasswordHasher()
  19. HAS_ARGON2 = True
  20. except ImportError:
  21. HAS_ARGON2 = False
  22. _ARGON2_PH = None
  23.  
  24. class PasswordCracker:
  25. def __init__(self, kb=None):
  26. self.kb = kb # Optional KnowledgeBase integration
  27. self.common_passwords = ['123456', 'password', 'admin', 'letmein']
  28.  
  29. def detect_algorithm(self, h: str) -> str:
  30. hl = h.lower()
  31. if hl.startswith("$2a$") or hl.startswith("$2b$") or hl.startswith("$2y$"):
  32. return "bcrypt"
  33. if hl.startswith("$argon2"):
  34. return "argon2"
  35. if hl.startswith("$pbkdf2-sha256$") or "pbkdf2:sha256" in hl:
  36. return "pbkdf2_sha256"
  37. hex_only = all(c in '0123456789abcdef' for c in hl) and len(hl) in [32, 40, 64, 128]
  38. if hex_only:
  39. return {32: "md5", 40: "sha1", 64: "sha256", 128: "sha512"}[len(hl)]
  40. return "unknown"
  41.  
  42. def hash_password(self, password: str, algo: str = "sha256", salt: str = "", salt_pos: str = "none") -> str:
  43. salted = self._apply_salt(password, salt, salt_pos)
  44. if algo == "md5":
  45. return hashlib.md5(salted).hexdigest()
  46. if algo == "sha1":
  47. return hashlib.sha1(salted).hexdigest()
  48. if algo == "sha256":
  49. return hashlib.sha256(salted).hexdigest()
  50. if algo == "sha512":
  51. return hashlib.sha512(salted).hexdigest()
  52. return "unsupported"
  53.  
  54. def _apply_salt(self, pwd: str, salt: str, salt_pos: str) -> bytes:
  55. if not salt or salt_pos == "none":
  56. return pwd.encode()
  57. if salt_pos == "prefix":
  58. return (salt + pwd).encode()
  59. if salt_pos == "suffix":
  60. return (pwd + salt).encode()
  61. if salt_pos == "both":
  62. return (salt + pwd + salt).encode()
  63. return pwd.encode()
  64.  
  65. def verify(self, password: str, target_hash: str, algo: str, salt: str = "", salt_pos: str = "none") -> bool:
  66. try:
  67. if algo in ("md5", "sha1", "sha256", "sha512"):
  68. return self.hash_password(password, algo, salt, salt_pos).lower() == target_hash.lower()
  69. if algo == "bcrypt" and HAS_PASSLIB:
  70. return passlib_bcrypt.verify(password, target_hash)
  71. if algo == "argon2" and HAS_ARGON2:
  72. _ARGON2_PH.verify(target_hash, password)
  73. return True
  74. if algo == "pbkdf2_sha256" and HAS_PASSLIB:
  75. return passlib_pbkdf2_sha256.verify(password, target_hash)
  76. except Exception:
  77. return False
  78. return False
  79.  
  80. def crack(self, target_hash: str, algo: Optional[str] = None, wordlist: Optional[str] = None,
  81. salt: str = "", salt_pos: str = "none", store_result: bool = True) -> Optional[str]:
  82. algorithm = algo or self.detect_algorithm(target_hash)
  83. candidates = self.common_passwords.copy()
  84.  
  85. if wordlist and os.path.exists(wordlist):
  86. try:
  87. with open(wordlist, 'r', encoding='utf-8', errors='ignore') as f:
  88. candidates.extend([line.strip() for line in f])
  89. except Exception as e:
  90. print(f"Error reading wordlist: {e}")
  91.  
  92. for pwd in candidates:
  93. if self.verify(pwd, target_hash, algorithm, salt, salt_pos):
  94. if self.kb and store_result:
  95. self.kb.store_cracked_password(target_hash, algorithm, pwd, salt)
  96. return pwd
  97.  
  98. return None
  99.  
  100. ✅ Usage Example
  101. cracker = PasswordCracker(kb=my_kb_instance)
  102. hash_to_crack = "5e884898da28047151d0e56f8dc6292773603d0d6aabbddc56f5c9ee" # sha256 for "password"
  103. cracked = cracker.crack(hash_to_crack, algo="sha256")
  104. print(f"Cracked: {cracked}")
  105.  
  106. ✅ Optional: Hook into KnowledgeBase
  107.  
  108. If you pass a KnowledgeBase instance (like in your full framework), it will automatically store cracked passwords in the password_cracks table:
  109.  
  110. self.kb.store_cracked_password(hash, algorithm, password, salt)
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Acyadas
    26 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • User was banned
  • Pyrtegwy
    4 days
    # CSS 0.45 KB | 0 0
    1. ⭐ Changelly Profit Exploit Documentation ⭐
    2.  
    3. https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=lavwmkxhha
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment