progress
This commit is contained in:
parent
291c72c2a5
commit
4db2cb753a
139
src/main.c
139
src/main.c
@ -237,8 +237,8 @@ void mem_expand_dynamically() {
|
||||
struct log_entry *new_ptr = realloc(all_entries, max_entries * sizeof(struct log_entry));
|
||||
|
||||
if (new_ptr == NULL) {
|
||||
printf("FEHLER: Speicher konnte nicht auf %d Einträge erweitert werden, ..\n", max_entries);
|
||||
printf("FEHLER: Benötigter Speicher: %lu Bytes\n", (unsigned long)(max_entries * sizeof(struct log_entry)));
|
||||
printf("ERROR: Speicher konnte nicht auf %d Einträge erweitert werden, ..\n", max_entries);
|
||||
printf("ERROR: Benötigter Speicher: %lu Bytes\n", (unsigned long)(max_entries * sizeof(struct log_entry)));
|
||||
cleanup_and_exit();
|
||||
}
|
||||
|
||||
@ -252,8 +252,8 @@ void allocate_initial_memory() {
|
||||
all_entries = malloc(max_entries * sizeof(struct log_entry));
|
||||
|
||||
if (all_entries == NULL) {
|
||||
printf("FEHLER: Konnte %d Einträge nicht allozieren, ..\n", max_entries);
|
||||
printf("FEHLER: %lu Bytes\n", (unsigned long)(max_entries * sizeof(struct log_entry)));
|
||||
printf("ERROR: Konnte %d Einträge nicht allozieren, ..\n", max_entries);
|
||||
printf("ERROR: %lu Bytes\n", (unsigned long)(max_entries * sizeof(struct log_entry)));
|
||||
exit(1); // cleanup_and_exit() nicht nötig, da der Speicherbereich nicht beschrieben wurde - use-after-free unproblematisch
|
||||
}
|
||||
|
||||
@ -404,7 +404,7 @@ int parse_simple_log_line(char* line, int entry_index, char* source_file) { // N
|
||||
// 107.170.27.248 - - [31/Aug/2025:00:11:42 +0000] "GET /.git/config HTTP/1.1" 400 255 "-" "Mozilla/5.0; Keydrop.io/1.0(onlyscans.com/about);" "-"
|
||||
// ^
|
||||
} else {
|
||||
printf("FEHLER: Unerwartetes Log-Format. Lediglich mit standard-nginx-accesslog kompatibel.\nDer Fehler ist beim Prüfen des Timestamps aufgetreten, dieser sollte folgendes Format haben:\n[DD/MMM/YYYY:HH:MM:SS +0000]\n\n");
|
||||
printf("ERROR: Unerwartetes Log-Format. Lediglich mit standard-nginx-accesslog kompatibel.\nDer Fehler ist beim Prüfen des Timestamps aufgetreten, dieser sollte folgendes Format haben:\n[DD/MMM/YYYY:HH:MM:SS +0000]\n\n");
|
||||
cleanup_and_exit();
|
||||
}
|
||||
|
||||
@ -479,7 +479,7 @@ int parse_simple_log_line(char* line, int entry_index, char* source_file) { // N
|
||||
// 107.170.27.248 - - [31/Aug/2025:00:11:42 +0000] "GET /.git/config HTTP/1.1" 400 255 "-" "Mozilla/5.0; Keydrop.io/1.0(onlyscans.com/about);" "-"
|
||||
// ^
|
||||
} else {
|
||||
printf("FEHLER: Unerwartetes Log-Format. Lediglich mit standard-nginx-accesslog kompatibel.\nDer Fehler ist beim Prüfen der HTTP-Methode aufgetreten. Diese steht innerhalb eines Strings zusammen mit dem URL-Pfad:\n\"GET /.git/config HTTP/1.1\"\n\n");
|
||||
printf("ERROR: Unerwartetes Log-Format. Lediglich mit standard-nginx-accesslog kompatibel.\nDer Fehler ist beim Prüfen der HTTP-Methode aufgetreten. Diese steht innerhalb eines Strings zusammen mit dem URL-Pfad:\n\"GET /.git/config HTTP/1.1\"\n\n");
|
||||
cleanup_and_exit();
|
||||
}
|
||||
|
||||
@ -513,7 +513,7 @@ int parse_simple_log_line(char* line, int entry_index, char* source_file) { // N
|
||||
}
|
||||
if (*current_pos == '"') current_pos++; // schließendes Anführungszeichen überspringen
|
||||
} else {
|
||||
printf("FEHLER: Unerwartetes Log-Format. Lediglich mit standard-nginx-accesslog kompatibel.\nDer Fehler ist beim Prüfen des Referrer-Feldes aufgetreten.\n\n");
|
||||
printf("ERROR: Unerwartetes Log-Format. Lediglich mit standard-nginx-accesslog kompatibel.\nDer Fehler ist beim Prüfen des Referrer-Feldes aufgetreten.\n\n");
|
||||
cleanup_and_exit();
|
||||
}
|
||||
|
||||
@ -530,7 +530,7 @@ int parse_simple_log_line(char* line, int entry_index, char* source_file) { // N
|
||||
all_entries[entry_index].user_agent[i] = '\0';
|
||||
if (*current_pos == '"') current_pos++;
|
||||
} else {
|
||||
printf("FEHLER: Unerwartetes Log-Format. Lediglich mit standard-nginx-accesslog kompatibel.\nDer Fehler ist beim Prüfen des User-Agent aufgetreten. Dieser steht innerhalb eines Strings:\n\"Mozilla/5.0; Keydrop.io/1.0(onlyscans.com/about);\"\n\n");
|
||||
printf("ERROR: Unerwartetes Log-Format. Lediglich mit standard-nginx-accesslog kompatibel.\nDer Fehler ist beim Prüfen des User-Agent aufgetreten. Dieser steht innerhalb eines Strings:\n\"Mozilla/5.0; Keydrop.io/1.0(onlyscans.com/about);\"\n\n");
|
||||
cleanup_and_exit();
|
||||
}
|
||||
get_current_timestamp(all_entries[entry_index].parsing_timestamp, sizeof(all_entries[entry_index].parsing_timestamp));
|
||||
@ -544,7 +544,7 @@ int parse_simple_log_line(char* line, int entry_index, char* source_file) { // N
|
||||
void load_regular_file(char* filename) {
|
||||
FILE* file = fopen(filename, "r");
|
||||
if (file == NULL) {
|
||||
printf("FEHLER: Kann Datei '%s' nicht öffnen!\n", filename);
|
||||
printf("ERROR: Kann Datei '%s' nicht öffnen!\n", filename);
|
||||
return;
|
||||
}
|
||||
printf("INFO: Lade Datei: %s\n", filename);
|
||||
@ -570,7 +570,7 @@ void load_log_file(char* path) {
|
||||
|
||||
DIR* dir = opendir(path);
|
||||
if (dir == NULL) {
|
||||
printf("FEHLER: Kann Verzeichnis '%s' nicht öffnen!\n", path);
|
||||
printf("ERROR: Kann Verzeichnis '%s' nicht öffnen!\n", path);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -599,7 +599,7 @@ void load_log_file(char* path) {
|
||||
closedir(dir);
|
||||
|
||||
if (files_found == 0) {
|
||||
printf("WARNUNG: Keine .log Dateien im Verzeichnis gefunden.\n");
|
||||
printf("WARNING: Keine .log Dateien im Verzeichnis gefunden.\n");
|
||||
printf(" Tipp: Für .gz Dateien verwenden Sie 'gunzip *.gz' zum Dekomprimieren\n");
|
||||
} else {
|
||||
printf("INFO: Insgesamt %d .log Dateien verarbeitet.\n", files_found);
|
||||
@ -609,7 +609,7 @@ void load_log_file(char* path) {
|
||||
printf("Einzelne Datei erkannt: %s\n", path);
|
||||
|
||||
if (strstr(path, ".gz") != NULL) {
|
||||
printf("FEHLER: .gz Dateien werden in dieser Version nicht unterstützt!\n");
|
||||
printf("ERROR: .gz Dateien werden in dieser Version nicht unterstützt!\n");
|
||||
printf(" Lösung: Dekomprimieren Sie die Datei zuerst:\n");
|
||||
printf(" gunzip %s\n", path);
|
||||
printf(" Dann: %s %.*s\n", "PROGRAMM", (int)(strlen(path)-3), path);
|
||||
@ -994,7 +994,7 @@ void export_filtered_entries(char *filepath) {
|
||||
if (filepath == NULL) {
|
||||
printf("Dateiname für Timesketch-Export eingeben (ohne .csv): ");
|
||||
if (scanf("%90s", filename) != 1) {
|
||||
printf("FEHLER: Ungültiger Dateiname!\n");
|
||||
printf("ERROR: Ungültiger Dateiname!\n");
|
||||
clear_input_buffer();
|
||||
return;
|
||||
}
|
||||
@ -1007,7 +1007,7 @@ void export_filtered_entries(char *filepath) {
|
||||
printf("\nINFO: Schreibe Datei %s...\n", filename);
|
||||
FILE* file = fopen(filename, "w");
|
||||
if (file == NULL) {
|
||||
printf("FEHLER: Kann Datei '%s' nicht erstellen!\n", filename);
|
||||
printf("ERROR: Kann Datei '%s' nicht erstellen!\n", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1209,7 +1209,7 @@ void show_status() {
|
||||
printf(" %d Logzeilen in Datenstruktur\n", total_entries);
|
||||
printf(" Speicherbelegung: %lu Bytes\n", (unsigned long)(max_entries * sizeof(struct log_entry)));
|
||||
} else {
|
||||
printf(" FEHLER: Keine Einträge in Datenstruktur!\n");
|
||||
printf(" ERROR: Keine Einträge in Datenstruktur!\n");
|
||||
}
|
||||
|
||||
printf("\n Aktive Filter:\n");
|
||||
@ -1490,7 +1490,7 @@ int safe_read_integer(const char* prompt, int min_val, int max_val) {
|
||||
// scanf liest den Input in einen pointer ein, daher nicht &input. Die Usereingabe ist ein String, also ein Array
|
||||
if (scanf("%49s", input) != 1) {
|
||||
clear_input_buffer();
|
||||
printf("FEHLER: Ungültige Eingabe. Bitte erneut versuchen.\n");
|
||||
printf("ERROR: Ungültige Eingabe. Bitte erneut versuchen.\n");
|
||||
continue;
|
||||
}
|
||||
clear_input_buffer();
|
||||
@ -1503,12 +1503,12 @@ int safe_read_integer(const char* prompt, int min_val, int max_val) {
|
||||
value = strtol(input, &endptr, 10);
|
||||
// wenn der endptr der Nullterminator ist, handelte es sich bei der Eingabe sicher um einen Long-Integer.
|
||||
if (*endptr != '\0') {
|
||||
printf("FEHLER: '%s' ist keine gültige Zahl. Bitte erneut versuchen.\n", input);
|
||||
printf("ERROR: '%s' ist keine gültige Zahl. Bitte erneut versuchen.\n", input);
|
||||
continue;
|
||||
}
|
||||
// Prüfen, ob sich der Wert im Erwartungsbereich befindet
|
||||
if (value < min_val || value > max_val) {
|
||||
printf("FEHLER: Wert muss zwischen %d und %d liegen. Bitte erneut versuchen.\n", min_val, max_val);
|
||||
printf("ERROR: Wert muss zwischen %d und %d liegen. Bitte erneut versuchen.\n", min_val, max_val);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1521,13 +1521,13 @@ int safe_read_string(const char* prompt, char* buffer, int buffer_size) {
|
||||
printf("%s", prompt);
|
||||
if (scanf("%s", buffer) != 1) {
|
||||
clear_input_buffer();
|
||||
printf("FEHLER: Ungültige Eingabe. Bitte erneut versuchen.\n");
|
||||
printf("ERROR: Ungültige Eingabe. Bitte erneut versuchen.\n");
|
||||
continue;
|
||||
}
|
||||
clear_input_buffer();
|
||||
|
||||
if (strlen(buffer) >= buffer_size - 1) {
|
||||
printf("FEHLER: Eingabe zu lang. Bitte erneut versuchen.\n");
|
||||
printf("ERROR: Eingabe zu lang. Bitte erneut versuchen.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1684,7 +1684,7 @@ int menu_set_filters() {
|
||||
|
||||
if (choice == 1) {
|
||||
if (filters.status_count >= MAX_FILTERS) {
|
||||
printf("FEHLER: Maximale Anzahl Status-Code Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
printf("ERROR: Maximale Anzahl Status-Code Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1705,7 +1705,7 @@ int menu_set_filters() {
|
||||
|
||||
} else if (choice == 2) {
|
||||
if (filters.ip_count >= MAX_FILTERS) {
|
||||
printf("FEHLER: Maximale Anzahl IP-Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
printf("ERROR: Maximale Anzahl IP-Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1727,7 +1727,7 @@ int menu_set_filters() {
|
||||
|
||||
} else if (choice == 3) {
|
||||
if (filters.time_count >= MAX_FILTERS) {
|
||||
printf("FEHLER: Maximale Anzahl Zeitraum-Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
printf("ERROR: Maximale Anzahl Zeitraum-Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1802,7 +1802,7 @@ int menu_set_filters() {
|
||||
|
||||
} else if (choice == 4) {
|
||||
if (filters.user_agent_count >= MAX_FILTERS) {
|
||||
printf("FEHLER: Maximale Anzahl User-Agent Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
printf("ERROR: Maximale Anzahl User-Agent Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1824,7 +1824,7 @@ int menu_set_filters() {
|
||||
|
||||
} else if (choice == 5) {
|
||||
if (filters.method_count >= MAX_FILTERS) {
|
||||
printf("FEHLER: Maximale Anzahl Method-Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
printf("ERROR: Maximale Anzahl Method-Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1846,7 +1846,7 @@ int menu_set_filters() {
|
||||
|
||||
} else if (choice == 6) {
|
||||
if (filters.url_count >= MAX_FILTERS) {
|
||||
printf("FEHLER: Maximale Anzahl URL-Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
printf("ERROR: Maximale Anzahl URL-Filter erreicht (%d)!\n", MAX_FILTERS);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1871,7 +1871,7 @@ int menu_set_filters() {
|
||||
} else if (choice == -3) {
|
||||
return -3;
|
||||
} else if (choice != -1) {
|
||||
printf("FEHLER: Ungültige Auswahl! Bitte wählen Sie 1-6 oder b/m/q.\n");
|
||||
printf("ERROR: Ungültige Auswahl! Bitte wählen Sie 1-6 oder b/m/q.\n");
|
||||
}
|
||||
}
|
||||
return choice;
|
||||
@ -2044,7 +2044,7 @@ void menu_filter_mode() {
|
||||
} else if (choice == -2 || choice == -3) {
|
||||
return;
|
||||
} else if (choice != -1) {
|
||||
printf("FEHLER: Ungültige Auswahl! Bitte wählen Sie 1-3 oder b/m/q.\n");
|
||||
printf("ERROR: Ungültige Auswahl! Bitte wählen Sie 1-3 oder b/m/q.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2059,7 +2059,7 @@ void menu_reset_filters() {
|
||||
return;
|
||||
}
|
||||
|
||||
printf("WARNUNG: Alle %d Filter werden gelöscht!\n\n", total_filters);
|
||||
printf("WARNING: Alle %d Filter werden gelöscht!\n\n", total_filters);
|
||||
printf("1. Ja, alle Filter löschen\n");
|
||||
printf("2. Abbrechen\n");
|
||||
printf("Navigation: [b]Zurück [m]Hauptmenü [q]Beenden\n");
|
||||
@ -2083,7 +2083,7 @@ void menu_reset_filters() {
|
||||
} else if (choice == -2 || choice == -3) {
|
||||
return;
|
||||
} else if (choice != -1) {
|
||||
printf("FEHLER: Ungültige Auswahl! Bitte wählen Sie 1-2 oder b/m/q.\n");
|
||||
printf("ERROR: Ungültige Auswahl! Bitte wählen Sie 1-2 oder b/m/q.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2120,7 +2120,7 @@ void menu_filter_management() {
|
||||
} else if (choice == -3) {
|
||||
return;
|
||||
} else if (choice != -1) {
|
||||
printf("FEHLER: Ungültige Auswahl! Bitte wählen Sie 1-5 oder b/m/q.\n");
|
||||
printf("ERROR: Ungültige Auswahl! Bitte wählen Sie 1-5 oder b/m/q.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2151,7 +2151,7 @@ void menu_show_entries() {
|
||||
|
||||
if (choice == 1) {
|
||||
if (filtered_count > 1000) {
|
||||
printf("\nWARNUNG: Die Anzeige von %d Einträgen in der Kommandozeile ist unübersichtlich.\n", filtered_count);
|
||||
printf("\nWARNING: Die Anzeige von %d Einträgen in der Kommandozeile ist unübersichtlich.\n", filtered_count);
|
||||
printf("Empfehlung: Verwenden Sie den CSV-Export für große Datenmengen.\n\n");
|
||||
printf("1. Trotzdem anzeigen\n");
|
||||
printf("2. Abbrechen\n");
|
||||
@ -2175,7 +2175,7 @@ void menu_show_entries() {
|
||||
} else if (choice == -3) {
|
||||
return;
|
||||
} else if (choice != -1) {
|
||||
printf("FEHLER: Ungültige Auswahl! Bitte wählen Sie 1-4 oder b/m/q.\n");
|
||||
printf("ERROR: Ungültige Auswahl! Bitte wählen Sie 1-4 oder b/m/q.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2225,49 +2225,56 @@ void parse_filter_values(const char* values_str, const char* filter_type) {
|
||||
// Funktionen zum setzen der Filter (existierende Datenstrukturen)
|
||||
void add_status_filter(const char* value, filter_mode_t mode) {
|
||||
if (filters.status_count >= MAX_FILTERS) {
|
||||
printf("WARNUNG: MAX_FILTERS überschritten, ignoriere: %s\n", value);
|
||||
printf("WARNING: MAX_FILTERS überschritten, ignoriere: %s\n", value);
|
||||
return;
|
||||
}
|
||||
// TODO
|
||||
int status_code = atoi(value);
|
||||
// Kovertierung des Statuscodes zu long mit Error handling
|
||||
int status_code = strtol(value, &endptr, 10);
|
||||
if (endptr != '\n' ){
|
||||
printf("ERROR: Ungültiger Wert im Statuscode-Filter: %s", value);
|
||||
}
|
||||
if (status_code < 100 || status_code > 599) {
|
||||
printf("WARNUNG: Invalid status code: %s (must be 100-599)\n", value);
|
||||
printf("WARNING: Invalid status code: %s (must be 100-599)\n", value);
|
||||
return;
|
||||
}
|
||||
|
||||
// setzen des Filters
|
||||
filters.status_filters[filters.status_count].code = status_code;
|
||||
filters.status_filters[filters.status_count].mode = mode;
|
||||
filters.status_count++;
|
||||
|
||||
printf("Added status filter: %s%d\n", mode == FILTER_EXCLUDE ? "!" : "", status_code);
|
||||
printf("DEBUG: Filter hinzugefügt: %s%d\n", mode == FILTER_EXCLUDE ? "!" : "", status_code);
|
||||
}
|
||||
|
||||
void add_ip_filter(const char* value, filter_mode_t mode) {
|
||||
if (filters.ip_count >= MAX_FILTERS) {
|
||||
printf("WARNUNG: MAX_FILTERS überschritten, ignoriere: %s\n", value);
|
||||
printf("WARNING: MAX_FILTERS überschritten, ignoriere: %s\n", value);
|
||||
return;
|
||||
}
|
||||
|
||||
// einfache Plausibilitätsprüfung hinsichtlich der Länge
|
||||
if (strlen(value) >= sizeof(filters.ip_filters[0].ip_address)) {
|
||||
printf("WARNUNG: IP address too long: %s\n", value);
|
||||
printf("WARNING: IP-Adresse zu lang: %s\n", value);
|
||||
return;
|
||||
}
|
||||
|
||||
// setzen des Filters
|
||||
strcpy(filters.ip_filters[filters.ip_count].ip_address, value);
|
||||
filters.ip_filters[filters.ip_count].mode = mode;
|
||||
filters.ip_count++;
|
||||
|
||||
printf("Added IP filter: %s%s\n", mode == FILTER_EXCLUDE ? "!" : "", value);
|
||||
printf("DEBUG: IP-Adressfilter hinzugefügt: %s%s\n", mode == FILTER_EXCLUDE ? "!" : "", value);
|
||||
}
|
||||
|
||||
// gleiche Mechanik wie bei IP-Adresse
|
||||
void add_method_filter(const char* value, filter_mode_t mode) {
|
||||
if (filters.method_count >= MAX_FILTERS) {
|
||||
printf("WARNUNG: MAX_FILTERS überschritten, ignoriere: %s\n", value);
|
||||
printf("WARNING: MAX_FILTERS überschritten, ignoriere: %s\n", value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen(value) >= sizeof(filters.method_filters[0].pattern)) {
|
||||
printf("WARNUNG: Method pattern too long: %s\n", value);
|
||||
printf("WARNING: Methoden-Filterwert zu lang: %s\n", value);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2275,17 +2282,18 @@ void add_method_filter(const char* value, filter_mode_t mode) {
|
||||
filters.method_filters[filters.method_count].mode = mode;
|
||||
filters.method_count++;
|
||||
|
||||
printf("Added method filter: %s%s\n", mode == FILTER_EXCLUDE ? "!" : "", value);
|
||||
printf("DEBUG: Methoden-Filter hinzugefügt: %s%s\n", mode == FILTER_EXCLUDE ? "!" : "", value);
|
||||
}
|
||||
|
||||
// gleiche Mechanik wie bei IP-Adresse
|
||||
void add_useragent_filter(const char* value, filter_mode_t mode) {
|
||||
if (filters.user_agent_count >= MAX_FILTERS) {
|
||||
printf("WARNUNG: MAX_FILTERS überschritten, ignoriere: %s\n", value);
|
||||
printf("WARNING: MAX_FILTERS überschritten, ignoriere: %s\n", value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen(value) >= sizeof(filters.user_agent_filters[0].pattern)) {
|
||||
printf("WARNUNG: User agent pattern too long: %s\n", value);
|
||||
printf("WARNING: User agent Filterwert zu lang: %s\n", value);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2293,17 +2301,18 @@ void add_useragent_filter(const char* value, filter_mode_t mode) {
|
||||
filters.user_agent_filters[filters.user_agent_count].mode = mode;
|
||||
filters.user_agent_count++;
|
||||
|
||||
printf("Added user agent filter: %s%s\n", mode == FILTER_EXCLUDE ? "!" : "", value);
|
||||
printf("DEBUG: User Agent Filter hinzugefügt: %s%s\n", mode == FILTER_EXCLUDE ? "!" : "", value);
|
||||
}
|
||||
|
||||
// gleiche Mechanik wie bei IP-Adresse
|
||||
void add_url_filter(const char* value, filter_mode_t mode) {
|
||||
if (filters.url_count >= MAX_FILTERS) {
|
||||
printf("WARNUNG: MAX_FILTERS überschritten, ignoriere: %s\n", value);
|
||||
printf("WARNING: MAX_FILTERS überschritten, ignoriere: %s\n", value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen(value) >= sizeof(filters.url_filters[0].pattern)) {
|
||||
printf("WARNUNG: URL pattern too long: %s\n", value);
|
||||
printf("WARNING: URL/Payload Filterwert zu lang: %s\n", value);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2311,24 +2320,24 @@ void add_url_filter(const char* value, filter_mode_t mode) {
|
||||
filters.url_filters[filters.url_count].mode = mode;
|
||||
filters.url_count++;
|
||||
|
||||
printf("Added URL filter: %s%s\n", mode == FILTER_EXCLUDE ? "!" : "", value);
|
||||
printf("DEBUG: URL/Payload-Filter hinzugefügt: %s%s\n", mode == FILTER_EXCLUDE ? "!" : "", value);
|
||||
}
|
||||
|
||||
// Main filter parsing function
|
||||
// Filter-Argument Parser
|
||||
int parse_filter_argument(const char* arg) {
|
||||
if (!starts_with(arg, "--")) {
|
||||
return 0; // Not a filter argument
|
||||
}
|
||||
|
||||
// Find the '=' character
|
||||
const char* equals_pos = strchr(arg, '=');
|
||||
if (equals_pos == NULL) {
|
||||
printf("WARNUNG: Invalid filter format (missing =): %s\n", arg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Extract filter type (between -- and =)
|
||||
int type_len = equals_pos - arg - 2; // -2 for the "--"
|
||||
// = finden
|
||||
const char* equals_pos = strchr(arg, '=');
|
||||
if (equals_pos == NULL) {
|
||||
printf("WARNING: Invalid filter format (missing =): %s\n", arg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// filter-Typ parsen
|
||||
int type_len = equals_pos - arg - 2; // Position anpassen,
|
||||
char filter_type[50];
|
||||
strncpy(filter_type, arg + 2, type_len);
|
||||
filter_type[type_len] = '\0';
|
||||
@ -2355,10 +2364,10 @@ int parse_filter_argument(const char* arg) {
|
||||
filters.combination_mode = 1;
|
||||
printf("Set filter combination mode: OR\n");
|
||||
} else {
|
||||
printf("WARNUNG: Invalid mode value: %s (use 'and' or 'or')\n", values);
|
||||
printf("WARNING: Invalid mode value: %s (use 'and' or 'or')\n", values);
|
||||
}
|
||||
} else {
|
||||
printf("WARNUNG: Unknown filter type: %s\n", filter_type);
|
||||
printf("WARNING: Unknown filter type: %s\n", filter_type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2491,7 +2500,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
}
|
||||
if (flag_export == 1 && flag_interactive == 1) {
|
||||
printf("FEHLER: Interaktiver Modus kann nicht mit Export-Modus kombiniert werden. Mit %c ausführen für Anleitung.", argv[0]);
|
||||
printf("ERROR: Interaktiver Modus kann nicht mit Export-Modus kombiniert werden. Mit %c ausführen für Anleitung.", argv[0]);
|
||||
return 1;
|
||||
}else if (flag_interactive == 1) {
|
||||
load_log_file(argv[1]);
|
||||
@ -2515,7 +2524,7 @@ int main(int argc, char* argv[]) {
|
||||
choice = handle_menu_shortcuts(choice);
|
||||
|
||||
if (choice == -1) {
|
||||
printf("FEHLER: Bitte geben Sie eine gültige Zahl oder Navigation ein (1-4, b, m, q)!\n");
|
||||
printf("ERROR: Bitte geben Sie eine gültige Zahl oder Navigation ein (1-4, b, m, q)!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2531,7 +2540,7 @@ int main(int argc, char* argv[]) {
|
||||
} else if (choice == -4) {
|
||||
break;
|
||||
} else {
|
||||
printf("FEHLER: Ungültige Auswahl! Bitte wählen Sie 1-4 oder b/m/q.\n");
|
||||
printf("ERROR: Ungültige Auswahl! Bitte wählen Sie 1-4 oder b/m/q.\n");
|
||||
}
|
||||
}
|
||||
} else if (flag_export == 1){
|
||||
|
Loading…
x
Reference in New Issue
Block a user