怎样基于python实现脚本加密

  介绍

小编给大家分享一下怎样基于python实现脚本加密,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获、下面让我们一起去了解一下吧!

怎样基于python实现脚本加密

得到pathlib  import 路径   import  python_minifier   import  compileall   import 系统      def  get_save_path (from_dir, to_dir,, p):   ori_dir 才能=,str (from_dir.resolve ())   _p 才能=,str (p.resolve ())   return 才能;to_dir.joinpath (_p.split (ori_dir) [1] [1:])   def  mix_pyminifier (from_dir, to_dir):   for 才能;_p 拷贝from_dir.rglob (& # 39; * . py # 39;):   ,,,with  _p.open(编码=& # 39;utf - 8 # 39;), as  read_fp:   ,,,,,res =, python_minifier.minify (read_fp.read ())      ,,,_to_p =, get_save_path (from_dir, to_dir,, _p)   ,,,的路径(_to_p.parent) .mkdir (exist_ok=True,,父母=True)   ,,,with  _to_p.open (& # 39; w # 39;,,编码=& # 39;utf - 8 # 39;), as  write_fp:   ,,,,,write_fp.write (res)         def  py2pyc (from_dir, to_dir):   compileall.compile_dir才能(str (from_dir.resolve ()),, maxlevels=20,,=True)   def  pyc2py (from_dir, to_dir):   ,通过   if  __name__ ==, & # 39; __main__ # 39;:   时间=origin_dir 才能;路径(sys.argv [1])   时间=target_dir 才能;路径(sys.argv [2])   pymini_dir 才能=,target_dir.joinpath (& # 39; pymini& # 39;)   pyc_dir 才能=,target_dir.joinpath (& # 39; pyc_dir& # 39;)   py_dir 才能=,target_dir.joinpath (& # 39; py_dir& # 39;)   mix_pyminifier才能(origin_dir, target_dir)   #,才能py2pyc (origin_dir, pyc_dir)   #,才能pyc2py (pyc_dir, pyc_dir)

以上是“怎样基于python实现脚本加密”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!

怎样基于python实现脚本加密