CTF came(android 版)

來源:互聯網
上載者:User

標籤:sys   ==   數組   for   技術分享   out   cep   type   com   

放到模擬器上運行是一個驗證框

用工具反編譯看看 有一個檢查函數

找在那個函數


大概知道演算法
1.它先去擷取 key
2.然建立一個數組
3.然後計算
要注意的是它有倆個 getkey()函數

看看反編譯的源碼發現讀不通其中就有:

可能是工具的問題 換個就清析了

找到關鍵點 他是把密碼一個個字元計算

if ((iArr[i] & 255) != ((str.charAt(i) ^ str2.charAt(i % str2.length())) & 255)) {//                throw new RuntimeException();//            }

那好辦我就暴力求解(當前類中的key 是錯的)

key :   bobdylan密碼:blow,in the winD


源碼

public class allen {    //正確 key    public static  String getKey() {        return "bobdylan";    }    public static void  main(String[] args){        check("allen");       // System.out.println("allenboy");    }    public static void check(String str) {        int i = 0;        if (str.length() != 16) {            //throw new RuntimeException();        }        String str2 = "";        try {            str2 = getKey();        } catch (Exception e) {            System.out.println("allenboy");            str2 = getKey();            System.arraycopy(str2, 0, str, 5, 5);        }        int[] iArr = new int[16];        iArr[0] = 0;        iArr[12] = 14;        iArr[10] = 7;        iArr[14] = 15;        iArr[15] = 42;        try {            iArr[1] = 3;            iArr[5] = 5;            System.out.println();        } catch (Exception e2) {            iArr[5] = 37;            iArr[1] = 85;        }        iArr[6] = 15;        iArr[2] = 13;        iArr[3] = 19;        iArr[11] = 68;        iArr[4] = 85;        iArr[13] = 5;        iArr[9] = 7;        iArr[7] = 78;        iArr[8] = 22;        System.out.println(str2);        while (i < 16) {  //str為參數     str2為 key            for(int j=0;j<128;j++){                char c=(char)j;                if ((iArr[i] & 255) == ((c^ str2.charAt(i % str2.length())) & 255)) {                   System.out.print(c);                }            }            i++;        }    }}//    public void check(String str) {//        int i = 0;//        if (str.length() != 16) {//            throw new RuntimeException();//        }//        String str2 = "";//        try {//            str2 = get?ey();//        } catch (Exception e) {//            str2 = getKey();//            System.arraycopy(str2, 0, str, 5, 5);//        }//        int[] iArr = new int[16];//        iArr[0] = 0;//        iArr[12] = 14;//        iArr[10] = 7;//        iArr[14] = 15;//        iArr[15] = 42;//        try {//            iArr[1] = 3;//            iArr[5] = 5;//            System.out.println();//        } catch (Exception e2) {//            iArr[5] = 37;//            iArr[1] = 85;//        }//        iArr[6] = 15;//        iArr[2] = 13;//        iArr[3] = 19;//        iArr[11] = 68;//        iArr[4] = 85;//        iArr[13] = 5;//        iArr[9] = 7;//        iArr[7] = 78;//        iArr[8] = 22;//        while (i < str.length()) {//            if ((iArr[i] & 255) != ((str.charAt(i) ^ str2.charAt(i % str2.length())) & 255)) {//                throw new RuntimeException();//            }//            i++;//        }//    }////    public String getKey() {//        return "bobbydylan";//    }

CTF came(android 版)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.