def shipFile(zipfile): # connect to host, default port ftp = FTP('acme','backup','backup') ftp.retrlines('LIST') # list directory contents ftp.cwd('/vostro') print "directory set to "+ftp.pwd() print "Uploading...", f = open(zipfile+".encrypt", "rb") ### Hangs Here ftp.storbinary('STOR ' + zipfile.replace(TMP,'')+".encrypt", f) f.close() print "File uploaded" ftp.quit()
def decryptFile(zipfile): print "Decrypting: %s%s"%(zipfile,".encrypt") fi = open(zipfile+".encrypt", 'rb') fo = open(zipfile.replace('.encript',''), 'wb') while 1: indata = fi.read(65536) if not indata: break print '.', if(len(indata)==65536): decoded = DecodeAES(cipher, indata ) else: decoded = DecodeAESlast(cipher, indata ) fo.write(decoded) fo.close fi.close