Python解密过程及代码是什么
Admin 2022-08-23 群英技术资讯 508 次浏览
以下是使用Python解密加密文件的示例代码;
#!/usr/bin/python # ---------------- READ ME --------------------------------------------- # This Script is Created Only For Practise And Educational Purpose Only # This Script Is Created For http://bitforestinfo.blogspot.in # This Script is Written By # # ################################################## ######## Please Don't Remove Author Name ######### ############### Thanks ########################### ################################################## # # # =================Other Configuration================ # Usages : usage = "usage: %prog [options] " # Version Version="%prog 0.0.1" # ==================================================== # Import Modules import optparse, sys,os from toolkit import processor as ps def main(): parser = optparse.OptionParser(usage = usage,version = Version) parser.add_option( '-i','--input',type = 'string',dest = 'inputfile', help = "File Input Path For Encryption", default = None) parser.add_option( '-o','--output',type = "string",dest = 'outputfile', help = "File Output Path For Saving Encrypter Cipher",default = ".") parser.add_option( '-p','--password',type = "string",dest = 'password', help = "Provide Password For Encrypting File",default = None) (options, args) = parser.parse_args() # Input Conditions Checkings if not options.inputfile or not os.path.isfile(options.inputfile): print " [Error] Please Specify Input File Path" exit(0) if not options.outputfile or not os.path.isdir(options.outputfile): print " [Error] Please Specify Output Path" exit(0) if not options.password: print " [Error] No exit(0) inputfile = options.inputfile outputfile = options.outputfile password = options.password work = "D" ps.FileCipher(inputfile,outputfile,password,work) return if __name__ == '__main__': main()
您可以使用以下命令执行上述代码 :
python pyfilecipher-decrypt.py -i encrypted_file_path -p password
执行上面显示的命令时,您可以观察以下代码 :
注意 : 输出指定加密前和解密后的哈希值,它记录了同一文件已加密并且过程成功.
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
签到,都是规律性的操作,何尝不写一个程序加到Windows实现自动签到呢,本文就主要介绍了如何利用Python实现自动打卡签到的实践,具有一定的参考价值,感兴趣的可以了解一下
这篇文章主要为大家介绍了PyTorch实现FedProx的联邦学习算法,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
这篇文章主要介绍了Python迭代器的实现原理,文章基于python的相关资料展开对Python迭代器的详细介绍,需要的小伙伴可以参考一下
python int是什么意思?python中的int()函数用于将一个字符串或数字转换为整型。
本文通过两个版本给大家介绍pygame实现类似office的页面切换功能,代码简单易懂,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008