import os
import hashlib
import base64
import random
import string
import time
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.backends import default_backend
import ctypes
import inspect
def generate_captcha():
characters = string.ascii_letters + string.digits
captcha = ''.join(random.choices(characters, k=6))
return captcha
def validate_captcha(user_input, captcha):
return user_input == captcha
def generate_rsa_key():
private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048, backend=default_backend())
public_key = private_key.public_key()
return (private_key, public_key)
def encrypt_with_rsa(public_key, data):
return public_key.encrypt(data, padding.OAEP(mgf=padding.MGF1(algorithm=hashes.SHA256()), algorithm=hashes.SHA256(), label=None))
def decrypt_with_rsa(private_key, encrypted_data):
return private_key.decrypt(encrypted_data, padding.OAEP(mgf=padding.MGF1(algorithm=hashes.SHA256()), algorithm=hashes.SHA256(), label=None))
def generate_aes_key():
return os.urandom(32)
def encrypt_with_aes(key, plaintext):
iv = os.urandom(16)
cipher = Cipher(algorithms.AES(key), modes.CFB(iv), backend=default_backend())
encryptor = cipher.encryptor()
encrypted = encryptor.update(plaintext) + encryptor.finalize()
return iv + encrypted
def decrypt_with_aes(key, ciphertext):
iv = ciphertext[:16]
encrypted = ciphertext[16:]
cipher = Cipher(algorithms.AES(key), modes.CFB(iv), backend=default_backend())
decryptor = cipher.decryptor()
decrypted = decryptor.update(encrypted) + decryptor.finalize()
return decrypted
def hash_password(password, salt):
kdf = PBKDF2HMAC(algorithm=hashes.SHA3_512(), length=64, salt=salt, iterations=200000, backend=default_backend())
key = base64.urlsafe_b64encode(kdf.derive(password.encode()))
return key
def complex_obfuscate(code):
obfuscation_key = random.randint(1, 50)
obfuscated_code = ''.join((chr((ord(char) + obfuscation_key) % 256) for char in code))
obfuscated_code = base64.b64encode(obfuscated_code.encode()).decode()
return (obfuscated_code, obfuscation_key)
def complex_deobfuscate(obfuscated_code, obfuscation_key):
obfuscated_code = base64.b64decode(obfuscated_code.encode()).decode()
return ''.join((chr((ord(char) - obfuscation_key) % 256) for char in obfuscated_code))
def generate_dynamic_code():
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=10))
def validate_dynamic_code(input_code, correct_code):
return input_code == correct_code
def generate_file_hash(file_path):
hash_algo = hashlib.sha256()
with open(file_path, 'rb') as f:
while (chunk := f.read(8192)):
hash_algo.update(chunk)
return hash_algo.hexdigest()
def anti_debugging_check():
kernel32 = ctypes.windll.kernel32
if kernel32.IsDebuggerPresent():
raise RuntimeError('Debugger detected!')
def setup_password():
password = 'helalolsunbecheatglobercrackcısıbabapiromusunnesinyawভଗବାନ ଏବଂ ମହମ୍ମଦଙ୍କୁ ଧର, ତୁମେ ଏହାକୁ କିପରି ପାଇଲ'
salt = os.urandom(32)
hashed_password = hash_password(password, salt)
private_key, public_key = generate_rsa_key()
encrypted_key = encrypt_with_rsa(public_key, hashed_password)
aes_key = generate_aes_key()
encrypted_password = encrypt_with_aes(aes_key, password.encode())
dynamic_code = generate_dynamic_code()
captcha = generate_captcha()
print(f'CAPTCHA kodunuz: {captcha}')
print(f'Dinamik kodunuz: {dynamic_code}')
obfuscated_password, obfuscation_key = complex_obfuscate(password)
return (aes_key, encrypted_key, private_key, encrypted_password, salt, dynamic_code, captcha, obfuscated_password, obfuscation_key)
def check_password(aes_key, encrypted_key, private_key, encrypted_password, salt, dynamic_code, captcha, obfuscated_password, obfuscation_key):
try:
anti_debugging_check()
input_captcha = input('CAPTCHA kodunu girin: ')
if not validate_captcha(input_captcha, captcha):
print('Yanlış CAPTCHA kodu.')
return
input_dynamic_code = input('Dinamik kodu girin: ')
if not validate_dynamic_code(input_dynamic_code, dynamic_code):
print('Yanlış dinamik kod.')
else:
input_password = input('Şifrenizi girin: ')
decrypted_key = decrypt_with_rsa(private_key, encrypted_key)
decrypted_password = decrypt_with_aes(aes_key, encrypted_password).decode()
if hash_password(input_password, salt) == decrypted_key and complex_obfuscate(input_password)[0] == obfuscated_password:
print('Tebrikler! Kırmayı başardınız.')
else:
print('Yanlış şifre.')
except Exception as e:
print(f'Bir hata oluştu: {e}')
def main():
aes_key, encrypted_key, private_key, encrypted_password, salt, dynamic_code, captcha, obfuscated_password, obfuscation_key = setup_password()
check_password(aes_key, encrypted_key, private_key, encrypted_password, salt, dynamic_code, captcha, obfuscated_password, obfuscation_key)
if __name__ == '__main__':
main()