-
-
[原创] KCTF 2019 Q2 第六题 XBase64
-
发表于: 2019-6-24 21:04 4691
-
改版的base64



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | b64str = 'tuvwxTUlmnopqrs7YZabcdefghij8yz0123456VWXkABCDEFGHIJKLMNOPQRS9+/' ', ' .join([ "'{}'" . format (c) for c in b64str]) a = [] for i in range ( 0 , 0x100 ): if chr (i) in b64str: a.append(b64str.index( chr (i))) else : a.append( 0xFF ) def charEncrypt(i): global b64str icv = c_ubyte( ord (b64str[i])).value if (icv > 0x40 ) and (icv < = 0x5A ): return chr (c_ubyte( 0x9B - icv).value) elif (icv > 0x60 ) and (icv < = 0x7A ): return chr (c_ubyte(icv - 0x40 ).value) elif (icv > 0x2F ) and (icv < = 0x39 ): return chr (c_ubyte(icv + 0x32 ).value) elif icv = = 0x2B : return chr (c_ubyte( 0x77 ).value) elif icv = = 0x2F : return chr (c_ubyte( 0x79 ).value) else : return chr (c_ubyte(icv).value) dicv = [] for i in range ( 0 ,b64str.__len__()): v = charEncrypt(i) if v not in dicv: dicv.append(v) else : raise Exception("") ' '.join(b64str[dicv.index(c)] if c!=' = ' else ' = ' for c in "!NGV%,$h1f4S3%2P(hkQ94==" ) "aMTEeld6q4tHserKh69Jyt==" |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | b64str = 'tuvwxTUlmnopqrs7YZabcdefghij8yz0123456VWXkABCDEFGHIJKLMNOPQRS9+/' ', ' .join([ "'{}'" . format (c) for c in b64str]) a = [] for i in range ( 0 , 0x100 ): if chr (i) in b64str: a.append(b64str.index( chr (i))) else : a.append( 0xFF ) def charEncrypt(i): global b64str icv = c_ubyte( ord (b64str[i])).value if (icv > 0x40 ) and (icv < = 0x5A ): return chr (c_ubyte( 0x9B - icv).value) elif (icv > 0x60 ) and (icv < = 0x7A ): return chr (c_ubyte(icv - 0x40 ).value) elif (icv > 0x2F ) and (icv < = 0x39 ): return chr (c_ubyte(icv + 0x32 ).value) elif icv = = 0x2B : return chr (c_ubyte( 0x77 ).value) elif icv = = 0x2F : return chr (c_ubyte( 0x79 ).value) else : return chr (c_ubyte(icv).value) dicv = [] for i in range ( 0 ,b64str.__len__()): v = charEncrypt(i) if v not in dicv: dicv.append(v) else : raise Exception("") ' '.join(b64str[dicv.index(c)] if c!=' = ' else ' = ' for c in "!NGV%,$h1f4S3%2P(hkQ94==" ) "aMTEeld6q4tHserKh69Jyt==" |
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
最后于 2019-6-26 09:33
被HHHso编辑
,原因:
赞赏
他的文章
谁下载
无
赞赏
雪币:
留言: