吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 15700|回复: 40
收起左侧

[原创] 简单的python逆向分析

  [复制链接]
52lxw 发表于 2018-3-30 23:23
拿到一个findkey.txt文件,但不上纯文本的,于是放进010 editor里面看


findkey.txt (2.6 KB, 下载次数: 59)
看到是03 F3 0D 0A开头,可以确定是python的可执行文件

改后缀名为findkey.pyc放到https://tool.lu/pyc/里反编译:
[Python] 纯文本查看 复制代码
#!/usr/bin/env python
# visit http://tool.lu/pyc/ for more information
import sys
lookup = [196,153,149,206,17,221,10,217,167,18,36,135,103,61,111,31,92,152,21,228,105,191,173,41,2,245,23,144,1,246,89,178,182,119,38,85,48,226,165,241,166,214,71,90,151,3,109,169,150,224,69,156,158,57,181,29,200,37,51,252,227,93,65,82,66,80,170,77,49,177,81,94,202,107,25,73,148,98,129,231,212,14,84,121,174,171,64,180,233,74,140,242,75,104,253,44,39,87,86,27,68,22,55,76,35,248,96,5,56,20,161,213,238,220,72,100,247,8,63,249,145,243,155,222,12,32,43,186,0,102,216,126,15,42,115,138,240,147,229,204,117,223,141,159,131,232,124,254,60,116,46,113,79,16,128,6,251,40,205,137,199,83,54,188,19,
    184,
    201,
    110,
    255,
    26,
    91,
    211,
    132,
    160,
    168,
    154,
    185,
    183,
    244,
    78,
    33,
    123,
    28,
    59,
    12,
    210,
    218,
    47,
    163,
    215,
    209,
    108,
    235,
    237,
    118,
    101,
    24,
    234,
    106,
    143,
    88,
    9,
    136,
    95,
    30,
    193,
    176,
    225,
    198,
    197,
    194,
    239,
    134,
    162,
    192,
    11,
    70,
    58,
    187,
    50,
    67,
    236,
    230,
    13,
    99,
    190,
    208,
    207,
    7,
    53,
    219,
    203,
    62,
    114,
    127,
    125,
    164,
    179,
    175,
    112,
    172,
    250,
    133,
    130,
    52,
    189,
    97,
    146,
    34,
    157,
    120,
    195,
    45,
    4,
    142,
    139]
pwda = [
    188,
    155,
    11,
    58,
    251,
    208,
    204,
    202,
    150,
    120,
    206,
    237,
    114,
    92,
    126,
    6,
    42]
pwdb = [
    53,
    222,
    230,
    35,
    67,
    248,
    226,
    216,
    17,
    209,
    32,
    2,
    181,
    200,
    171,
    60,
    108]
flag = raw_input('Input your Key:').strip()
if len(flag) != 17:
    print 'Wrong Key!!'
    sys.exit(1)
flag = flag[::-1]
for i in range(0, len(flag)):
    if ord(flag[i]) + pwda[i] & 255 != lookup[i + pwdb[i]]:
        print 'Wrong Key!!'
        sys.exit(1)

print 'Congratulations!!'


