Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company 👇
Go aicertificationcloud-engineeringcybercybersecuritycybersecurity-analystcybersecurity-certificationcybersecurity-certificationscybersecurity-educationcybersecurity-jobscybersecurity-portfoliocybersecurity-projectscybersecurity-toolsgrchackinglearningpentestingproject-repositoryprojetcspython
/*
©AngelaMos | 2026
MappedFile.hpp
RAII wrapper for read-only memory-mapped files
Connects to:
io/MappedFile.cpp - implementation using mmap/munmap
attack/DictionaryAttack.hpp - DictionaryAttack holds a MappedFile
core/Concepts.hpp - CrackError for open failures
*/
#pragma once
#include "src/core/Concepts.hpp"
#include <cstddef>
#include <expected>
#include <string_view>
class MappedFile {
public:
MappedFile() = default;
static std::expected<MappedFile, CrackError> open(std::string_view path);
~MappedFile();
MappedFile(MappedFile &&other) noexcept;
MappedFile &operator=(MappedFile &&other) noexcept;
MappedFile(const MappedFile &) = delete;
MappedFile &operator=(const MappedFile &) = delete;
const char *data() const { return data_; }
std::size_t size() const { return size_; }
private:
const char *data_ = nullptr;
std::size_t size_ = 0;
int fd_ = -1;
};