-
Notifications
You must be signed in to change notification settings - Fork 77
/
billboard.c
57 lines (42 loc) · 1.25 KB
/
billboard.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
#ifndef _MYLIB_H_
#define _MYLIB_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "module.h"
const char* name = "Digital Billboard";
const char* info = "We bought a new digital billboard for CTF advertisement.\n"
"\n"
"Type \"help\" for help :)";
struct billboard {
char text[256];
char devmode;
};
struct billboard bb = { .text="Placeholder", .devmode=0 };
void set_text(int argc, char* argv[]) {
strcpy(bb.text, argv[1]);
printf("Successfully set text to: %s\n", bb.text);
return;
}
void shell(int argc, char* argv[]) {
if (bb.devmode) {
printf("Developer access to billboard granted.\n");
system("/bin/bash");
} else {
printf("Developer mode disabled!\n");
}
return;
}
void help(int argc, char* argv[]) {
printf("This is helpful.\n");
return;
}
void initialize_module(module_t* module, registration_function register_command) {
module->name = name;
module->info = info;
register_command("set_text", "<text>\t\t", "Set the text displayed on the board", set_text);
register_command("devmode", "\t\t", "Developer mode", shell);
strcpy(bb.text, "Welcome to 34C3 JUNIOR CTF");
}
#endif