看到flag必须为17位了,得到以下破解脚本:
[Python] 纯文本查看 复制代码
#!/usr/bin/env python
# visit http://tool.lu/pyc/ for more information
import sys,string
lookup = [
    196,
    153,
    149,
    206,
    17,
    221,
    10,
    217,
    167,
    18,
    36,
    135,
    103,
    61,
    111,
    31,
    92,
    152,
    21,
    228,
    105,
    191,
    173,
    41,
    2,
    245,
    23,
    144,
    1,
    246,
    89,
    178,
    182,
    119,
    38,
    85,
    48,
    226,
    165,
    241,
    166,
    214,
    71,
    90,
    151,
    3,
    109,
    169,
    150,
    224,
    69,
    156,
    158,
    57,
    181,
    29,
    200,
    37,
    51,
    252,
    227,
    93,
    65,
    82,
    66,
    80,
    170,
    77,
    49,
    177,
    81,
    94,
    202,
    107,
    25,
    73,
    148,
    98,
    129,
    231,
    212,
    14,
    84,
    121,
    174,
    171,
    64,
    180,
    233,
    74,
    140,
    242,
    75,
    104,
    253,
    44,
    39,
    87,
    86,
    27,
    68,
    22,
    55,
    76,
    35,
    248,
    96,
    5,
    56,
    20,
    161,
    213,
    238,
    220,
    72,
    100,
    247,
    8,
    63,
    249,
    145,
    243,
    155,
    222,
    122,
    32,
    43,
    186,
    0,
    102,
    216,
    126,
    15,
    42,
    115,
    138,
    240,
    147,
    229,
    204,
    117,
    223,
    141,
    159,
    131,
    232,
    124,
    254,
    60,
    116,
    46,
    113,
    79,
    16,
    128,
    6,
    251,
    40,
    205,
    137,
    199,
    83,
    54,
    188,
    19,
    184,
    201,
    110,
    255,
    26,
    91,
    211,
    132,
    160,
    168,
    154,
    185,
    183,
    244,
    78,
    33,
    123,
    28,
    59,
    12,
    210,
    218,
    47,
    163,
    215,
    209,
    108,
    235,
    237,
    118,
    101,
    24,
    234,
    106,
    143,
    88,
    9,
    136,
    95,
    30,
    193,
    176,
    225,
    198,
    197,
    194,
    239,
    134,
    162,
    192,
    11,
    70,
    58,
    187,
    50,
    67,
    236,
    230,
    13,
    99,
    190,
    208,
    207,
    7,
    53,
    219,
    203,
    62,
    114,
    127,
    125,
    164,
    179,
    175,
    112,
    172,
    250,
    133,
    130,
    52,
    189,
    97,
    146,
    34,
    157,
    120,
    195,
    45,
    4,
    142,
    139]
pwda = [
    188,
    155,
    11,
    58,
    251,
    208,
    204,
    202,
    150,
    120,
    206,
    237,
    114,
    92,
    126,
    6,
    42]
pwdb = [
    53,
    222,
    230,
    35,
    67,
    248,
    226,
    216,
    17,
    209,
    32,
    2,
    181,
    200,
    171,
    60,
    108]
'''
flag = raw_input('Input your Key:').strip()
if len(flag) != 17:
    print 'Wrong Key!!'
    sys.exit(1)
flag = flag[::-1]
'''
result = []
for i in range(17):
    for flag in string.printable:
        if ord(flag) + pwda[i] & 255 == lookup[i + pwdb[i]]:
            result.append(flag)
            break
result.reverse()
print len(result),''.join(result)
print 'Congratulations!!'

C14`K_%CV4%}@QN{U3C]ICT.png

免费评分

参与人数 15威望 +1 吾爱币 +23 热心值 +15 收起 理由
TSF + 1 + 1 用心讨论,共获提升!
Hmily + 1 + 10 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
基哥你就好啦 + 1 + 1 鼓励转贴优秀软件安全工具和文档!
lhx5262619 + 1 + 1 热心回复!
九门提督定风波 + 1 + 1 谢谢@Thanks!
龙骑666 + 1 + 1 谢谢@Thanks!
CcCody + 1 + 1 用心讨论,共获提升!
jamesmeng + 1 用心讨论,共获提升!
sunnylds7 + 1 + 1 用心讨论,共获提升!
the-one + 1 + 1 用心讨论,共获提升!
liphily + 2 + 1 我很赞同!
cz226 + 1 + 1 谢谢@Thanks!
a5606495 + 1 + 1 热心回复!
审判者压缩 + 1 + 1 热心回复!
纸条 + 1 用心讨论,共获提升!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

jhsunnyshine 发表于 2018-3-31 00:27 来自手机
强啊懒猪
hcl909 发表于 2018-3-31 11:49
本以为pyhtone 编译好了 基本上很难破解了 没有想到和当年的VB一样 稍稍复杂了点,不过也是楼主比较厉害
ss8651twtw 发表于 2018-3-31 00:18
丑到变态 发表于 2018-3-31 06:10
感谢分享
chen4321 发表于 2018-3-31 07:53 来自手机
666,很给力
kernel 发表于 2018-3-31 08:34
不是很明白。。。。
Heln 发表于 2018-3-31 09:06
学习了,赞
sitiger 发表于 2018-3-31 09:39
赞一个,不错不错
Caesar93 发表于 2018-3-31 09:39
逆向出直接有加密算法
sh1ner 发表于 2018-3-31 10:49
666学习了
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-16 16:34

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表