python编译、运行、反编译pyc文件

编译pyc 

import py_compile
py_compile.compile("test.py")

编译脚本:

  

import py_compile
import os
import sys


file_path_name = sys.argv[1]

if file_path_name:
    jiami = py_compile.compile("%s" %file_path_name)
    rename = "%s.%s" %(jiami.split(".")[0], jiami.split(".")[2])
    os.rename(jiami,rename)
    print("加密后的文件:", rename)
else:
    print("没有要加密的文件")

 

 

命令行的形式

python -m py_compile test.py

反编译 uncompyle6 模块

内网安装依赖包
现在依赖包编译安装即可
   python包下载地址: https://pypi.org/project/xlwt/
  python setup.py install --record remove.txt

       先安装xdis  xdis-5.0.8.tar.gz
       在装 click  click-7.1.2.tar.gz
       然后 spark_parser  spark_parser-1.8.9.tar.gz
       最后 uncompyle6  uncompyle6-3.7.4.tar.gz  

uncompyle6 test.pyc > test1.py
posted @ 2021-03-26 15:44  QQmini  阅读(364)  评论(0编辑  收藏  举报