Tuesday, December 18, 2012

How to - execute shell scripts on your Android phone

Hi All,

This post explains how to run simple shell scripts on your android phone...

Assume we have a script that generates odd numbers b/w 1 to 10

Here is the script:

i=1
echo $i

while [ $i -lt 9 ]
do
       i=`echo $(($i+2))`
       echo $i
done

Type this content onto a shell (a text file with a .sh extension) using an App called TextEdit written by Paul Mach.

Save the file (test.sh) in your external sd card root folder.

Then you need a shell to run this script.

Download an app called Terminal Emulator from the Google Play store.

So we are set to run our script...

Steps:

1. Open the emulator
2. Give the below commands:

     cd sdcard
     cd external_sd
   
     sh test.sh

3. If there are any errors, you can fix them using the TextEdit once more. Save it and re-run!!

Note:

1. This procedure will work for both rooted and not-rooted phones.
2. The script uses echo command instead of expr command.
3. Since the phone I used to run this script is not rooted - I had to save my files to the card.

Hope you enjoyed scripting on your Android,
Ananth G S


Friday, December 14, 2012

Start-up sound of Nimblex on Debian 5 using Sun Virtualbox

Hi All,

Was playing around my Lenny trying to tweak some of the things that I used to do in the past.....

I installed Nimblex on my old laptop which was on Debian 5. Of course I did not want to touch the god (Debian) - so only used Virtualbox (older version and not the new one from Oracle)

I fell in love with the start up sound of Nimblex. So I wanted to get the same sound to my Debian 6 on my other laptop.

So heres what I did....

1. First enable sound (Direct OSS or Direct ALSA) on Virtualbox
2. i.e take sound from host OS.
3. Open the terminal and run the command to copy the sound startup file.

Alt F2 (Run prompt)

Type gnome-terminal

Then as su-

cp /usr/share/sounds/startup/startup.ogg . 

I copied the startup file to the current directory (~ of Debian 5)

Then

cp startup.ogg /share/ (I had shared a folder in Virtualbox)

Press Left Control key to go back to the host OS (Debian 5 from Nimblex)

cp /share/startup.ogg/ /media/sdb1/ (Copy the shared file to my pen drive)

Now finally on my other laptop (running Debian 6)

Issue the command -

cp /media/sdb1/startup.ogg /usr/share/sounds/

Last enable login sounds in Debian 6.

Hope you too can manipulate your startup-sound files in your distros from these simple commands...

Tc ,
Ananth S Gouri






fdisk - you can lose your disk

Hi All,

fdisk is a command line partition tool for *nix systems.

The fdisk tool is the default tool even till today in many UNIX and LINUX distributions. For ex: freebsd, netbsd, openbsd and Slackware till 12.0 versions.

Ok so what is the big deal using fdisk?

Though fdisk is a wonderful tool - but if the user does not know its options - the probability of losing all the data or even the full partitions of the disk is very high.

One such problem this post discusses is:

fdisk shows the size of all partitions by default in bytes.

If a user plans to install a new distro onto a partition - first thing after backup of data is to know its exact size.

But knowing the partition size in a hard disk when the tool shows in bytes is a pain....

Trying to understand 100 GB is how much of bytes could be simple but indeed calculation to that extent is not required. Also when the user want to resize that 100Gb into 40 GB 2 partitions - then doing everything wrt bytes is a task better not to attempt!!!

Solution:

By pressing Z key in fdisk - fdisk toggles b/w different file sizes. So after bytes, the same partition is shown wrt KB, MB and GB when Z key is used (3 times)

Hope this helped :)

Thanks & enjoy,
Ananth S Gouri

Command Line Steganography in LINUX

Hi All,

So what is steganography?? I would not want to waste time in explaining all you want about this but yet give high regards to www.google.com :P [google it out]

So what could be the command to hide data using Linux command line??

Trying to send data - a gif image in an encrypted form? Finding it difficult to find free steganography tools based out on *nix? Dont worry...

This very simple command should do it all...

Step(s):

We shall assume that we have created a dummy zip file through which we send across data (here the image)

The command is:

cat dummy.zip >> rogue.gif

The data image is embedded in this format...

Plz note:

1. Normal decompress softwares like winzip, 7 zip et al may not open the file at all.
2. pkzip check once to see if you can retrieve the image.
3. use winrar based softwares in Windows or use unrar (non-free versions) in LINUX.

Thats it... Enjoy :)

Happy data hiding,
Ananth S Gouri