下载下来是没有后缀名的文件,用斯托夫文件分析器查一下的出结果是pyo文件直接把后缀名改成了.pyc它就能运行。接下来就是反编译pyo文件了。
安装uncompyle
pip install uncompyle
可以写上pip的绝对路径。
C:\Users\liu>pip install uncompyle
Collecting uncompyleDownloading uncompyle-2.0.0-py2.py3-none-any.whl
Collecting uncompyle6 (from uncompyle)Downloading uncompyle6-3.1.1-py36-none-any.whl (198kB)100% |████████████████████████████████| 204kB 488kB/s
Collecting xdis<3.8.0,>=3.7.0 (from uncompyle6->uncompyle)Downloading xdis-3.7.0-py36-none-any.whl (84kB)100% |████████████████████████████████| 92kB 1.6MB/s
Collecting spark-parser<1.9.0,>=1.8.5 (from uncompyle6->uncompyle)Downloading spark_parser-1.8.5-py36-none-any.whl
Collecting six (from uncompyle6->uncompyle)Downloading six-1.11.0-py2.py3-none-any.whl
Collecting click (from spark-parser<1.9.0,>=1.8.5->uncompyle6->uncompyle)Downloading click-6.7-py2.py3-none-any.whl (71kB)100% |████████████████████████████████| 71kB 1.1MB/s
Installing collected packages: xdis, click, spark-parser, six, uncompyle6, uncompyle
Successfully installed click-6.7 six-1.11.0 spark-parser-1.8.5 uncompyle-2.0.0 uncompyle6-3.1.1 xdis-3.7.0
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
安装完成。
安装的是uncompyle6
如果没有pip https://www.cnblogs.com/liuzhen1995/p/8092996.html#a2。
uncompyle6 models.pyc > models.py 将models.pyc反编译成py文件
这里是反编译结果
# uncompyle6 version 3.1.1
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: findkey
# Compiled at: 2016-04-30 17:54:18
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, 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]
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!!'
# okay decompiling C:\Users\liu\Desktop\findkey.31a509f4006ba41368dcf963762388bb.pyc
过程很简单了。
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=""
for i in range(0, 17):flag+=chr(lookup[i + pwdb[i]]-pwda[i] & 255)
flag=flag[::-1]
print flag
总结:pyc文件反编译用uncompyle来反编译
str[::-1]可以逆序