本文主要是介绍BUUCTF Reverse Java逆向解密(划水),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
得到class文件我直接拖进idea了
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//import java.util.ArrayList;
import java.util.Scanner;public class Reverse {public Reverse() {}public static void main(String[] args) {Scanner s = new Scanner(System.in);System.out.println("Please input the flag :");String str = s.next();System.out.println("Your input is :");System.out.println(str);char[] stringArr = str.toCharArray();Encrypt(stringArr);}public static void Encrypt(char[] arr) {ArrayList<Integer> Resultlist = new ArrayList();for(int i = 0; i < arr.length; ++i) {int result = arr[i] + 64 ^ 32;Resultlist.add(result);}int[] KEY = new int[]{180, 136, 137, 147, 191, 137, 147, 191, 148, 136, 133, 191, 134, 140, 129, 135, 191, 65};ArrayList<Integer> KEYList = new ArrayList();for(int j = 0; j < KEY.length; ++j) {KEYList.add(KEY[j]);}System.out.println("Result:");if (Resultlist.equals(KEYList)) {System.out.println("Congratulations!");} else {System.err.println("Error!");}}
}
写逆向脚本
target = [180, 136, 137, 147, 191, 137, 147, 191, 148, 136, 133, 191, 134, 140, 129, 135, 191, 65]
str = ''
for i in range(len(target)):inter = target[i] - 64 ^ 32str += chr(inter)
print(str)
第一次的时候不知道它们的运算优先级写成这样了
inter = target[i] - (64 ^ 32)
得到的结果自然也是错误的
这篇关于BUUCTF Reverse Java逆向解密(划水)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!