This repository has been archived by the owner on Nov 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 101
/
inscount_example.c
84 lines (73 loc) · 2.69 KB
/
inscount_example.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
78
79
80
81
82
83
84
#include <string.h>
#include <stdio.h>
// gcc -O0 examples/inscount_example.c -o examples/inscount_example.elf
int get_char(int x, int upper)
{
char set[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
int ret = 0;
ret += set[x];
ret += upper;
// Simulate Crackme doing lots of stuff
for (int i = 0; i < 2500; ++i)
x *= 2;
return ret;
}
int main(int argc, char **argv)
{
if (argc < 2)
return -1;
if (strlen(argv[1]) >= 22)
{
int i = 0;
if (argv[1][i++] != get_char(8, 0))
return -1;
if (argv[1][i++] != get_char(13, 32))
return -1;
if (argv[1][i++] != get_char(18, 0))
return -1;
if (argv[1][i++] != get_char(33, 0))
return -1;
if (argv[1][i++] != get_char(17, 32))
return -1;
if (argv[1][i++] != get_char(20, 32))
return -1;
if (argv[1][i++] != get_char(2, 32))
return -1;
if (argv[1][i++] != get_char(19, 32))
return -1;
if (argv[1][i++] != get_char(8, 0))
return -1;
if (argv[1][i++] != get_char(26, 0))
return -1;
if (argv[1][i++] != get_char(13, 32))
return -1;
if (argv[1][i++] != get_char(2, 0))
return -1;
if (argv[1][i++] != get_char(14, 32))
return -1;
if (argv[1][i++] != get_char(20, 32))
return -1;
if (argv[1][i++] != get_char(13, 32))
return -1;
if (argv[1][i++] != get_char(19, 0))
return -1;
if (argv[1][i++] != get_char(8, 32))
return -1;
if (argv[1][i++] != get_char(13, 0))
return -1;
if (argv[1][i++] != get_char(32, 0))
return -1;
if (argv[1][i++] != get_char(17, 0))
return -1;
if (argv[1][i++] != get_char(20, 32))
return -1;
if (argv[1][i++] != get_char(11, 32))
return -1;
if (argv[1][i++] != get_char(25, 32))
return -1;
printf("Congrats!\n");
printf("The flag is %s\n", argv[1]);
return 0;
}
return -2;
}