Oh the power of the shell...

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Oh the power of the shell...

Postby Bazza » Wed May 07, 2014 6:15 pm

The power of the shell got me thinking about obfuscation...
This was originally done on OSX 10.7.5 and tested on PCLinuxOS 2009 and CygWin...

This is a DEMO to use variables only to create a working program.

Yes I know there will be raised eyebrows but this I have found highly interesting.

This is not obfuscated per-se as I have given each alpha-numeric character a similar
alpha-numeric variable...

It certainly is easily crackable but makes for a DEMO of the power of the shell...

Yeah I know it uses "eval" and this example is insecure but it is only a DEMO... ;o)
Just imagine the obfuscation you can create when the variables are obfuscated by reusing them, etc, etc... ;o)

Have fun and enjoy...
Code: Select all
#/bin/bash
# strings.sh
# OSX 10.7.5, default bash terminal.
for n in a b c d e f g h i j k l m n o p q r s t u v w x y z
do
   eval A$n="$n"
done
for n in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
do
   eval A$n="$n"
done
num=0
for n in a b c d e f g h i j
do
   eval B$n="$num"
   num=$((num+1))
done
Bk=' ';Bl='!';Bm='"';Bn='#';Bo='$';Bp='%';Bq='&';Br="'"
Bs='(';Bt=')';Bu='*';Bv='+';Bw=',';Bx='-';By='.';Bz='/'
Ca=':';Cb=';';Cc='<';Cd='=';Ce='>';Cf='?';Cg='@';Ch='['
Ci='\';Cj=']';Ck='^';Cl='_';Cm='`';Cn='{';Co='|';Cp='}'
Cq='~'
# A program using $string format only...
#
# clear
$Ac$Al$Ae$Aa$Ar
# eval name=""
$Ae$Av$Aa$Al$Bk$An$Aa$Am$Ae$Cd$Bm$Bm
# eval age=""
$Ae$Av$Aa$Al$Bk$Aa$Ag$Ae$Cd$Bm$Bm
# eval printf "Enter your full name:-\n"
$Ae$Av$Aa$Al$Bk$Ap$Ar$Ai$An$At$Af$Bk$Bm$AE$An$At$Ae$Ar$Bk$Ay$Ao$Au$Ar$Bk$Af$Au$Al$Al$Bk$An$Aa$Am$Ae$Ca$Bx$Ci$An$Bm
# read name
$Ar$Ae$Aa$Ad$Bk$An$Aa$Am$Ae
# eval printf "Enter your age:-\n"
$Ae$Av$Aa$Al$Bk$Ap$Ar$Ai$An$At$Af$Bk$Bm$AE$An$At$Ae$Ar$Bk$Ay$Ao$Au$Ar$Bk$Aa$Ag$Ae$Ca$Bx$Ci$An$Bm
# read age
$Ar$Ae$Aa$Ad$Bk$Aa$Ag$Ae
# eval printf "Hi Barry Walker, you are 63 years old.\n"
$Ae$Av$Aa$Al$Bk$Ap$Ar$Ai$An$At$Af$Bk$Bm$AH$Ai$Bk$name$Bw$Bk$Ay$Ao$Au$Bk$Aa$Ar$Ae$Bk$age$Bk$Ay$Ae$Aa$Ar$As$Bk$Ao$Al$Ad$By$Ci$An$Bm

Results:-
Code: Select all
Enter your full name:-
Barry Walker
Enter your age:-
63
Hi Barry Walker, you are 63 years old.
AMIGA:barrywalker~> _
73...

Bazza, G0LCU...

Team AMIGA...
User avatar
Bazza
LXF regular
 
Posts: 1476
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Postby IamPete » Fri May 09, 2014 9:42 am

Nice one Bazza.
Like you say it ain't that secure, but I can think of a few uses for it.
IamPete
 
Posts: 14
Joined: Thu Apr 03, 2014 11:34 am

Postby IamPete » Fri May 09, 2014 9:44 am

Forgot to mention, could even "combine" it with an ELF executable and extract certain strings from it.
IamPete
 
Posts: 14
Joined: Thu Apr 03, 2014 11:34 am

Postby lok1950 » Fri May 09, 2014 1:46 pm

BTW chrome reports this post as a phishing site :shock:

Enjoy the Choice :)
User avatar
lok1950
LXF regular
 
Posts: 1031
Joined: Tue May 31, 2005 5:31 am
Location: Ottawa


Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests