本帖最后由 xqyqx 于 2023-1-14 21:25 编辑
直接用pyinstxtractor解包,得到crackme.pyc,用uncompyle6反编译:
[Python] 纯文本查看 复制代码 import sys as a, requests as c
import os.path as d
try:
with open(d.join(d.dirname(d.abspath(__file__)), 'resoUrces.dlL'), 'rb') as (f):
j = f.read()
i = b''
h = 0
for g in j:
if h:
i += bytes([g])
else:
if g == 36:
h = 1
_ = [eval(f'"{__}"') for __ in i.decode('utf-8').strip().split('\r\n')]
input = eval(bytes((112, 114, 105, 110, 116)).decode('utf-8'))
except:
raise
print('Failed to load program resources.')
a.exit(1)
else:
input(_[0])
def __import__(*args, **kwargs):
raise OSError(_[1])
try:
if len(a.argv) != 2:
input(_[2])
a.exit(1)
else:
passwd = a.argv[1]
del a
input(_[3] + passwd)
____ = _[4]
__ = 0
c.packages.urllib3.disable_warnings()
def ___(n):
global __
if eval(c.get((____ + f"/{n}.txt"), verify=False).text):
input(f"#{n} " + _[5])
__ += 2 ** n
___(0)
___(1)
___(2)
___(3)
if __ - 16 == -1:
__ += 1
if __ == 16:
input(_[6])
else:
input(_[7])
except Exception:
input(_[8])
可知关键字符串在resource.dll里,且当读取到0x24使用UTF-8解码(论坛自动把网址加上discuz代码了,源文件没有这个代码):
[Asm] 纯文本查看 复制代码 HEX:
E7BD91E7BB9CE9AA8CE8AF8120437261636B4D655C6E202020204279206C756C69756368656E675C6EE4B88DE698AFE6AF8FE4B880E68A8AE99481E983BDE883BDE794A8E992A5E58C99E68993E5BC80E380822D2D3F3F3F3F3F3F3F3F5C6E0D0A596F752063616E277420696D706F72742061206D6F64756C652062656361757365206F66207468652073656375726974792070726F626C656D0D0AE8BE93E585A5E6A0BCE5BC8FE99499E8AFAFEFBC810D0AE4BDA0E8BE93E585A5E79A84E5AF86E7A081EFBC9A0D0A68747470733A2F2F706561736F66742E6769746875622E696F2F646C2F637261636B6D65310D0AE6A380E6B58BE9809AE8BF870D0AE5AF86E7A081E6ADA3E7A1AEEFBC810D0AE5AF86E7A081E99499E8AFAFEFBC810D0AE7A88BE5BA8FE9AA8CE8AF81E587BAE99499EFBC8CE8AFB7E9878DE8AF95EFBC810D0A
UTF-8:
网络验证 CrackMe\n By luliucheng\n不是每一把锁都能用钥匙打开。--????????\n
You can't import a module because of the security problem
输入格式错误!
你输入的密码:
[url]https://peasoft.github.io/dl/crackme1[/url]
检测通过
密码正确!
密码错误!
程序验证出错,请重试!
可知关键在https://peasoft.github.io/dl/crackme1,继续分析源码,input函数其实就是print函数,判断的关键语句就是在这个网址的4个txt里,密码需要满足:
[Python] 纯文本查看 复制代码 passwd[-4:] == "52pj"
len(passwd) == 20080313
hash(passwd) == 1145141919810
f"{passwd}" == "{passwd}"
这样的密码显然不存在,那么直接本地建4个txt,内容都是True,然后修改resource中的网址为localhost就行了 |