294Ryan/FileHacker

GitHub: 294Ryan/FileHacker

一款教育用途的命令列檔案加密與檔名混淆工具,透過位元組位移加密搭配 JSON 還原對照表實現可逆的檔案鎖定與復原。

Stars: 0 | Forks: 0

■[中文](#filehacker)  ■[English](#filehacker-1) # FileHacker ## 目錄 - [專案概述](#專案概述) - [重點特色](#重點特色) - [使用說明](#使用說明) - [開發須知](#開發須知) - [使用技術](#使用技術) - [專案結構](#專案結構) - [備註](#備註) ## 專案概述 FileHacker 是一款命令列檔案加密鎖定工具,以教育與實驗為目的開發。對指定目錄下的全部檔案執行位元組位移加密,並將每個檔名替換為 UUID4 隨機字串以隱藏原始身份,同時自動產生 JSON 還原對照表,供日後透過內建 Recovery 模式完整解密復原。 ## 重點特色 - **批量加密**:遞迴處理目標目錄下的所有檔案,自動跳過自身產生的還原記錄檔 - **檔名混淆**:加密完成後以 UUID4(122-bit)隨機字串替換原始檔名,無規律可循 - **JSON 還原對照表**:自動產生 `_restore_YYYYMMDD_HHMMSS.json`,記錄加密前後對應關係 - **內建 Recovery 模式**:透過特殊密碼序列進入復原流程,依照 JSON 對照表解密並還原原始檔名 - **中斷保護**:Ctrl+C 中斷時仍寫出當下已完成的還原對照表,不全部遺失 - **目錄搬移支援**:JSON 以相對路徑記錄,若加密後目錄位置異動,可於復原時手動指定新路徑 ## 使用說明 請先下載本倉庫內容並解壓縮,或直接於 [Releases](https://github.com/294Ryan/FileHacker/releases) 下載 `.exe` 執行檔。 - **啟動**:執行 `python main.py`,或直接執行 `main.exe` **加密模式(Hack):** 1. 依序輸入三段式啟動密碼(預設值定義於 `main.py` 的 `pwd`,可自行修改) 2. 閱讀條款並按 **Enter** 接受 3. 輸入目標目錄的完整路徑 4. 確認後開始加密,結束後自動於目標目錄內產生 `_restore_*.json` **復原模式(Recovery):** 1. 啟動後,三段密碼提示中每段均輸入 `RECOVERY`,進入復原模式 2. 輸入 `_restore_*.json` 的完整路徑 3. 確認後開始解密,依照 JSON 對照表還原所有檔案與原始檔名 **通用指令:** - 在任意輸入提示處輸入 `--exit`,可隨時強制退出程式 ## 開發須知 1. 請先閱讀 `terms.txt` 並遵守相關使用條款。 2. 複製此倉庫至本地: git clone https://github.com/294Ryan/FileHacker.git 3. 使用語言:Python 3.x 4. 安裝必要套件: pip install -r requirements.txt 5. 打包為獨立執行檔(需已安裝 PyInstaller): pyinstaller main.spec ## 使用技術 - **Caesar Cipher(位元組位移加密)**:以 `bytes.translate()` 預建 256 格查找表,在 C 層執行位元組轉換,效能遠優於 Python 逐 byte 迴圈 - **UUID4 檔名混淆**:`uuid.uuid4()` 產生 122-bit 密碼學安全亂數字串作為新檔名,碰撞率趨近於零 - **`os.fsync()` 寫入保證**:加密資料強制同步落地至磁碟,不停留在 OS 快取層 - **JSON 還原對照表**:以相對路徑搭配正斜線統一格式記錄對照關係,跨平台相容,支援目錄搬移後的彈性復原 - **PyInstaller 相容**:`terms.txt` 透過 `sys._MEIPASS` 動態解析路徑,打包後可正常讀取 ## 專案結構 FileHacker/ ├─ fileHacker_icon.ico # 應用程式圖示 ├─ main.py # 主程式 ├─ main.spec # PyInstaller 打包設定 ├─ README.md # 專案說明文件 ├─ requirements.txt # Python 套件依賴清單 └─ terms.txt # 使用條款與免責聲明 ## 備註 - 維護者:294Ryan — [GitHub](https://github.com/294Ryan) - 使用條款:MIT - [!] 本專案僅供教育與研究使用,任何因不當使用所造成的後果由使用者自行承擔。 # FileHacker ## Table of Contents - [Overview](#overview) - [Key Features](#key-features) - [Usage](#usage) - [Development](#development) - [Technologies](#technologies) - [Project Structure](#project-structure) - [Notes](#notes) ## Overview FileHacker is a command-line file encryption tool built for educational and experimental purposes. It applies a byte-shift cipher to all files in a target directory, replaces each filename with a UUID4 random string to conceal the original identity, and automatically generates a JSON restore map for full recovery via the built-in Recovery mode. ## Key Features - **Batch Encryption**: Recursively processes all files in the target directory; automatically excludes self-generated restore records - **Filename Obfuscation**: Each encrypted file is renamed with a UUID4 (122-bit) random string — no discernible pattern - **JSON Restore Map**: Automatically generates `_restore_YYYYMMDD_HHMMSS.json`, mapping encrypted filenames back to their originals - **Built-in Recovery Mode**: Activated via a special password sequence; decrypts and restores all files according to the JSON map - **Interrupt Protection**: On Ctrl+C, writes the restore map for all files processed so far — nothing already completed is lost - **Relocated Directory Support**: The JSON uses relative paths, so recovery works even if the directory has been moved after encryption ## Usage Download and extract the repository, or grab the `.exe` directly from [Releases](https://github.com/294Ryan/FileHacker/releases). - **Launch**: Run `python main.py`, or execute `main.exe` **Hack Mode (Encryption):** 1. Enter the three-stage startup password (default defined in `pwd` inside `main.py`; modify as needed) 2. Read the Terms & Disclaimer and press **Enter** to accept 3. Enter the full path of the target directory 4. Confirm to begin encryption — a `_restore_*.json` file will be written to the target directory upon completion **Recovery Mode (Decryption):** 1. At startup, enter `RECOVERY` at each of the three password prompts to activate Recovery mode 2. Provide the full path to the `_restore_*.json` file 3. Confirm to begin recovery — all files will be decrypted and renamed back to their originals **General Command:** - Type `--exit` at any input prompt to force quit the program ## Development 1. Read `terms.txt` and comply with the stated terms before use. 2. Clone the repository: git clone https://github.com/294Ryan/FileHacker.git 3. Language: Python 3.x 4. Install dependencies: pip install -r requirements.txt 5. Build a standalone executable (requires PyInstaller): pyinstaller main.spec ## Technologies - **Caesar Cipher (Byte-Shift Encryption)**: Uses `bytes.translate()` with a prebuilt 256-entry lookup table — C-level execution, significantly faster than a pure Python byte loop - **UUID4 Filename Obfuscation**: `uuid.uuid4()` generates a cryptographically secure 122-bit random string per file; collision probability is negligible - **`os.fsync()` Write Guarantee**: Encrypted data is flushed directly to disk, bypassing OS-level caching - **JSON Restore Map**: Records file mappings using relative paths with unified forward-slash formatting — cross-platform compatible and resilient to directory relocation - **PyInstaller Compatible**: `terms.txt` is resolved via `sys._MEIPASS` at runtime, allowing the packed executable to locate bundled resources correctly ## Project Structure FileHacker/ ├─ fileHacker_icon.ico # Application icon ├─ main.py # Main program ├─ main.spec # PyInstaller build configuration ├─ README.md # Project documentation ├─ requirements.txt # Python package dependencies └─ terms.txt # Terms of use and disclaimer ## Notes - Maintainer: 294Ryan — [GitHub](https://github.com/294Ryan) - License: MIT - [!] This project is intended solely for educational and research use. Any consequences arising from misuse are the sole responsibility of the user.
标签:DNS 解析, Python, 勒索软件模拟, 文件加密, 文件混淆, 无后门, 漏洞挖掘, 逆向工具