能力值:
( LV2,RANK:10 )
|
-
-
2 楼
支持一下,待会下来开搞
|
能力值:
( LV4,RANK:40 )
|
-
-
3 楼
Python 不是解释性语言吗 怎么生成的exe
|
能力值:
(RANK:1060 )
|
-
-
4 楼
import os, sys, base64
import string, wmi, hashlib
import struct
import binascii
from binascii import unhexlify as unhex
from binascii import hexlify as dohex
class CryptModule:
"""docstring for CryptModule"""
def __init__(self):
self.xorkey = 88
self.tablekey = '5211314'
def xor_set_key(self, key):
"""
设置xor密钥
"""
if key == None:
pass
elif isinstance(key, int) == False:
print 'key must be type int [0-255]'
else:
self.xorkey = int(key)
def xor_encrypt(self, s):
key = int(self.xorkey)
b = bytearray(str(s))
n = len(b)
c = bytearray(n * 2)
j = 0
for i in range(0, n):
b1 = b[i]
b2 = b1 ^ key
c1 = b2 % 16
c2 = b2 // 16
c1 = c1 + 65
c2 = c2 + 65
c[j] = c1
c[j + 1] = c2
j = j + 2
return c
def xor_decrypt(self, s):
key = int(self.xorkey)
c = bytearray(str(s))
n = len(c)
if n % 2 != 0:
return ''
n = n // 2
b = bytearray(n)
j = 0
for i in range(0, n):
c1 = c[j]
c2 = c[j + 1]
j = j + 2
c1 = c1 - 65
c2 = c2 - 65
b2 = c2 * 16 + c1
b1 = b2 ^ key
b[i] = b1
try:
return b
except:
return ''
def table_set_key(self, key):
if key == None:
pass
else:
self.tablekey = key
def get_table(self):
m = hashlib.md5()
m.update(self.tablekey)
s = m.digest()
a, b = struct.unpack('<QQ', s)
table = [ c for c in string.maketrans('', '') ]
for i in xrange(1, 1024):
table.sort(lambda x, y: int(a % (ord(x) + i) - a % (ord(y) + i)))
return table
def table_Encrypt(self, key, data):
self.table_set_key(key)
encrypt_table = ''.join(self.get_table())
endata = data.translate(encrypt_table)
endata = dohex(endata)
new_data = self.xor_encrypt(endata)
return base64.encodestring(new_data)
def table_Decrypt(self, key, data):
self.table_set_key(key)
data = base64.decodestring(data)
xordecrypt = self.xor_decrypt(data)
xordecrypt = unhex(xordecrypt)
encrypt_table = ''.join(self.get_table())
decrypt_table = string.maketrans(encrypt_table, string.maketrans('', ''))
return xordecrypt.translate(decrypt_table)
class EncryptHardinfo:
def __init__(self):
self.hardinfo = ''
def get_hardwareid(self):
ret = ''
try:
w = wmi.WMI()
cpus = w.Win32_Processor()
for u in cpus:
cpuid = str(u.ProcessorId)
ret = cpuid
indate = w.Win32_OperatingSystem()
for ln in indate:
ret += str(ln.InstallDate)
ret += str(ln.SerialNumber)
comsys = w.Win32_ComputerSystem()
for cs in comsys:
ret += str(cs.Model)
self.hardinfo = ret
except Exception as e:
print 'get_hardwareid Error! %s ...' % str(e)
os.system('pause')
sys.exit(0)
return 0
return ret
def md5hex(self, word):
""" MD5加密算法,返回32位小写16进制符号 """
if isinstance(word, unicode):
word = word.encode('utf-8')
elif not isinstance(word, str):
word = str(word)
m = hashlib.md5()
m.update(word)
return m.hexdigest()
def get_HardinfoFile(self):
if self.hardinfo == '':
self.get_hardwareid()
hmd5 = self.md5hex(self.hardinfo)
hmd5 += self.hardinfo
try:
cm = CryptModule()
cm.xor_set_key(11)
ret = cm.table_Encrypt('godblessyou2013', hmd5)
file = open(os.getcwd() + '\\HardInfo.tMp', 'w')
file.write(ret)
file.close()
except Exception as e:
print '获取硬件信息出错了,请手动删除 HardInfo.tMp 文件'
os.system('pause')
os.exit(0)
def CheckRegister(self, withinfo):
if os.path.exists(os.getcwd() + '\\Register.key') == 0:
return 0
regfile = open(os.getcwd() + '\\Register.key', 'rb')
list_of_all_the_lines = ''
data = ''
try:
list_of_all_the_lines = regfile.readlines()
filestr = ''.join(list_of_all_the_lines)
cm = CryptModule()
cm.xor_set_key(111)
data = cm.table_Decrypt('fuck1you2013', filestr)
except Exception as e:
print '未注册版本或 Register.key 文件损坏。'
print '\t未注册版本或 Register.key 文件损坏。'
print '\t\t未注册版本或 Register.key 文件损坏。'
regfile.close()
return -3
finally:
if regfile == None:
return -10
regfile.close()
self.get_hardwareid()
hmd5 = self.md5hex(self.hardinfo)
hmd5 += self.hardinfo
if len(data) - len(withinfo) != len(hmd5):
print "what's the fuck"
return -4
if withinfo != data[len(hmd5):]:
print "what's the fuck"
return -5
if data[:len(hmd5)] == hmd5:
return 1
return 2
if __name__ == '__main__':
eh = EncryptHardinfo()
|
能力值:
( LV2,RANK:10 )
|
-
-
5 楼
我勒个去..发哥很难得露面啊...看到Python..果断浮出水面啊.....
|
能力值:
( LV9,RANK:170 )
|
-
-
6 楼
great,动作快准狠
用到了哪些工具?
|
能力值:
( LV2,RANK:10 )
|
-
-
7 楼
啥意思 看不懂呢~~另外咋个生成的EXE~~~
|
能力值:
( LV3,RANK:20 )
|
-
-
8 楼
exe使用pyinstaller-2.0生成的,
看了下pyinstaller的源码,写了个提取工具.
需要用到Python2.7 和 uncompyle2库.
使用方法:
解压到crackme文件夹下,然后
python unpack.py
把所有文件都解压到output文件夹下
unpack_Python_Crackme.7z
|
能力值:
(RANK:10 )
|
-
-
9 楼
忙吗,很长时间没见
|
能力值:
( LV12,RANK:210 )
|
-
-
10 楼
膜拜啊,没想到,我的源码都搞出来了 ?
|
能力值:
( LV12,RANK:210 )
|
-
-
11 楼
学习了
|
能力值:
( LV12,RANK:210 )
|
-
-
12 楼
答案如8楼所说,用了一个打包程序而已。
|
能力值:
( LV4,RANK:40 )
|
-
-
13 楼
懂得了,学习了!
|
能力值:
( LV2,RANK:10 )
|
-
-
14 楼
Mark一下,多谢分享!
|
能力值:
( LV2,RANK:10 )
|
-
-
15 楼
厉害啊… 学习了
|
|
|