def step_5(): x = mpz(int(generate_hash(Client['salt'], P), 16)) S = powmod((Client['B'] - (k * powmod(g, x, N))), Client['a'] + (Client['u'] * x), N) K = hash_sha256(str(S)) Client['K'] = K return
def step_5(_S=-1): x = mpz(int(generate_hash(Client['salt'], P), 16)) if _S == -1: S = powmod(Client['B'], Client['a'] + (Client['u'] * x), N) else: S = _S K = hash_sha256(str(S)) Client['K'] = K return
def step_5(passwd=P, _S=-1): x = mpz(int(generate_hash(Client['salt'], passwd), 16)) if _S == -1: S = powmod((Client['B'] - (k * powmod(g, x, N))), Client['a'] + (Client['u'] * x), N) else: S = _S K = hash_sha256(str(S)) Client['K'] = K return
def solver(): A, b, B, u, hash = srp("") fp = open("passwords.txt", "r") passwords = fp.readlines() for password in passwords: password = password.strip() print "[*] Trying Password: '******'" % (password) x = mpz(int(generate_hash("", password), 16)) S = t_mod(powmod(A, b, N) * powmod(B, u * x, N), N) K = hash_sha256(str(S)) h = hmac(K, "", hash_function=hash_sha256) if h == hash: print "[+] Got it. Password = '******'" % (password) return
def step_6(): S = powmod(Server['A'] * powmod(Server['v'], Server['u'], N), Server['b'], N) K = hash_sha256(str(S)) Server['K'] = K return
def generate_hash(salt, data): return hash_sha256(salt + data)