Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <windows.h>
- #define MAX_PATH_LEN 260
- #define HIDDEN_FILE_PATH "C:\\Windows\\System32\\hidden_file.txt"
- #define KEYWAREZ_FILE "C:\\Windows\\System32\\keywarez.txt"
- // Function to hide the file
- void hideFile(const char *filePath) {
- if (MoveFileA(filePath, HIDDEN_FILE_PATH) == 0) {
- printf("Error hiding file: %d\n", GetLastError());
- } else {
- printf("File %s is now hidden.\n", filePath);
- }
- }
- // Function to reveal the file
- void revealFile(const char *filePath) {
- if (MoveFileA(HIDDEN_FILE_PATH, filePath) == 0) {
- printf("Error revealing file: %d\n", GetLastError());
- } else {
- printf("File %s is now visible.\n", filePath);
- }
- }
- // Function to save the key mapping
- void saveKeyMapping(char key, const char *filePath) {
- FILE *keyFile = fopen(KEYWAREZ_FILE, "a");
- if (keyFile != NULL) {
- fprintf(keyFile, "Key: %c, File: %s\n", key, filePath);
- fclose(keyFile);
- printf("Key mapping saved to %s.\n", KEYWAREZ_FILE);
- } else {
- printf("Error opening key mapping file for writing.\n");
- }
- }
- int main() {
- char filePath[MAX_PATH_LEN];
- char key;
- int keyChoice;
- // Display the attribution for the script
- printf("Made by Taylor Christian Newsome\n\n");
- // Get file path from user
- printf("Enter the full path of the file you want to hide: ");
- fgets(filePath, sizeof(filePath), stdin);
- filePath[strcspn(filePath, "\n")] = 0; // Remove newline
- // Ask for key to hide the file
- printf("Enter the key number (1-9) you want to use to hide/unhide the file: ");
- scanf("%d", &keyChoice);
- getchar(); // Consume the newline left by scanf
- // Map key choice to a character
- switch (keyChoice) {
- case 1: key = '1'; break;
- case 2: key = '2'; break;
- case 3: key = '3'; break;
- case 4: key = '4'; break;
- case 5: key = '5'; break;
- case 6: key = '6'; break;
- case 7: key = '7'; break;
- case 8: key = '8'; break;
- case 9: key = '9'; break;
- default:
- printf("Invalid choice. Using default key 'F1'.\n");
- key = 'F1'; // Default key
- break;
- }
- // Hide the file
- hideFile(filePath);
- // Save the key mapping
- saveKeyMapping(key, filePath);
- // Listen for key press to reveal the file
- printf("Press the assigned key '%c' to reveal the file...\n", key);
- while (1) {
- if (GetAsyncKeyState(key) & 0x8000) { // Check if the key is pressed
- printf("\nYou pressed the key '%c'. Revealing the file...\n", key);
- revealFile(filePath);
- break;
- }
- Sleep(100); // Delay to prevent high CPU usage
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement