я не знаю что писать( прога для вытаскивания url:log:pas с большого кол-во *****, отрабам может пригодится скорость маленькая ведь питон что бы юзать, кидаем exe в папку с логами и запускаем на выходе получаем base.txt в которой и будут наши строки(антидубли) код #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> #include <sys/stat.h> #define PASSWORDS_FILENAME "Passwords.txt" #define MAX_LINE_LEN 1024 int main() { FILE *output_file = fopen("base.txt", "a"); if (output_file == NULL) { fprintf(stderr, "Error: failed to open output file\n"); return 1; } DIR *dir = opendir("."); if (dir == NULL) { fprintf(stderr, "Error: failed to open directory\n"); return 1; } struct dirent *ent; while ((ent = readdir(dir)) != NULL) { if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { continue; } char path[MAX_LINE_LEN]; snprintf(path, sizeof(path), "%s/%s", ".", ent->d_name); struct stat st; if (stat(path, &st) == -1) { continue; } if (S_ISDIR(st.st_mode)) { DIR *subdir = opendir(path); if (subdir == NULL) { continue; } struct dirent *subent; while ((subent = readdir(subdir)) != NULL) { if (strcmp(subent->d_name, PASSWORDS_FILENAME) == 0) { char filepath[MAX_LINE_LEN]; snprintf(filepath, sizeof(filepath), "%s/%s", path, subent->d_name); FILE *passwords_file = fopen(filepath, "r"); if (passwords_file == NULL) { continue; } char url[MAX_LINE_LEN], log[MAX_LINE_LEN], pass[MAX_LINE_LEN]; char line[MAX_LINE_LEN]; while (fgets(line, sizeof(line), passwords_file) != NULL) { if (strstr(line, "URL: ") != NULL) { sscanf(line, "URL: %[^\n]", url); } else if (strstr(line, "Username: ") != NULL) { sscanf(line, "Username: %[^\n]", log); } else if (strstr(line, "Password: ") != NULL) { sscanf(line, "Password: %[^\n]", pass); } else if (strcmp(line, "===============\n") == 0) { fprintf(output_file, "%s:%s:%s\n", url, log, pass); url[0] = log[0] = pass[0] = '\0'; } } fclose(passwords_file); } } closedir(subdir); } } closedir(dir); fclose(output_file); return 0; } C #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> #include <sys/stat.h> #define PASSWORDS_FILENAME "Passwords.txt" #define MAX_LINE_LEN 1024 int main() { FILE *output_file = fopen("base.txt", "a"); if (output_file == NULL) { fprintf(stderr, "Error: failed to open output file\n"); return 1; } DIR *dir = opendir("."); if (dir == NULL) { fprintf(stderr, "Error: failed to open directory\n"); return 1; } struct dirent *ent; while ((ent = readdir(dir)) != NULL) { if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { continue; } char path[MAX_LINE_LEN]; snprintf(path, sizeof(path), "%s/%s", ".", ent->d_name); struct stat st; if (stat(path, &st) == -1) { continue; } if (S_ISDIR(st.st_mode)) { DIR *subdir = opendir(path); if (subdir == NULL) { continue; } struct dirent *subent; while ((subent = readdir(subdir)) != NULL) { if (strcmp(subent->d_name, PASSWORDS_FILENAME) == 0) { char filepath[MAX_LINE_LEN]; snprintf(filepath, sizeof(filepath), "%s/%s", path, subent->d_name); FILE *passwords_file = fopen(filepath, "r"); if (passwords_file == NULL) { continue; } char url[MAX_LINE_LEN], log[MAX_LINE_LEN], pass[MAX_LINE_LEN]; char line[MAX_LINE_LEN]; while (fgets(line, sizeof(line), passwords_file) != NULL) { if (strstr(line, "URL: ") != NULL) { sscanf(line, "URL: %[^\n]", url); } else if (strstr(line, "Username: ") != NULL) { sscanf(line, "Username: %[^\n]", log); } else if (strstr(line, "Password: ") != NULL) { sscanf(line, "Password: %[^\n]", pass); } else if (strcmp(line, "===============\n") == 0) { fprintf(output_file, "%s:%s:%s\n", url, log, pass); url[0] = log[0] = pass[0] = '\0'; } } fclose(passwords_file); } } closedir(subdir); } } closedir(dir); fclose(output_file); return 0; } кому лень компилить: mega virustotal код v2 добавил время(за сколько спарсил строки) добавил вывод папок и .txt теперь он работает и с racoon логами, он почти универсальный #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> #include <sys/stat.h> #include <time.h> #define MAX_LINE_LEN 1024 int main() { FILE *output_file = fopen("base.txt", "a"); if (output_file == NULL) { fprintf(stderr, "Error: failed to open output file\n"); return 1; } DIR *dir = opendir("."); if (dir == NULL) { fprintf(stderr, "Error: failed to open directory\n"); return 1; } struct dirent *ent; int num_folders = 0, num_password_files = 0; clock_t start_time = clock(); while ((ent = readdir(dir)) != NULL) { if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { continue; } char path[MAX_LINE_LEN]; snprintf(path, sizeof(path), "%s/%s", ".", ent->d_name); struct stat st; if (stat(path, &st) == -1) { continue; } if (S_ISDIR(st.st_mode)) { DIR *subdir = opendir(path); if (subdir == NULL) { continue; } num_folders++; struct dirent *subent; while ((subent = readdir(subdir)) != NULL) { if (strcmp(subent->d_name, "passwords.txt") == 0 || strcmp(subent->d_name, "Passwords.txt") == 0) { char filepath[MAX_LINE_LEN]; snprintf(filepath, sizeof(filepath), "%s/%s", path, subent->d_name); FILE *passwords_file = fopen(filepath, "r"); if (passwords_file == NULL) { continue; } num_password_files++; char url[MAX_LINE_LEN], log[MAX_LINE_LEN], pass[MAX_LINE_LEN]; char line[MAX_LINE_LEN]; while (fgets(line, sizeof(line), passwords_file) != NULL) { if (strstr(line, "URL: ") != NULL) { sscanf(line, "URL: %[^\n]", url); } else if (strstr(line, "Username: ") != NULL || strstr(line, "login: ") != NULL || strstr(line, "USER: ") != NULL) { sscanf(line, "%*[^:]: %[^\n]", log); } else if (strstr(line, "PASS: ") != NULL || strstr(line, "Password: ") != NULL || strstr(line, "password: ") != NULL) { sscanf(line, "%*[^:]: %[^\n]", pass); fprintf(output_file, "%s:%s:%s\n", url, log, pass); url[0] = log[0] = pass[0] = '\0'; } } fclose(passwords_file); } } closedir(subdir); } } closedir(dir); fclose(output_file); clock_t end_time = clock(); double elapsed_time = (double) (end_time - start_time) / CLOCKS_PER_SEC; printf("Finished in %f seconds.\n", elapsed_time); printf("Found %d folders and %d password files.\n", num_folders, num_password_files); system("pause"); return 0; } C #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> #include <sys/stat.h> #include <time.h> #define MAX_LINE_LEN 1024 int main() { FILE *output_file = fopen("base.txt", "a"); if (output_file == NULL) { fprintf(stderr, "Error: failed to open output file\n"); return 1; } DIR *dir = opendir("."); if (dir == NULL) { fprintf(stderr, "Error: failed to open directory\n"); return 1; } struct dirent *ent; int num_folders = 0, num_password_files = 0; clock_t start_time = clock(); while ((ent = readdir(dir)) != NULL) { if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { continue; } char path[MAX_LINE_LEN]; snprintf(path, sizeof(path), "%s/%s", ".", ent->d_name); struct stat st; if (stat(path, &st) == -1) { continue; } if (S_ISDIR(st.st_mode)) { DIR *subdir = opendir(path); if (subdir == NULL) { continue; } num_folders++; struct dirent *subent; while ((subent = readdir(subdir)) != NULL) { if (strcmp(subent->d_name, "passwords.txt") == 0 || strcmp(subent->d_name, "Passwords.txt") == 0) { char filepath[MAX_LINE_LEN]; snprintf(filepath, sizeof(filepath), "%s/%s", path, subent->d_name); FILE *passwords_file = fopen(filepath, "r"); if (passwords_file == NULL) { continue; } num_password_files++; char url[MAX_LINE_LEN], log[MAX_LINE_LEN], pass[MAX_LINE_LEN]; char line[MAX_LINE_LEN]; while (fgets(line, sizeof(line), passwords_file) != NULL) { if (strstr(line, "URL: ") != NULL) { sscanf(line, "URL: %[^\n]", url); } else if (strstr(line, "Username: ") != NULL || strstr(line, "login: ") != NULL || strstr(line, "USER: ") != NULL) { sscanf(line, "%*[^:]: %[^\n]", log); } else if (strstr(line, "PASS: ") != NULL || strstr(line, "Password: ") != NULL || strstr(line, "password: ") != NULL) { sscanf(line, "%*[^:]: %[^\n]", pass); fprintf(output_file, "%s:%s:%s\n", url, log, pass); url[0] = log[0] = pass[0] = '\0'; } } fclose(passwords_file); } } closedir(subdir); } } closedir(dir); fclose(output_file); clock_t end_time = clock(); double elapsed_time = (double) (end_time - start_time) / CLOCKS_PER_SEC; printf("Finished in %f seconds.\n", elapsed_time); printf("Found %d folders and %d password files.\n", num_folders, num_password_files); system("pause"); return 0; } кому лень компилить v2: mega virustotal скриншоты redline: racoon:
Hey can you update V2 for iterate through every file/directory recursively ? In some **** password.txt is in subfolders. Thanks