首页
社区
课程
招聘
[原创]第二题 变形金钢 python
发表于: 2019-3-13 17:19 6815

[原创]第二题 变形金钢 python

2019-3-13 17:19
6815

generedIDXary= [0xF0,0x37,0xE1,0x9B,0x2A,0x15,0x17,0x9F,0xD7,0x58,0x4D,0x6E,0x33,0xA0,0x39,0xAE,4,0xD0,0xBE,0xED,0xF8,0x66,0x5E,0,0xD6,0x91,0x2F,0xC3,0x10,0x4C,0xF7,0xA6,0xC1,0xEC,0x6D,0xB,0x50,0x65,0xBB,0x34,0xFA,0xA4,0x2D,0x3B,0x23,0xA1,0x96,0xD5,0x1D,0x38,0x56,0xA,0x5D,0x4F,0xE4,0xCC,0x24,0xD,0x12,0x87,0x35,0x85,0x8E,0x6F,0xC6,0x13,0x9A,0xD3,0xFC,0xE7,8,0xAC,0xB7,0xE9,0xB0,0xE8,0x41,0xAA,0x55,0x53,0xC2,0x42,0xBC,0xE6,0xF,0x8A,0x86,0xA8,0xCF,0x84,0xC5,0x48,0x74,0x36,7,0xEB,0x88,0x51,0xF6,0x7F,0x57,5,0x63,0x3E,0xFE,0xB8,0xC9,0xF5,0xAF,0xDF,0xEA,0x82,0x44,0xF9,0xCD,6,0xBA,0x30,0x47,0x40,0xDE,0xFD,0x1C,0x7C,0x11,0x5C,2,0x31,0x2C,0x9C,0x5F,0x46,0x27,0xC4,0x83,0x73,0x16,0x90,0x20,0x76,0x7B,0xF2,0xE3,0xF3,0x77,0x52,0x80,0x25,9,0x26,0x3F,0xC7,0x18,0x1B,0xA3,0xFF,0xFB,0xCB,0xA9,0x8C,0x54,0x7A,0x68,0xB4,0x70,0x4B,0xE2,0x49,0x22,0x7E,0xA5,0xB6,0x81,0x9D,0x4E,0x67,0xF1,0xA7,0x3C,0xD9,0x94,0xEF,0x32,0x6B,0x1F,0xB1,0x60,0xB9,0x64,0x59,1,0xB3,0x7D,0xE0,0x6C,0xAD,0x97,0x19,0xB5,0x3A,0xF4,0xD8,0x8D,0x98,3,0x93,0x1A,0xDC,0x1E,0x4A,0xC0,0x5A,0xE5,0xD1,0x3D,0x14,0xC8,0x79,0xBD,0x43,0xDB,0x69,0xD2,0x61,0x95,0x9E,0x21,0x45,0x89,0x2B,0xAB,0x29,0xA2,0x8B,0x2E,0xD4,0xE,0x62,0xCA,0x28,0xDA,0x5B,0x72,0x8F,0x99,0x75,0xEE,0x78,0xC,0x71,0xBF,0xDD,0xCE,0x92,0x6A,0xB2]
targat= " {9*8ga*l!Tn?@#fj'j$\\g;;"
pass_dic= [0 for x in range (0x80)]

for v,c  in enumerate("!:#$%&()+-*/`~_[]{}?<>,.@^abcdefghijklmnopqrstuvwxyz0123456789\\';"):
    pass_dic[v]= ord(c)

sourceLen = len ( targat)
tryBuf= [0 for x in range(25)]

source= ''


def nextChar(lastIDXary, lastCounter, lastTryBuf, lastSource, last0x33, lastV28, lastV30):
    bufIDXary= lastIDXary[:]
    bufTryBuf= lastTryBuf[:]
    #bufSource= lastSource[:]
    if ( (lastCounter+ last0x33) <  sourceLen):
        lastV28 = (lastV28 + 1) % 256
        v35 = bufIDXary[lastV28]
        lastV30 = (lastV30 + v35) % 256
        bufIDXary[lastV28] = bufIDXary[lastV30]
        bufIDXary[lastV30] = v35

        for x in range (33,128):
            v36 = (bufIDXary[(v35 + bufIDXary[lastV28])% 256] ^ x)% 256
            if (lastCounter % 3)!=0 :
                if  (lastCounter % 3)==1 :
                    bufTryBuf[last0x33 + lastCounter] = (pass_dic[(lastTryBuf[last0x33 + lastCounter] % 256) | (v36 >> 4)])

                    v27 = 4 * v36 & 0x3C
                    bufTryBuf[last0x33 + lastCounter+ 1] = v27
                    if ( (lastCounter+ last0x33+ 2 )>= sourceLen ):
                        bufTryBuf[last0x33 + lastCounter+ 2] = 0x34
                        bufTryBuf[last0x33 + lastCounter+ 1] = pass_dic[v27]
                elif (lastCounter %3) == 2 :
                    v17 = (v36 & 0xC0)
                    
                    bufTryBuf[last0x33 + lastCounter] = (pass_dic[(lastTryBuf[last0x33 + lastCounter]% 256) | (v17 >> 6)]) ^ 0xF
                    bufTryBuf[last0x33 + lastCounter+ 1] = (pass_dic[v36 & 0x3F])
            else:
                bufTryBuf[last0x33 + lastCounter] = (pass_dic[v36 >> 2]) ^ 7
                v27 = (16 * v36) & 0x30
                bufTryBuf[last0x33 + lastCounter+ 1] = v27

                if ( (lastCounter+ last0x33+ 2 )>= sourceLen ):
                    if pass_dic[v27]==ord(';'):
                        bufTryBuf[lastCounter+ last0x33+ 1] = pass_dic[v27]
                        bufTryBuf[lastCounter+ last0x33+ 2] = ord(';')
                        print ( lastSource+ chr (x))
                        return chr (x)
                    return None

            #judge 
            if bufTryBuf[lastCounter+ last0x33]==ord(targat[lastCounter+ last0x33]):
                if (lastCounter %3) == 2 :
                    if bufTryBuf[lastCounter+ last0x33+ 1]==ord(targat[lastCounter+ last0x33+ 1]):
                        nextStr=nextChar ( bufIDXary, lastCounter+ 1, bufTryBuf, lastSource+ chr(x), last0x33+1 , lastV28, lastV30)
                    else:
                        continue
                else:
                    nextStr=nextChar ( bufIDXary, lastCounter+ 1, bufTryBuf, lastSource+ chr(x), last0x33 , lastV28, lastV30)
                if None!= nextStr:
                    return lastSource+ nextStr
                #print (chr(x))
        ##
        return None

print ( nextChar (generedIDXary, 0,tryBuf, source, 0, 0, 0))
^
计算key的python


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

收藏
免费 1
支持
分享
最新回复 (1)
雪    币: 1114
活跃值: (1151)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
哇哇哇哇,IDAPython有没有相关笔记或者是文档啊,拿来膜一手,谢谢谢谢。
2019-4-1 19:35
0
游客
登录 | 注册 方可回帖
返回
//