首页
社区
课程
招聘
[原创]Python写了个Crackme,欢迎来搞
发表于: 2013-1-27 09:34 14884

[原创]Python写了个Crackme,欢迎来搞

2013-1-27 09:34
14884

文件名称:Python_Crackme.exe
MD5: 8FA3E4631B05DFCF1A005B238E739C80
SHA1: FBC24E3FC105540B6875970DB30ABBFB9FC4493A
CRC32: 9B1B50AC

未注册:

注册成功:


附件下载:
Python_Crackme.part1.rar
Python_Crackme.part2.rar


[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

上传的附件:
收藏
免费 6
支持
分享
最新回复 (14)
雪    币: 74
活跃值: (748)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
支持一下,待会下来开搞
2013-1-27 11:10
0
雪    币: 3386
活跃值: (1413)
能力值: ( LV4,RANK:40 )
在线值:
发帖
回帖
粉丝
3
Python  不是解释性语言吗 怎么生成的exe
2013-1-27 11:48
0
雪    币: 6075
活跃值: (2236)
能力值: (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()
2013-1-27 13:02
0
雪    币: 107
活跃值: (419)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
我勒个去..发哥很难得露面啊...看到Python..果断浮出水面啊.....
2013-1-27 13:59
0
雪    币: 370
活跃值: (15)
能力值: ( LV9,RANK:170 )
在线值:
发帖
回帖
粉丝
6
great,动作快准狠
用到了哪些工具?
2013-1-27 16:06
0
雪    币: 327
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
啥意思  看不懂呢~~另外咋个生成的EXE~~~
2013-1-27 16:21
0
雪    币: 705
活跃值: (25)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
8
exe使用pyinstaller-2.0生成的,
看了下pyinstaller的源码,写了个提取工具.
需要用到Python2.7 和 uncompyle2库.
使用方法:
解压到crackme文件夹下,然后
python unpack.py
把所有文件都解压到output文件夹下

unpack_Python_Crackme.7z
上传的附件:
2013-1-27 16:41
0
雪    币: 98729
活跃值: (201034)
能力值: (RANK:10 )
在线值:
发帖
回帖
粉丝
9
忙吗,很长时间没见
2013-1-27 16:54
0
雪    币: 546
活跃值: (1707)
能力值: ( LV12,RANK:210 )
在线值:
发帖
回帖
粉丝
10
膜拜啊,没想到,我的源码都搞出来了 ?
2013-1-27 17:19
0
雪    币: 546
活跃值: (1707)
能力值: ( LV12,RANK:210 )
在线值:
发帖
回帖
粉丝
11
学习了
2013-1-27 17:24
0
雪    币: 546
活跃值: (1707)
能力值: ( LV12,RANK:210 )
在线值:
发帖
回帖
粉丝
12
答案如8楼所说,用了一个打包程序而已。
2013-1-27 21:42
0
雪    币: 3386
活跃值: (1413)
能力值: ( LV4,RANK:40 )
在线值:
发帖
回帖
粉丝
13
懂得了,学习了!
2013-1-28 09:12
0
雪    币: 239
活跃值: (62)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
14
Mark一下,多谢分享!
2013-4-11 20:37
0
雪    币: 19
活跃值: (25)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
15
厉害啊… 学习了
2013-6-25 21:16
0
游客
登录 | 注册 方可回帖
返回
//