0xgame题目
[Week 3] BabyASM
汇编语言,上网参考了好多资料。
先声明了一个data数组。然后L3这里有一个循环,当计数器小于等于21时,就跳转L4
L3:
cmp DWORD PTR [esp+28], 21
jle L4
L4执行操作的大意是把data中对应位置元素加上28
add eax, 28
之后进入L5,将22-42的元素进行异或(22对应0,类推)
最后附上解密脚本:
# 定义初始数据
data = [
20, 92, 43, 69, 81, 73, 95, 23, 72, 22, 24, 69,
25, 27, 22, 17, 23, 29, 24, 73, 17, 24, 85, 27,
112, 76, 15, 92, 24, 1, 73, 84, 13, 81, 12, 0,
84, 73, 82, 8, 82, 81, 76, 125]
# 第一个循环:将前22个字节加28
for i in range(0,22):
data[i] += 28
# 第二个循环:对接下来的22个字节进行异或操作
for i in range(22, 43): # 从22到42
data[i] ^= data[i - 22] # 异或当前字节与22个前的字节
# 将字节转换为字符并打印
output = ''.join(chr(byte) for byte in data)
print("最终结果:")
print(output)
[Week 3] LittlePuzzle
使用cfr-0.152.jar反编译
/*
* Decompiled with CFR 0.152.
*/
import java.util.Scanner;
public class Puzzle {
static int[][] board = new int[][]{{5, 7, 0, 9, 4, 0, 8, 0, 0}, {0, 0, 8, 0, 3, 0, 0, 0, 5}, {0, 1, 0, 2, 0, 0, 0, 3, 7}, {0, 0, 9, 7, 2, 0, 0, 0, 0}, {7, 3, 4, 0, 0, 8, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 7, 5, 1}, {3, 0, 0, 0, 1, 4, 2, 0, 0}, {0, 6, 0, 0, 0, 2, 0, 4, 0}, {0, 2, 7, 0, 0, 9, 5, 0, 0}};
public static void exit() {
System.out.println("\u89e3\u8c1c\u5931\u8d25");
System.exit(1);
}
public static boolean check(int n, int n2) {
int n3;
int n4 = board[n][n2];
int n5 = n - n % 3;
int n6 = n2 - n2 % 3;
for (n3 = 0; n3 < 9; ++n3) {
if (n3 == n || n3 == n2 || n4 != board[n][n3] && n4 != board[n3][n2]) continue;
return false;
}
for (n3 = 0; n3 < 3; ++n3) {
for (int i = 0; i < 3; ++i) {
if (n5 + n3 == n || n6 + i == n2 || n4 != board[n5 + n3][n6 + i]) continue;
return false;
}
}
return true;
}
static String flag(String string) {
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < string.length(); i += 6) {
int n = Integer.parseInt(string.substring(i, i + 6));
stringBuilder.append(Integer.toHexString(n));
}
return stringBuilder.toString();
}
public static void main(String[] stringArray) {
int n;
int n2;
System.out.println("\u8bf7\u8f93\u5165\u4f60\u7684\u89e3\u8c1c\u7ed3\u679c:");
Scanner scanner = new Scanner(System.in);
String string = scanner.nextLine();
scanner.close();
if (string.length() != 48) {
Puzzle.exit();
}
int n3 = 0;
for (n2 = 0; n2 < 9; ++n2) {
for (n = 0; n < 9; ++n) {
if (board[n2][n] != 0) continue;
int n4 = string.charAt(n3) - 48;
if (n4 > 0 && n4 <= 9) {
Puzzle.board[n2][n] = n4;
++n3;
continue;
}
Puzzle.exit();
}
}
for (n2 = 0; n2 < 9; ++n2) {
for (n = 0; n < 9; ++n) {
if (Puzzle.check(n2, n)) continue;
Puzzle.exit();
}
}
System.out.println(String.format("0xGame