예제 #1
0
 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
예제 #2
0
 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)
예제 #3
0
 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())
예제 #4
0
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))
예제 #5
0
 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
예제 #6
0
 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
예제 #7
0
 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()