This repository has been archived by the owner on May 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
countdown.c
executable file
·77 lines (73 loc) · 4.08 KB
/
countdown.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
char flag[37];
void generate_flag(void) {
// 別プログラムからgenerate_flagを呼ばれないように対策
if (generate_flag != 0x00401172) {
return;
}
char dummy0[37] = {0x21, 0xf2, 0xde, 0x30, 0x63, 0x50, 0x6f, 0x92, 0x78, 0x41, 0xb, 0x7f, 0xe, 0x3e, 0x3a, 0xbd, 0x56, 0x2d, 0x5d, 0x20, 0xc3, 0x37, 0x71, 0x55, 0x63, 0x94, 0x4e, 0x80, 0x7b, 0x29, 0xb0, 0x37, 0x34, 0x2a, 0x5b, 0xaa};
char dummy1[37] = {0x43, 0xfd, 0xd0, 0x12, 0xa6, 0xd4, 0x1e, 0xb7, 0xc2, 0x62, 0x39, 0xba, 0xc5, 0x26, 0x68, 0xc9, 0x6b, 0x8f, 0xf5, 0x1c, 0x7a, 0xbb, 0x7a, 0x3d, 0x4d, 0xc1, 0xf7, 0x73, 0x53, 0xab, 0xd7, 0x1e, 0x2, 0x4c, 0x63, 0xe3};
char dummy2[37] = {0xdb, 0x2e, 0x1b, 0x23, 0xb2, 0x59, 0xa4, 0xde, 0xcd, 0x9a, 0x7e, 0xb0, 0x41, 0x56, 0x66, 0xc1, 0xc0, 0x89, 0xb7, 0x52, 0x7e, 0x76, 0x18, 0xe4, 0x99, 0x3d, 0xf8, 0xc5, 0xe, 0xd4, 0x82, 0xfc, 0xf0, 0xc7, 0x9e, 0xe1};
char dummy3[37] = {0x6f, 0xed, 0x8, 0x47, 0xd0, 0x72, 0xbf, 0xce, 0x7c, 0x9f, 0xc1, 0x9b, 0x41, 0xc, 0x8f, 0xeb, 0x5f, 0xe, 0x50, 0x26, 0xc, 0xe8, 0xc5, 0x4a, 0xa4, 0xe8, 0xb4, 0x1e, 0x8a, 0xe1, 0xe3, 0x39, 0x19, 0xd2, 0x7a, 0xa5};
char dummy4[37] = {0x5e, 0xb1, 0x60, 0xcb, 0x4a, 0x42, 0x73, 0x28, 0xb1, 0x85, 0x29, 0x8a, 0xe8, 0x52, 0x12, 0x7c, 0x63, 0xce, 0xc1, 0xa6, 0xca, 0xc8, 0x8f, 0x4f, 0xc0, 0xfd, 0x73, 0xae, 0x78, 0x8e, 0xf5, 0x16, 0x58, 0x97, 0x69, 0xb4};
char dummy5[37] = {0x1e, 0xc0, 0xc9, 0xb2, 0x5e, 0xba, 0xbc, 0xd2, 0x55, 0xc2, 0x69, 0x4d, 0x9f, 0x4a, 0x56, 0xd1, 0xfe, 0xa5, 0x4a, 0x5, 0x7e, 0x91, 0x56, 0x75, 0x3b, 0xc2, 0x44, 0x34, 0xa3, 0x24, 0x98, 0xf2, 0x1e, 0x7c, 0x3, 0x2a};
char dummy6[37] = {0x10, 0x0, 0xc3, 0xe2, 0xd5, 0x1e, 0x27, 0x3f, 0x1d, 0x33, 0x1e, 0xc9, 0x5e, 0xd9, 0xd0, 0x83, 0x88, 0x9a, 0xe2, 0xcc, 0x1c, 0xa8, 0x7a, 0xcd, 0x3f, 0x22, 0x5, 0x58, 0x20, 0x25, 0xee, 0x7d, 0xfa, 0x4c, 0x55, 0x4c};
char encrypt[37] = {0xfb, 0x16, 0xa9, 0x12, 0x80, 0x7d, 0xc6, 0x66, 0xef, 0xe, 0xae, 0xf, 0x82, 0x61, 0xf1, 0x62, 0xed, 0x14, 0xae, 0xc, 0x88, 0x7a, 0xc0, 0x61, 0xe9, 0xe, 0xb3, 0x14, 0xb6, 0x6a, 0xd6, 0x67, 0xc3, 0x4, 0xb3, 0x1a};
char dummy7[37] = {0x2b, 0x84, 0xf8, 0xc3, 0xcf, 0xa9, 0xd7, 0xe0, 0xa3, 0xa, 0x95, 0x72, 0x50, 0xa4, 0xf5, 0xbb, 0x9f, 0x13, 0x54, 0x3f, 0x61, 0xa6, 0x5a, 0x10, 0xce, 0xac, 0x2c, 0xe8, 0x60, 0x28, 0xf6, 0xd4, 0xd0, 0x21, 0x7a, 0x6e};
char dummy8[37] = {0x5c, 0x28, 0xca, 0xc3, 0x83, 0x4d, 0xf5, 0x8d, 0xc4, 0x17, 0x64, 0xc2, 0x77, 0x3e, 0x38, 0x9f, 0xfa, 0xda, 0x6, 0xf6, 0x9f, 0xb8, 0x1a, 0x75, 0x37, 0xa7, 0x16, 0xcf, 0x36, 0x8b, 0x3b, 0xc7, 0x59, 0x38, 0x7a, 0xc8};
char key[5] = {0x83, 0x7b, 0x9d, 0x61};
char dummy_key0[5] = {0xd1, 0x76, 0x60, 0xc1};
char dummy_key1[5] = {0x67, 0x55, 0xef, 0x17};
char dummy_key2[5] = {0x60, 0xe, 0xb7, 0x9b};
char dummy_key3[5] = {0xe2, 0x38, 0x46, 0xee};
char dummy_key4[5] = {0xd4, 0x6c, 0x6d, 0x82};
char dummy_key5[5] = {0x7e, 0xac, 0x4d, 0xa1};
char dummy_key6[5] = {0x78, 0xa4, 0x70, 0xd};
char dummy_key7[5] = {0x55, 0x3a, 0x3a, 0xeb};
char dummy_key8[5] = {0xcd, 0xdc, 0x18, 0x4c};
char tmp;
for (int i = 0; i < 9; ++i) {
for (int j = 0; j < 4; ++j) {
dummy1[i*4+j] ^= dummy_key1[j];
dummy2[i*4+j] *= dummy7[i*4+j];
encrypt[i*4+j] ^= key[j];
dummy8[i*4+j] = dummy2[i*4+j] % dummy4[i*4+j];
dummy4[i*4+j] = dummy3[i*4+j];
flag[i] -= key[j];
dummy6[i*4+j] -= dummy_key5[j] + 0xdeadbeef;
key[j] ^= encrypt[i*4+j];
flag[i] = dummy_key6[j];
dummy2[i*4+j-j+j+87936485*0] = dummy0[i];
}
}
for (int i = 0; i < 4*9; ++i) {
flag[i] = 0xbb;
flag[i] ^= dummy4[i];
flag[i] ^= dummy3[i];
flag[i] -= 0xbb;
flag[i] += encrypt[i];
}
}
void wait() {
while (time(NULL) < 1609459200) {
time_t t = 1609459200 - time(NULL);
printf("%dday %d:%d:%d ...\n", t / (60*60*24), (t / 60*60) % 24, (t / 60) % 60, t % 60);
sleep(1);
}
}
int main() {
char input[36];
puts("New year countdown!");
wait();
generate_flag();
puts("Happy new year! We check your flag!");
printf("FLAG: ");
scanf("%35s", input);
if (strcmp(flag, input) == 0) {
puts("Congratulations!");
}
return 0;
}