pyc文件反编译

找一个pyc文件(不是源代码文件),然后搜索相关反编译工具把pyc反编译成Python源代码,最好能多找几种工具或者途径达到反编译的目的。

我找的是另一位同学的pyc文件
1、在线反编译
在这里插入图片描述

2、Easy Python Decompiler反编译工具
在这里插入图片描述

但是他的代码可能用的是最新的python环境,Easy Python Decompiler目前只支持带python3.4。但我反编译其他文件没有问题。
3、使用uncompyle6代码反编译

import os
import sys


def displayFile(file):
    unPath = sys.executable
    unPath = unPath[0: unPath.rfind(os.sep)]
    newname = file[0:file.rfind('.')] + '.py'
    command = "python -u " + unPath + "\scripts\uncompyle2 " + file + ">" + newname
    try:
        os.system(command)
    except :
        print
        file


if __name__ == '__main__':
    # print unPath
    print("init")
    displayFile('D:\\hh.pyc')
    print("finished")

反编译出来的源代码为:

import string
base64_charset = string.ascii_uppercase + string.ascii_lowercase + string.digits + '+/'
a1 = 'A12345678'
a2 = ''
a3 = ''
n1 = len(a1) % 3
n2 = len(a1) // 3
for i in range(1, n1):
    a1 += '\x00'

# WARNING: Decompyle incomplete
import string
base64_charset = string.ascii_uppercase + string.ascii_lowercase + string.digits + '+/'
a1 = 'A12345678'
a2 = ''
a3 = ''
n1 = len(a1) % 3
n2 = len(a1) // 3
for i in range(1, n1):
    a1 += '\x00'
  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值