1. 程式人生 > >Jarvis OJ-Reverse題目Writeup

Jarvis OJ-Reverse題目Writeup

打開 findview android 輸出 color content 來看 好的 我們

做一道更一道吧233333

DD-Android Easy

下載apk,先安裝一下試試吧……

技術分享圖片

猜測是輸入正確的內容後給flag吧

將後綴改成zip,解壓,用dex2jar處理classes.dex,然後用jd-gui打開,可以看到,該apk中只有一個FlagActivity,一部分一部分來看

protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130968602);
    this.n = ((TextView)findViewById(2131427413));
    
this.o = ((TextView)findViewById(2131427415)); }

onCreate()等同於什麽都沒做

public void onClickTest(View paramView)
  {
    if (this.n.getText().toString().equals(i()))
    {
      this.o.setText(2131099685);
      return;
    }
    this.o.setText(2131099683);
  }

onClickTest()函數的功能非常簡單:n指代的應該是輸入框 ,o指代的應該是結果提示框,那麽這個函數做的事情就是把輸入的內容和i()函數的返回值比對,那大概是一樣才行吧

所以最後我們來看這個i()函數

private static final byte[] p = { -40, -62, 107, 66, -126, 103, -56, 77, 122, -107, -24, -127, 72, -63, -98, 64, -24, -5, -49, -26, 79, -70, -26, -81, 120, 25, 111, -100, -23, -9, 122, -35, 66, -50, -116, 3, -72, 102, -45, -85, 0, 126, -34, 62, 83, -34, 48, -111, 61, -9, -51, 114, 20, 81, -126, -18, 27, -115, -76, -116, -48, -118, -10, -102, -106, 113, -104, 98, -109, 74, 48, 47, -100, -88, 121, 22, -63, -32, -20, -41, -27, -20, -118, 100, -76, 70, -49, -39, -27, -106, -13, -108, 115, -87, -1, -22, -53, 21, -100, 124, -95, -40, 62, -69, 29, 56, -53, 85, -48, 25, 37, -78, 11, -110, -24, -120, -82, 6, -94, -101 };
private static final byte[] q = { -57, -90, 53, -71, -117, 98, 62, 98, 101, -96, 36, 110, 77, -83, -121, 2, -48, 94, -106, -56, -49, -80, -1, 83, 75, 66, -44, 74, 2, -36, -42, -103, 6, -115, -40, 69, -107, 85, -78, -49, 54, 78, -26, 15, 98, -70, 8, -90, 94, -61, -84, 64, 112, 51, -29, -34, 126, -21, -126, -71, -31, -24, -60, -2, -81, 66, -84, 85, -91, 10, 84, 70, -8, -63, 26, 126, -76, -104, -123, -71, -126, -62, -23, 11, -39, 70, 14, 59, -101, -39, -124, 91, -109, 102, -49, 21, 105, 0, 37, -128, -57, 117, 110, -115, -86, 56, 25, -46, -55, 7, -125, 109, 76, 104, -15, 82, -53, 18, -28, -24 }; private String i() { int j = 0; byte[] arrayOfByte1 = new byte[p.length]; int i = 0; while (i < arrayOfByte1.length) { arrayOfByte1[i] = ((byte)(p[i] ^ q[i])); i += 1; } int k = arrayOfByte1[0]; i = 0; while (arrayOfByte1[(k + i)] != 0) i += 1; byte[] arrayOfByte2 = new byte[i]; while (j < i) { arrayOfByte2[j] = arrayOfByte1[(k + j)]; j += 1; } return new String(arrayOfByte2); }

可以看到這個函數不要輸入,且輸出結果固定…………好的果然是AndroidEasy…………寫個Java跑一下i()函數的結果就可以了…………

 1 public class DDCTF_EASY {
 2   private static final byte[] p = { -40, -62, 107, 66, -126, 103, -56, 77, 122, -107, -24, -127, 72, -63, -98, 64, -24, -5, -49, -26, 79, -70, -26, -81, 120, 25, 111, -100, -23, -9, 122, -35, 66, -50, -116, 3, -72, 102, -45, -85, 0, 126, -34, 62, 83, -34, 48, -111, 61, -9, -51, 114, 20, 81, -126, -18, 27, -115, -76, -116, -48, -118, -10, -102, -106, 113, -104, 98, -109, 74, 48, 47, -100, -88, 121, 22, -63, -32, -20, -41, -27, -20, -118, 100, -76, 70, -49, -39, -27, -106, -13, -108, 115, -87, -1, -22, -53, 21, -100, 124, -95, -40, 62, -69, 29, 56, -53, 85, -48, 25, 37, -78, 11, -110, -24, -120, -82, 6, -94, -101 };
 3   private static final byte[] q = { -57, -90, 53, -71, -117, 98, 62, 98, 101, -96, 36, 110, 77, -83, -121, 2, -48, 94, -106, -56, -49, -80, -1, 83, 75, 66, -44, 74, 2, -36, -42, -103, 6, -115, -40, 69, -107, 85, -78, -49, 54, 78, -26, 15, 98, -70, 8, -90, 94, -61, -84, 64, 112, 51, -29, -34, 126, -21, -126, -71, -31, -24, -60, -2, -81, 66, -84, 85, -91, 10, 84, 70, -8, -63, 26, 126, -76, -104, -123, -71, -126, -62, -23, 11, -39, 70, 14, 59, -101, -39, -124, 91, -109, 102, -49, 21, 105, 0, 37, -128, -57, 117, 110, -115, -86, 56, 25, -46, -55, 7, -125, 109, 76, 104, -15, 82, -53, 18, -28, -24 };
 4   
 5   private String i()
 6   {
 7     int j = 0;
 8     byte[] arrayOfByte1 = new byte[p.length];
 9     int i = 0;
10     while (i < arrayOfByte1.length)
11     {
12       arrayOfByte1[i] = ((byte)(p[i] ^ q[i]));
13       i += 1;
14     }
15     int k = arrayOfByte1[0];
16     i = 0;
17     while (arrayOfByte1[(k + i)] != 0)
18       i += 1;
19     byte[] arrayOfByte2 = new byte[i];
20     while (j < i)
21     {
22       arrayOfByte2[j] = arrayOfByte1[(k + j)];
23       j += 1;
24     }
25     return new String(arrayOfByte2);
26   }
27 
28 
29     public static void main(String args[]) {
30         DDCTF_EASY t = new DDCTF_EASY();
31         System.out.println(t.i());
32     }
33 }

輸出結果(即為本題flag):[email protected]

Jarvis OJ-Reverse題目Writeup