#!/home/hoogca/virtualenv/bri/3.7/bin/python #import os print("") from sshfs import SSHFileSystem from cryptography.fernet import Fernet #message = "" #key = Fernet.generate_key() #fernet = Fernet(key) #encMessage1 = fernet.encrypt(message.encode()) #print(f"{encMessage1}
") #print("original string: ", message) #print("encrypted string: ", encMessage) #encMessage2 ="" #with open("/home/hoogca/cc.txt", "rb") as f: # encMessage2 = f.readlines() #print(f"{encMessage2}") #decMessage = fernet.decrypt(f"{encMessage}").decode() #print("decrypted string: ", decMessage) import rsa # generate public and private keys with # rsa.newkeys method,this method accepts # key length as its parameter # key length should be atleast 16 publicKey, privateKey = rsa.newkeys(512) # this is the string that we will be encrypting message = "hello geeks" # rsa.encrypt method is used to encrypt # string with public key string should be # encode to byte string before encryption # with encode method #encMessage = rsa.encrypt(message.encode(),publicKey) #print(f"original string: {message}
" ) #print(f"encrypted string: {encMessage}
" ) #print(f"publicKey string: {publicKey}
" ) # the encrypted message can be decrypted # with ras.decrypt method and private key # decrypt method returns encoded byte string, # use decode method to convert it to string # public key cannot be used for decryption #decMessage1 = rsa.decrypt(encMessage, privateKey).decode() #print(f"decrypted string: {decMessage1}
") # with open("/home/hoogca/cc.txt", "r") as f: # lines = f.readlines() # code=lines[0] # key=lines[1] # print(f"{code}
{key}") # decMessage2 = rsa.decrypt(code, key).decode() # print(f"decrypted string: {decMessage2}") from webdav3.client import Client options = { 'webdav_hostname': "https://app.koofr.net/dav/Koofr", 'webdav_login': "marco@vanhethoog.com", 'webdav_password': "vy0laul5m38c21b1" } client = Client(options) files1 = client.list("", get_info=True) for file in files1: print(f"{file}
\n") #fs = SSHFileSystem('cedar.computecanada.ca',username='marcovth',password='')