text = 'killshadow' key = 'adsfkndcls' v3 = 0 v5 = 10 n = 0 flag = [0,0,0,0,0,0,0,0,0,0] for i inrange(0,10): for j inrange(0,10): v1=(ord(text[j])-97)+26*i+ord(key[v3%v5])-58 if(v1>65and v1<=90) or (v1>=97and v5<=122): flag[j]=chr(v1) n = n+1 if(n==10): print(flag) break v3=v3+1
flag{KLDQCUDFZO}
此题中数据转为16进制在内存中是小端顺序,所以高位在高地址,故顺序需要颠倒
大端顺序:高字节保存在内存的低地址
小端顺序:高字节保存在内存的高地址
如何记忆?
自大的人眼高手低 - 其中,自大代表大端序,眼高代表高地址,手低代表低字节
小端顺序则相反
Java逆向解密
jadx打开java文件,直接分析加密过程
是将输入的字符+‘@’再与32异或,直接写脚本
1 2 3 4 5 6
key = [180, 136, 137, 147, 191, 137, 147, 191, 148, 136, 133, 191, 134, 140, 129, 135, 191, 65] flag = '' for i in key: flag+=chr((i^32)-64) print(flag)
for ( i = 0; i <= 4; ++i ) { switch ( rand() % 200 ) { case1: puts("OK, it's flag:"); memset(&s, 0, 0x28uLL); strcat((char *)&s, f1); //f1 = 'GXY{do_not_' strcat((char *)&s, &f2); printf("%s", (constchar *)&s); break; case2: printf("Solar not like you"); break; case3: printf("Solar want a girlfriend"); break; case4: s = '\x7Ffo`guci'; v5 = 0; strcat(&f2, (constchar *)&s); break; case5: for ( j = 0; j <= 7; ++j ) { if ( j % 2 == 1 ) *(&f2 + j) -= 2; else --*(&f2 + j); } break; default: puts("emmm,you can't find flag 23333"); break;
case 1是将f1和f2合并输出flag
case 4 是f2和字符串s合并,前面说过小端顺序,s = ‘ icug‘of ’
case 5 是对f2进行一些运算
顺序应为case 4 > case 5 > case 1
写脚本
1 2 3 4 5 6 7 8 9
s = 'icug`of' str = list(s) flag = 'GXY{do_not_' for j inrange(len(str)): if j % 2 == 1: flag += chr(ord(str[j]) - 2) else: flag += chr(ord(str[j]) - 1) print(flag)