-
Notifications
You must be signed in to change notification settings - Fork 1
/
phase_3.c
58 lines (55 loc) · 900 Bytes
/
phase_3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
void phase_3(const char *input)
{
// 0x8(%rsp) 0xc(%rsp)
int num1, num2;
// %rdi %rsi %rdx %rcx
int result = sscnaf(input, "%d %d", &num1, &num2);
if (result <= 1) {
explode_bomb();
}
switch (num1) {
case 0: // 0 207
if (num2 != 0xcf) {
explode_bomb();
}
break;
case 1: // 1 311
if (num2 != 0x137) {
explode_bomb();
}
break;
case 2: // 2 707
if (num2 != 0x2c3) {
explode_bomb();
}
break;
case 3: // 3 256
if (num2 != 0x100) {
explode_bomb();
}
break;
case 4: // 4 389
if (num2 != 0x185) {
explode_bomb();
}
break;
case 5: // 5 206
if (num2 != 0xce) {
explode_bomb();
}
break;
case 6: // 6 682
if (num2 != 0x2aa) {
explode_bomb();
}
break;
case 7: // 7 327
if (num2 != 0x147) {
explode_bomb();
}
break;
default:
explode_bomb();
break;
}
}