aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMosder <xmosder12@gmail.com>2026-06-11 17:26:52 +0200
committerMosder <xmosder12@gmail.com>2026-06-11 17:26:52 +0200
commit070f39fc2b033bcf53797480c4b1ce27a0eb0f91 (patch)
treef1d77847c9baeffafcd790889f44bf1600010e11 /main.c
parentfde7f41c89391a0d3ddebcbc7b5326c2a486a6ca (diff)
feat: added utils/fs.h for filesystem operations and made a function to create necessary directories
Diffstat (limited to 'main.c')
-rw-r--r--main.c78
1 files changed, 40 insertions, 38 deletions
diff --git a/main.c b/main.c
index 90f7944..aa43e57 100644
--- a/main.c
+++ b/main.c
@@ -1,64 +1,66 @@
#include <stdio.h>
#include <string.h>
+#include "analyzer/utils/fs.h"
+
// prints help
void print_help() {
- printf("A bare-bones analyzer for the game Broken Ranks\n");
- printf("\nUsage:\n");
- printf(" branal - start live analysis\n");
- printf(" branal (l | live) - start live analysis (same as above)\n");
- printf(" branal (c | capture) [file] - start capturing packets to [file].\n");
- printf(" If [file] not given - captures to $HOME/.local/share/branal/captures\n");
- printf(" branal (f | file) <file> - analyze the specified <file>\n");
- printf(" branal (h | help) - display this help\n");
+ printf("A bare-bones analyzer for the game Broken Ranks\n");
+ printf("\nUsage:\n");
+ printf(" branal - start live analysis\n");
+ printf(" branal (l | live) - start live analysis (same as above)\n");
+ printf(" branal (c | capture) [file] - start capturing packets to [file].\n");
+ printf(" If [file] not given - captures to $HOME/.local/share/branal/captures\n");
+ printf(" branal (f | file) <file> - analyze the specified <file>\n");
+ printf(" branal (h | help) - display this help\n");
}
// starts live analyzer mode
void start_live_analyzer() {
- // TODO: implement
- printf("Not implemented\n");
+ // TODO: implement
+ printf("Not implemented\n");
}
// starts the only capturing packets mode
void start_capturing_packets() {
- // TODO: implement
- printf("Not implemented\n");
+ // TODO: implement
+ printf("Not implemented\n");
}
// analyzes the specified file
// params:
// - file_path - path to the .pcap file to be analyzed
void analyze_file(char *file_path) {
- // TODO: implement
- printf("Not implemented\n");
+ // TODO: implement
+ printf("Not implemented\n");
}
int main(int argc, char *argv[]) {
- // TODO: create necessary directories
+ create_necessary_directories();
- // start live analysis if no arguments provided
- if (argc < 2) {
- start_live_analyzer();
- return 0;
- }
+ // start live analysis if no arguments provided
+ if (argc < 2) {
+ start_live_analyzer();
+ return 0;
+ }
- if (strcmp("l", argv[1]) == 0 || strcmp("live", argv[1]) == 0) {
- start_live_analyzer();
- }
- else if (strcmp("c", argv[1]) == 0 || strcmp("capture", argv[1]) == 0) {
- start_capturing_packets();
- }
- else if (strcmp("h", argv[1]) == 0 || strcmp("help", argv[1]) == 0) {
- print_help();
- }
- else if (argc >= 3 && (strcmp("f", argv[1]) == 0 || strcmp("file", argv[1]) == 0)) {
- analyze_file(argv[2]);
- }
- else {
- printf("Command not recognized\n");
- printf("Use \"branal (h | help)\" for help\n");
- return 1;
- }
+ if (strcmp("l", argv[1]) == 0 || strcmp("live", argv[1]) == 0) {
+ start_live_analyzer();
+ }
+ else if (strcmp("c", argv[1]) == 0 || strcmp("capture", argv[1]) == 0) {
+ start_capturing_packets();
+ }
+ else if (strcmp("h", argv[1]) == 0 || strcmp("help", argv[1]) == 0) {
+ print_help();
+ }
+ else if (argc >= 3 && (strcmp("f", argv[1]) == 0 || strcmp("file", argv[1]) == 0)) {
+ analyze_file(argv[2]);
+ }
+ else {
+ printf("Command not recognized\n");
+ printf("Use \"branal (h | help)\" for help\n");
+ return 1;
+ }
- return 0;
+ return 0;
}