def decrypt_test(self, bit_string): obj = AES.new(self.master_key, 2, self.iv) string = obj.decrypt(bit_string) string = pkcs.unpad(string, 16) if b';admin=true;' in string: return True else: return False
def conversation_eavesdrop(): cipher = AES.new(shared_key, AES.MODE_CBC, b'a' * 16) while True: data = connA.recv(1024) text = cipher.decrypt(data) print(pkcs.unpad(text, 16).decode()) sB.sendall(data)
def conversation_listen(): cipher = AES.new(shared_key, AES.MODE_CBC, b'a' * 16) while True: data = conn.recv(1024) text = cipher.decrypt(data) print(pkcs.unpad(text, 16).decode())
def main(): pt = sample_plaintexts[randint(0, len(sample_plaintexts))] pt = oracle.encrypt(pt) print(pkcs.unpad(decrypt_ciphertext(pt[0], pt[1]).encode(), 16))
def decrypt(self, bit_string, iv): obj = AES.new(self.master_key, 2, iv) string = obj.decrypt(bit_string) string = pkcs.unpad(string, 16) return string
def decrypt(self, bit_string): obj = AES.new(self.master_key, 6, counter=counter(0)) string = obj.decrypt(bit_string) string = pkcs.unpad(string, 16) return string
def decrypt_profile(self, ciphertext): #AES decrypt encoded profile from Crypto.Cipher import AES obj = AES.new(self.master_k, 1) profile = obj.decrypt(ciphertext) return pkcs.unpad(profile, 16).decode()