Linux Mint Bash Password & Security Plus SHC & Compiling

View previous topic View next topic Go down

Linux Mint Bash Password & Security Plus SHC & Compiling

Post by jamied_uk on 1st June 2017, 16:59

Linux Mint Bash Password & Security Plus SHC & Compiling Example






The file.exx part didnt execute as expected but left all this in so you can see how to compile a exe file, also is a function for easy compiling.

you can run the obfuscated script and that works on linux no problem so the the receiver you can send the .dat file plus the .c.x file you also want to make sure the dat file cannot be changed after the fact and thus changing the password hash, I left this up to you to think about but remember it uses a static salt that only receiver and sender should know and the file is suppose to be auto removed if wrong password, but an attacker could copy the dat file before it is removed and it might even fail to delete, again this is up to you to test and make better / work for linux etc, as the attacker could copy the dat file it could be brute forced but it will slow them down allot if you make the file auto delete itself along with the dat file.
you should think about how to now encrypt the dat file for even more security!

Download

app.box.com/s/psx9mkwco1ivm4mpmhf1vwqzrgxisnqp

https://app.box.com/s/psx9mkwco1ivm4mpmhf1vwqzrgxisnqp
avatar
jamied_uk
Admin

Posts : 2260
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Linux Mint Bash Password & Security Plus SHC & Compiling

Post by jamied_uk on 1st June 2017, 18:11

Bash Code Timing




More Links


Took 2 questions 1 each from 2 forums and
made a script to solve both problems in 1.


stackoverflow.com/questions/385408/get-program-execution-time-in-the-shell

and another one google it Smile

encrypted.google.com/search?q=bash+script+to+measure+speed+times+of+running+scripts&ie=utf-8&oe=utf-8
avatar
jamied_uk
Admin

Posts : 2260
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Linux Mint Bash Password & Security Plus SHC & Compiling

Post by jamied_uk on 5th June 2017, 22:56

Self Removing Upon Wrong Password




Code



Code:
#!/bin/bash
# Usage: ./Create.sh "Password"
#var="$1"
#
# sudo apt install -y shc
#
#  out.dat is required aswell as Check.sh for this test script to work!
#
echo "Test!"
echo "Enter Password"
read pass
mkpasswd -m sha-512 --salt=XYZ01234567890 "$pass" > o.dat
# Now compare o with out.dat to see if password hash is the same!
# 1st read in the files as vars
xxx0=`cat o.dat`
xxx1=`cat out.dat`
# compare!


if [ $xxx0 == $xxx1 ]; then
  echo "Password Is Correct"
# echo secret message here
  echo "Attack @ Dawn 4 example"
else
  echo "Password Is Wrong!!!!"
# you can delete file here for security
  rm Check.sh.x.c
  rm o.dat
  rm out.dat
  rm Check.sh.x
fi
avatar
jamied_uk
Admin

Posts : 2260
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Linux Mint Bash Password & Security Plus SHC & Compiling

Post by jamied_uk on 6th June 2017, 01:19

Linux Mint 18 Self Destructing Bash Message Code Example



Example Password is:
PasswordTest


./Create.sh "PasswordTest"

Code:
#!/bin/bash
# Usage: ./Create.sh "Password"
var="$1"
echo "Test!"
# Salt has to be min 8 chars!!!
mkpasswd -m sha-512 --salt=XYZ01234567890 "$var" > out.dat
cat out.dat


./Check.sh



Code:
#!/bin/bash
# Usage: ./Create.sh "Password"
#
# sudo apt install -y shc
#
#  out.dat is required aswell as Check.sh for this test script to work!
#
echo "Test!"
echo "Enter Password"
read pass
mkpasswd -m sha-512 --salt=XYZ01234567890 "$pass" > o.dat
# Now compare o with out.dat to see if password hash is the same!
# 1st read in the files as vars
xxx0=`cat o.dat`
xxx1=`cat out.dat`
# compare!


if [ $xxx0 == $xxx1 ]; then
  echo "Password Is Correct"
# echo secret message here
  echo "Attack @ Dawn 4 example"
  echo ""
  echo "Message Will Self Destruct In 5"
  sleep 5
  # Delete Code Here!
  rm Check.sh.x.c
  rm o.dat
  rm out.dat
  rm Check.sh.x
  echo "Deleted!"
 
else
  echo "Password Is Wrong!!!!"
# you can delete file here for security
  rm Check.sh.x.c
  rm o.dat
  rm out.dat
  rm Check.sh.x
fi


Make_Bin.sh


Code:
#!/bin/bash
#
LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH
export LIBRARY_PATH
# sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
# sudo aptitude install -y gcc-multilib
# Usage ./Make_Bin.sh "Check.sh"
#
#sudo apt install -y shc libc6-dev-amd64
#
#shc [ -e date ] [ -m addr ] [ -i iopt ] [ -x cmnd ] [ -l lopt ] [ -ACDhTv ] -f script
shc -f "$1"
# -x=exec '%s' "$@"

# .sh.x is the encrypted shell script in binary format
avatar
jamied_uk
Admin

Posts : 2260
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Linux Mint Bash Password & Security Plus SHC & Compiling

Post by jamied_uk on 7th June 2017, 23:27

For my compile function (in .bashrc)


Code:
function compile() {
LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH
export LIBRARY_PATH
sudo apt-get install -y libc6-dev-amd64
# Usage compile file.c
myvar="$@"
gcc -o file.exe "$myvar"
sudo chmod +x file.exe
echo "All Done!"
}
avatar
jamied_uk
Admin

Posts : 2260
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Linux Mint Bash Password & Security Plus SHC & Compiling

Post by jamied_uk on 7th June 2017, 23:45

Unscrambling The Script




Code:
git clone https://github.com/yanncam/UnSHc.git



move the unshc.sh file to a better location like i did.


Code:
./unshc.sh -o New.sh Check.sh.x





   ^ execute   ^ New File  ^ Old scrambled file!
avatar
jamied_uk
Admin

Posts : 2260
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Linux Mint Bash Password & Security Plus SHC & Compiling

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum