FileHacker 是一款命令列檔案加密鎖定工具,以教育與實驗為目的開發。對指定目錄下的全部檔案執行位元組位移加密,並將每個檔名替換為 UUID4 隨機字串以隱藏原始身份,同時自動產生 JSON 還原對照表,供日後透過內建 Recovery 模式完整解密復原。
- 批量加密:遞迴處理目標目錄下的所有檔案,自動跳過自身產生的還原記錄檔
- 檔名混淆:加密完成後以 UUID4(122-bit)隨機字串替換原始檔名,無規律可循
- JSON 還原對照表:自動產生
_restore_YYYYMMDD_HHMMSS.json,記錄加密前後對應關係 - 內建 Recovery 模式:透過特殊密碼序列進入復原流程,依照 JSON 對照表解密並還原原始檔名
- 中斷保護:Ctrl+C 中斷時仍寫出當下已完成的還原對照表,不全部遺失
- 目錄搬移支援:JSON 以相對路徑記錄,若加密後目錄位置異動,可於復原時手動指定新路徑
請先下載本倉庫內容並解壓縮,或直接於 Releases 下載 .exe 執行檔。
- 啟動:執行
python main.py,或直接執行main.exe
加密模式(Hack):
- 依序輸入三段式啟動密碼(預設值定義於
main.py的pwd,可自行修改) - 閱讀條款並按 Enter 接受
- 輸入目標目錄的完整路徑
- 確認後開始加密,結束後自動於目標目錄內產生
_restore_*.json
復原模式(Recovery):
- 啟動後,三段密碼提示中每段均輸入
RECOVERY,進入復原模式 - 輸入
_restore_*.json的完整路徑 - 確認後開始解密,依照 JSON 對照表還原所有檔案與原始檔名
通用指令:
- 在任意輸入提示處輸入
--exit,可隨時強制退出程式
- 請先閱讀
terms.txt並遵守相關使用條款。 - 複製此倉庫至本地:
git clone https://github.com/294Ryan/FileHacker.git - 使用語言:Python 3.x
- 安裝必要套件:
pip install -r requirements.txt - 打包為獨立執行檔(需已安裝 PyInstaller):
pyinstaller main.spec打包前請確認
terms.txt與fileHacker_icon.ico位於專案根目錄,並已於main.spec的datas中正確設定。
- 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
- 使用條款:MIT
- <!> 敬請在本專案所用條款之允許範圍內進行使用。且任何因操作疏失或不當使用造成的後果請自負。
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.
- 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
Download and extract the repository, or grab the .exe directly from Releases.
- Launch: Run
python main.py, or executemain.exe
Hack Mode (Encryption):
- Enter the three-stage startup password (default defined in
pwdinsidemain.py; modify as needed) - Read the Terms & Disclaimer and press Enter to accept
- Enter the full path of the target directory
- Confirm to begin encryption — a
_restore_*.jsonfile will be written to the target directory upon completion
Recovery Mode (Decryption):
- At startup, enter
RECOVERYat each of the three password prompts to activate Recovery mode - Provide the full path to the
_restore_*.jsonfile - Confirm to begin recovery — all files will be decrypted and renamed back to their originals
General Command:
- Type
--exitat any input prompt to force quit the program
- Read
terms.txtand comply with the stated terms before use. - Clone the repository:
git clone https://github.com/294Ryan/FileHacker.git - Language: Python 3.x
- Install dependencies:
pip install -r requirements.txt - Build a standalone executable (requires PyInstaller):
pyinstaller main.specBefore building, ensure
terms.txtandfileHacker_icon.icoare in the project root and correctly listed underdatasinmain.spec.
- 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.txtis resolved viasys._MEIPASSat runtime, allowing the packed executable to locate bundled resources correctly
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
- Maintainer: 294Ryan — GitHub
- License: MIT
- <!> Please use this product only within the scope permitted by the terms and conditions of this project. You are solely responsible for any consequences arising from operational errors or improper use.