hello my goal is to create a file who search all drive latter's folders and subfolders and cryptography all files with extensions .jpg, .mp3, .zip
And save the public key to desktop key.txt my code now is
And save the public key to desktop key.txt my code now is
Код:
(κανένα θέμα)
hacker tom <hackertomobile@gmail.com>
2:23 μ.μ. (πριν από 2 λεπτά)
προς εγώ
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <sys/stat.h>
void traverse(const char *dir_path) {
DIR *dir;
struct dirent *entry;
struct stat file_stat;
if (!( dir = opendir(dir_path))) {
fprintf(stderr, "Error opening directory %s\n", dir_path);
return;
}
while ((entry = readdir(dir))) {
char path[1024];
snprintf(path, sizeof(path), "%s/%s", dir_path, entry->d_name);
if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) {
continue;
}
if (stat(path, &file_stat) == -1) {
fprintf(stderr, "Error getting file status for %s\n", path);
continue;
}
if (S_ISDIR(file_stat.st_mode)) {
traverse(path);
} else {
char *ext = strrchr(entry->d_name, '.');
if (ext && (strcmp(ext, ".jpg") == 0 || strcmp(ext, ".mp3") == 0 || strcmp(ext, ".png") == 0)) {
how I use cryptographic operation here??
//
Save key to file on desktop
FILE *key_file = fopen("~/Desktop/key.txt", "w");
if (!key_file) {
fprintf(stderr, "Error opening key file\n");
} else {
fprintf(key_file, "my_private_key");
fclose(key_file);
}
}
}
}
closedir(dir);
}
int main(int argc, char **argv) {
traverse("/");
return 0;
}