Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dribllerrad/temporary_file_handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Temporary File Handler

[License: MIT]

Overview

The Temporary File Handler is a cross-platform library designed to create temporary files that are automatically deleted. It ensures that sensitive data handled within temporary files remains secure by obfuscating filenames.

Features

  • 🚀 Cross-platform compatibility: Works on various operating systems.
  • 🧹 Automatic cleanup: Files are removed when the object is destroyed or the program exits.
  • 🔒 Security: Implements obfuscation of filenames to protect the contents of temporary files.

Getting Started

Prerequisites

Ensure you have a compatible compiler for C++17 or higher and CMake version 3.15 or higher.

Building and Installation

Cloning the Repository

git clone https://github.com/dribllerrad/temporary_file_handler.git

Building with CMake

cd temporary_file_handler
mkdir build
cd build
cmake .. && cmake --build .

Installing the Library

sudo cmake --install .

Note: Use sudo for writing to standard locations like /usr/local/lib and /usr/local/include. For custom install locations, use CMAKE_INSTALL_PREFIX.

Usage Examples

Creating a Temporary File

#include <temporary_file_handler/temporary_file_handler.hpp>
// Additional includes for the example
#include <filesystem>
#include <fstream>
#include <string>
#include <sstream>
#include <iostream>

int main() {
    temporary_file_handler tfh;
    std::filesystem::path test_file = tfh.create_temporary_file();
    std::string test_message = "Hello temporary file.";
    std::ofstream ofs(test_file, std::ios::binary);
    ofs.write(test_message.c_str(), test_message.size());
    ofs.close();

    std::ifstream ifs(test_file, std::ios::binary);
    std::stringstream buffer;
    if(ifs) {
        buffer << ifs.rdbuf();
        ifs.close();
        std::cout << buffer.str() << "\n";
    }

    return 0;
}

Note: In debug mode, obfuscated names of temporary files are printed to the console.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project Link

About

C++ library that provides a cross-platform way to create obfuscated temporary files that are automatically removed when the class object goes out of scope or the parent executable closes.

Topics

Resources

License

Stars

2 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors