Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Oh the power of the shell...

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
Bazza
LXF regular


Joined: Sat Mar 21, 2009 11:16 am
Posts: 1476
Location: Loughborough

PostPosted: Wed May 07, 2014 7:15 pm    Post subject: Oh the power of the shell... Reply with quote

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:
#/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:
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...
Back to top
View user's profile Send private message
IamPete



Joined: Thu Apr 03, 2014 12:34 pm
Posts: 14

PostPosted: Fri May 09, 2014 10:42 am    Post subject: Reply with quote

Nice one Bazza.
Like you say it ain't that secure, but I can think of a few uses for it.
Back to top
View user's profile Send private message
IamPete



Joined: Thu Apr 03, 2014 12:34 pm
Posts: 14

PostPosted: Fri May 09, 2014 10:44 am    Post subject: Reply with quote

Forgot to mention, could even "combine" it with an ELF executable and extract certain strings from it.
Back to top
View user's profile Send private message
lok1950
LXF regular


Joined: Tue May 31, 2005 6:31 am
Posts: 1030
Location: Ottawa

PostPosted: Fri May 09, 2014 2:46 pm    Post subject: Reply with quote

BTW chrome reports this post as a phishing site Shocked

Enjoy the Choice Smile
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast