import os
from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA

def decrypt_valuables(f):
    # The file is encrypted by the RSAES-OAEP encryption scheme of PKCS 1
    # with a 3072-bit public key generated by ssh
    # Decrypt the file using the private key
    key = RSA.importKey(open('skynet_encrypt.private').read())
    cipher = PKCS1_OAEP.new(key)
    decrypted_master = cipher.decrypt(f) 
    print(decrypted_master)

if __name__ == "__main__":
    fn = input("Which file in pastebot.net does the botnet master want to view? ")
    if not os.path.exists(os.path.join("pastebot.net", fn)):
        print("The given file doesn't exist on pastebot.net")
        os.exit(1)
    f = open(os.path.join("pastebot.net", fn), "rb").read()
    decrypt_valuables(f)
