function hook_toHexString(){ Java.perform(function(){ var MainActivity=Java.use("com.example.crackme.MainActivity"); MainActivity.toHexString.implementation=function(arg1,arg2){ var result = this.toHexString(arg1, arg2); console.log(result); return result; } }) } function main(){ hook_toHexString(); } setImmediate(main) //com.example.crackme //frida -U -f com.example.crackme --no-pause -l gctf.js //b9c77224ff234f27ac6badf83b855c76 //bc72f242a6af3857 //flag{bc72f242a6af3857}
/**** * public class HelloWorld { public static void main(String []args) { System.out.println("Hello World!"); System.out.println("b9c77224ff234f27ac6badf83b855c76".toString()); String hexstr ="b9c77224ff234f27ac6badf83b855c76"; StringBuilder sb = new StringBuilder(); for (int i = 0; i < hexstr.length(); i += 2) { sb.append(hexstr.charAt(i)); } System.out.println(sb.toString()); } }
public class HelloWorld { public static void main(String []args) { String hexstr ="b9c77224ff234f27ac6badf83b855c76"; StringBuilder sb = new StringBuilder(); for (int i = 0; i < hexstr.length(); i += 2) { sb.append(hexstr.charAt(i)); } System.out.println(sb.toString()); } } //bc72f242a6af3857
#!/usr/bin/python print("Hello, World!"); import time coretu = [23,22,26,26,25,25,25,26,27,28,30,30,29,30,32,32] print('XMAN{',end='') for indexnum,i in enumerate(coretu): keynum =33 while 1: nowb = (keynum+i)%61 sss = chr(abs(((nowb*2)-indexnum))) #time.sleep(0.1) #print chr(keynum) if sss == chr(keynum%128): print(sss,end='') break else: keynum+=1 print('}',end='')
a = [23, 22, 26, 26, 25, 25, 25, 26, 27, 28, 30, 30, 29, 30, 32, 32] key = '' for m in range(16): for i in range(128): k = i k = (k + a[m]) % 61 k = k * 2 - m if k == i: print(f"[*]第{m+1}位是{k}") key = key + chr(k) break print("XMAN{" + key + "}") k == ((k + a[m]) % 61)*2-m
最后的结果XMAN{LOHILMNMLKHILKHI}
HelloSmali2
1 2 3 4
解压后有个XMan.java HelloSmali2 (1) » ls XMan.java f45775643c-46846-5990-b3793-32e8ecd15f0d.smali