/EncryptHorizon

A simple but effective script to encrypt/decrypt a file or a whole directory in Windows.

Primary LanguagePowerShellMIT LicenseMIT

███████╗███╗   ██╗ ██████╗██████╗ ██╗   ██╗██████╗ ████████╗██╗  ██╗ ██████╗ ██████╗ ██╗███████╗ ██████╗ ███╗   ██╗    ██╗   ██╗ ██╗   ██████╗ 
██╔════╝████╗  ██║██╔════╝██╔══██╗╚██╗ ██╔╝██╔══██╗╚══██╔══╝██║  ██║██╔═══██╗██╔══██╗██║╚══███╔╝██╔═══██╗████╗  ██║    ██║   ██║███║   ╚════██╗
█████╗  ██╔██╗ ██║██║     ██████╔╝ ╚████╔╝ ██████╔╝   ██║   ███████║██║   ██║██████╔╝██║  ███╔╝ ██║   ██║██╔██╗ ██║    ██║   ██║╚██║    █████╔╝
██╔══╝  ██║╚██╗██║██║     ██╔══██╗  ╚██╔╝  ██╔═══╝    ██║   ██╔══██║██║   ██║██╔══██╗██║ ███╔╝  ██║   ██║██║╚██╗██║    ╚██╗ ██╔╝ ██║   ██╔═══╝ 
███████╗██║ ╚████║╚██████╗██║  ██║   ██║   ██║        ██║   ██║  ██║╚██████╔╝██║  ██║██║███████╗╚██████╔╝██║ ╚████║     ╚████╔╝  ██║██╗███████╗
╚══════╝╚═╝  ╚═══╝ ╚═════╝╚═╝  ╚═╝   ╚═╝   ╚═╝        ╚═╝   ╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═╝╚═╝╚══════╝ ╚═════╝ ╚═╝  ╚═══╝      ╚═══╝   ╚═╝╚═╝╚══════╝

THIS SCRIPT IS DESIGNED FOR EDUCATIONAL PURPOSE ONLY! DO NOT USE THIS SCRIPT FOR ILLEGAL PURPOSES!

A simple but effective script to encrypt/decrypt a file or a whole directory in Windows.

The Windows Defender is totally unable to detect the ongoing encryption as a threat. It is also unable to detect the encrypted files as a threat. So you can encrypt/decrypt your files without any problems.

Works with:

  • Files
  • Directories
  • Subdirectories
  • Remote shares mapped as drives
  • UNC paths

Roadmap

  • Encrypt files
  • Encrypt directories
  • Decrypt files
  • Decrypt directories
  • User-friendly decryption screen
  • Disable important keys (e.g. F1-12, CTRL, ALT, SUPER, etc.)
  • Disable important key combinations (e.g. CTRL+ALT+DEL, ALT+F4, etc.)

How it works

The script uses the Invoke-AESEncryption function from the DRTools package to encrypt/decrypt files and directories.

IMPORTANT: The key used to encrypt/decrypt the files is static in the current script. So if you want to use a different, you have to change the key in the script. You can also (which I highly recommend) implement a remote key retrieval mechanism to get the key from a remote server. This way, you can change the key at any time and the script will always use the current key.

IMPORTANT: There is a static "red flag" defined called _stop.txt This file will be skipped and is there as a placeholder if you need to skip a certain file or directory for some reason.

How to use

Load the file EncryptHorizon.ps1 in a PowerShell session and use the function with the following syntax:

EncryptHorizon -action <Encrypt|Decrypt> [-path <path>]

Both the -action and the -path parameter are mandatory. The -path parameter can be a file or a directory. If it is a directory, the script will encrypt/decrypt all files in the directory and all subdirectories.

Examples

Encryption

File

image

Directory

image

Result

image

Decryption

File

image

Directory

image

Result

image