第35天:攻防世界-Mobile—easyjava

到现在为止,基本操作应该都了解的都差不多了。

直接上jeb。

正向算法:

这道题就是纯逆向java代码的算法。感觉脑子有点不够用了。

第35天:攻防世界-Mobile—easyjava_第1张图片

这里是关键算法。代码调用了 a1类和b1类,我对代码做了简单修正,也练习一下java吧。

import java.util.ArrayList;

public class easyjava {
    public static void main(String[] args) {
        int v0 = 0;
        StringBuilder result = new StringBuilder();
        String input = "********";
        Encrpyt_a e_a = new Encrpyt_a(3);
        Encrpyt_b e_b = new Encrpyt_b(2);
        while(v0 < input.length()){
            result.append(e_a.en(e_b.en(input.charAt(v0) + "")));
        }
    }
}

class Encrpyt_a{
    public static ArrayList array;
    static String str;
    int[] int_c;
    static int int_d;
    static {
        array = new ArrayList();
        str = "abcdefghijklmnopqrstuvwxyz";
        int_d = 0;
    }

    public Encrpyt_a(int arg1){
        int_c = new int[]{7, 14, 16, 21, 4, 24, 25, 20, 5, 15, 9, 17, 6, 13, 3, 18, 12, 10, 19, 0, 22, 2, 11, 23, 1, 8};
        for(int i = arg1; i < int_c.length; i++){
            array.add(int_c[i]);
        }
        for(int i = 0; i < arg1; i++){
            array.add(int_c[i]);
        }
    }

    public char en(int arg2){
        char c0;
        int v0 = 0;
        int v1 = 0;
        if(arg2 == -10){
            en_1();
            c0 = " ".charAt(0);
        }
        else{
            while (v0 < array.size() - 1){
                if((int)array.get(v0) == arg2){
                    v1 = v0;
                }
                v0++;
            }
            en_1();
            c0 = str.charAt(v1);
        }
        return c0;
    }

    public static void en_1(){
        int_d += 1;
        if(int_d == 25){
            int v0 = (int)array.get(0);
            array.remove(0);
            array.add(v0);
            int_d = 0;
        }
    }
}

class Encrpyt_b{
    public static ArrayList array;
    static String str;
    int[] int_c;
    static int int_d;
    static {
        array = new ArrayList();
        str = "abcdefghijklmnopqrstuvwxyz";
        int_d = 0;
    }

    public Encrpyt_b(int arg1){
        int_c = new int[]{8, 25, 17, 23, 7, 22, 1, 16, 6, 9, 21, 0, 15, 5, 10, 18, 2, 24, 4, 11, 3, 14, 19, 12, 20, 13};
        for(int i = arg1; i < int_c.length; i++){
            array.add(int_c[i]);
        }
        for(int i = 0; i < arg1; i++){
            array.add(int_c[i]);
        }
    }

    public int en(String arg2){
        int v0 = 0;
        int v1 = 0;
        if(str.contains(arg2.toLowerCase())){
            int v2 = str.indexOf(arg2);
            while(v0 < array.size() - 1){
                if((int)array.get(0) == v2){
                    v1 = v0;
                }
                v0++;
            }
        }
        else{
            if(arg2.contains(" ")) {
                v1 = -10;
                en_1();
                return v1;
            }
            v1 = -1;
        }
        return v1;
    }

    public static void en_1(){
        int v0 = (int)array.get(0);
        array.remove(0);
        array.add(v0);
        str = str + "" + str.charAt(0);
        str = str.substring(1, 27);
        int_d += 1;
    }
}

算法逆向:

我们最后的结果只有小写英文,所以可以忽略掉条件判断。

就是对给定的字符串和数组进行索引和取值。在析构函数中对数组做了一定的变换。

如果学过java,这道题就是考验对算法的逆向求解了。

直接看代码吧,

s_b2 = [17, 23, 7, 22, 1, 16, 6, 9, 21, 0, 15, 5, 10, 18, 2, 24, 4, 11, 3, 14, 19, 12, 20, 13, 8, 25]
s_a3 = [21, 4, 24, 25, 20, 5, 15, 9, 17, 6, 13, 3, 18, 12, 10, 19, 0, 22, 2, 11, 23, 1, 8, 7, 14, 16]
b = "abcdefghijklmnopqrstuvwxyz"
s3 = "wigwrkaugala"
re1 = []
for i in s3:
    re1.append(s_a3[b.index(i)])
print(re1)
flag = ''
for i in re1:
    s4 = s_b2[i]
    flag += b[s4]
    s_b2.append(s_b2[0])
    s_b2.remove(s_b2[0])
    b += b[0]
    b = b[1:]
print(flag)

 

你可能感兴趣的:(攻防世界,Android)