diff --git a/README.md b/README.md new file mode 100644 index 0000000..38aedba --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# KNOT & UNKNOT +`knot` and `unknot` are simple bash script wrapper for 7zip. +Just wanted a quick (lazy) way to simple compress and encrypt a file or group of files. Who has time to remember more command arguments? XD +Same process to uncompress/decrypt. +It uses AES256 (7zip default for .7f files), encrypt files headers to hide file structure and it deletes original files after completing the job. + + +## USE: knot +`knot [file|folder|file1 file2 folder3...]` +* Type output filename [first filename as default] +* Type password, repeat. +* Profit + +## USE: unknot +`unknot [file.7z]` +* Type your password +* Profit + +## EXAMPLE + +$# `ls` +file1 file2 file3 folder1 folder2 + +$# `knot file1 file3 folder2` +Output filename [file1]: myfiles +Enter your password: password@1 +Repeat your password: password@1 + +$# `ls` +file2 folder1 myfiles.7z + +$# `unknot myfiles.7z` +Enter your password: password@1 + +$# `ls` +file1 file2 file3 folder1 folder2 + +## INSTALLATION +`curl https://git.zhconsultores.com/oswaldo/Cifrar/raw/branch/master/installer.sh | bash` + +## REQUIREMENTS +* Debian buster / Ubuntu 18 or older +* MacOS (brew installed, tested on Monterey) +* Manjaro diff --git a/installer.sh b/installer.sh new file mode 100644 index 0000000..e9e2e40 --- /dev/null +++ b/installer.sh @@ -0,0 +1,53 @@ +#!/bin/bash +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +set -e +touch /tmp/knotinstaller.log +LOG=/tmp/knotinstaller.log + +if [ -n "$(command -v knot)" ]; then + echo "Uninstalling existing versions..." + echo "" + rm /usr/local/bin/knot + rm /usr/local/bin/unknot +fi + +clear +echo "Installing dependencies..." +echo "" +# Debian / Ubuntu +if [ -n "$(command -v apt-get)" ]; then + apt-get update -y >> $LOG 2>&1 + apt-get install -y p7zip-full >> $LOG 2>&1 + echo "Downloading Binaries..." + echo "" + wget https://git.zhconsultores.com/oswaldo/Knot/raw/branch/master/bin/Debian/knot >> $LOG 2>&1 + wget https://git.zhconsultores.com/oswaldo/Knot/raw/branch/master/bin/Debian/unknot >> $LOG 2>&1 + +elif [ -n "$(command -v pacman)" ]; then + pacman -Sy >> $LOG 2>&1 + pacman -S --noconfirm p7zip >> $LOG 2>&1 + echo "Downloading Binaries..." + echo "" + wget https://git.zhconsultores.com/oswaldo/Knot/raw/branch/master/bin/Manjaro/knot >> $LOG 2>&1 + wget https://git.zhconsultores.com/oswaldo/Knot/raw/branch/master/bin/Manjaro/unknot >> $LOG 2>&1 + +elif [ -n "$(command -v brew)" ]; then + brew update >> $LOG 2>&1 + brew install p7zip >> $LOG 2>&1 + echo "Downloading Binaries..." + echo "" + wget https://git.zhconsultores.com/oswaldo/Knot/raw/branch/master/bin/MacOS/knot >> $LOG 2>&1 + wget https://git.zhconsultores.com/oswaldo/Knot/raw/branch/master/bin/MacOS/unknot >> $LOG 2>&1 + +else + echo "Dependency not found: [apt|pacman|brew]" + exit 1; +fi + +echo "Installing Binaries..." +chmod +x {knot,unknot} +mv {knot,unknot} /usr/local/bin/ +echo "" +echo "DONE!" + diff --git a/knot.sh b/knot.sh new file mode 100644 index 0000000..20b7174 --- /dev/null +++ b/knot.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +filename=$1 + +while [ -z "$SALIDA" ]; do + read -p "Output filename: (press enter for [${filename}]): " SALIDA + : ${SALIDA:=${filename}} +done + + +7z a -p -mx=9 -mhe -t7z -sdel ${SALIDA}.7z "$@" diff --git a/unknot.sh b/unknot.sh new file mode 100644 index 0000000..022fd07 --- /dev/null +++ b/unknot.sh @@ -0,0 +1,3 @@ +#!/bin/zsh +filename=$1 +7z x ${filename} && rm -rf ${filename}