最近Google上不了很是痛苦,只能一直开着goagent,夏日laptop发热严重,开linux会自动关机。命途多舛。
今天在做逆向时候,源码里面对一个byte[]进行编码成为一串字符串QjI4REM3NTdGQjUxMDk5NTJBMEFBOTMzQzMzMkE2RDM=
.class逆向代码
1 if (arrayOfByte == null) 2 { 3 LogUtil.e(this.TAG, "create signature failed."); 4 return null; 5 } 6 StringBuffer localStringBuffer = new StringBuffer(""); 7 for (int i = 0; i < arrayOfByte.length; i++) 8 { 9 int j = arrayOfByte[i]; 10 if (j < 0) 11 j += 256; 12 if (j < 16) 13 localStringBuffer.append("0"); 14 localStringBuffer.append(Integer.toHexString(j)); 15 } 16 return IdentifyApp.base64encode(localStringBuffer.toString().toUpperCase().getBytes()); 17 }
求byte[]和decode
1 BASE64Decoder decoder = new BASE64Decoder(); 2 byte[] decodedbytes = decoder.decodeBuffer(str); 3 for(int i = 0;i<decodedbytes.length;i++) System.out.print(" "+decodedbytes[i]); 4 System.out.println(); 5 System.out.println(new String(decodedbytes));
byte[]>>> 66 50 56 68 67 55 53 55 70 66 53 49 48 57 57 53 50 65 48 65 65 57 51 51 67 51 51 50 65 54 68 51
string>>>B28DC757FB5109952A0AA933C332A6D3
求原数组
1 package hextooct; 2 3 import java.util.ArrayList; 4 5 public class Transfer { 6 public static void main(String[] args) 7 { 8 String str = "B28DC757FB5109952A0AA933C332A6D3"; 9 char[] c = str.toCharArray(); 10 ArrayList<Integer> al = new ArrayList<Integer>(); 11 for(int i = 0; i < c.length; i++) 12 { 13 String s = String.valueOf(c[i]); 14 if(c[i]==‘0‘) continue; 15 if(c[i]>9){ 16 System.out.print(Integer.parseInt(s, 16)); 17 al.add(Integer.parseInt(s,16)); 18 } 19 else {System.out.print(c[i]); al.add(Integer.parseInt(s));} 20 System.out.print(" "); 21 22 } 23 System.out.println(); 24 System.out.println(al.toString()); 25 26 } 27 28 }
跟踪源码:
public static byte[] md5digest(String paramString) { monitorenter; try { byte[] arrayOfByte2 = MarkManager.base64decode(MMClientSDK_ForPhone.md5Algorithm(paramString)); arrayOfByte1 = arrayOfByte2; return arrayOfByte1; } catch (Exception localException) { while (true) { LogUtil.w("IdentifyApp", "base64 decrypt license file failure"); byte[] arrayOfByte1 = null; } }
解出来string
package com.crack; import java.io.IOException; import java.lang.String; import Decoder.BASE64Decoder; import Decoder.BASE64Encoder;; public class Crack { public static void main(String[] args) throws IOException { byte[] arr = {11, 2, 8, 13, 12, 7, 5, 7, 15, 11, 5, 1, 9, 9, 5, 2, 10, 10, 10, 9, 3, 3, 12, 3, 3, 2, 10, 6, 13, 3}; BASE64Encoder baseencoder = new BASE64Encoder(); String result = baseencoder.encode(arr); System.out.println(result); String str="CwIIDQwHBQcPCwUBCQkFAgoKCgkDAwwDAwIKBg0D"; BASE64Decoder decoder = new BASE64Decoder(); byte[] decodedbytes = decoder.decodeBuffer(str); for(int i = 0;i<decodedbytes.length;i++) System.out.print(" "+decodedbytes[i]); System.out.println(); } }
CwIIDQwHBQcPCwUBCQkFAgoKCgkDAwwDAwIKBg0D 11 2 8 13 12 7 5 7 15 11 5 1 9 9 5 2 10 10 10 9 3 3 12 3 3 2 10 6 13 3
关于getBytes()
时间: 2024-10-24 16:14:47