-
Notifications
You must be signed in to change notification settings - Fork 1
/
ctfjawn-ba-01.c
71 lines (58 loc) · 1.6 KB
/
ctfjawn-ba-01.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
#include <stdio.h>
#include <string.h>
#include "ctfjawn.h"
/*
* ctfjawn-ba-01.c
*
* This is one of a few binary challenges which are intended to teach those new
* to the world of binary analysis.
*
*/
/********* FUNCTIONS *********/
void cm9sbHdpdGhyaWNr() {
char rwr[] = "just cause";
// The gift that keeps on giving
printf("aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ==\n");
}
void show_secret (){
// Show the flag
printf("flag0x01: %s\n", FLAG0x01);
}
void validate_guess (char *guess) {
char *g = guess;
//printf("DEBUG: g=%s, SECRET=%s\n", g, SECRET);
if (strcmp(g, DEC) == 0) {
printf("Correct! \n");
show_secret();
} else {
printf("Wrong. Try again\n");
}
}
void display_message() {
printf("==================================================\n");
printf(" CTFJawn, Binary Analysis Challenge, 01\n");
printf("==================================================\n\n");
}
/********* MAIN *********/
int main(int argc, char *argv[]) {
int i = 0;
char * guess = argv[1]; // yeah, so?
/*
* using gdb, run this program and set i=1 so that the function
* show_secret() executes
*/
display_message();
printf("Entered guess: %s\n", guess);
/* Two ways to trigger True statements
* 1. modify i using gdb
* 2. read memory address of the variable being compared to guess
*/
if (i == (6-5)) {
show_secret();
}
/* This function is included in the libctfjawn library */
decrypt_jawn();
validate_guess(guess);
printf("Goodbye\n\n");
return 0;
}