BASH BOX
Online BASH Shell Script Self Extracting File Generator Tool

Upload a single file Upload a ZIP archive full of files

Name to give the extracted file on the target system?

(can include a relative directory path like "extracted/sample.txt")









The extracted files will be given the same names and relative paths as they have in the ZIP file.









 

What?

A Bash Box is a *nix Bash shell script that, when executed, will create a file (or files) on the target system. This webpage will generate a Bash Box for any file(s) you supply.

The generated script only uses very simple BASH commands (echo, rm, dirname, basename, cp, maketemp, and optionally tr and mkdir) so it should be compatible with even very limited target systems.

The generated script only contains typeable ASCII charactors and line feeds, so you can even cut/paste it into a telnet window to transfer to the target system.

How?

This tool can process either individual files, or a ZIP archive containing multiple files.

If you upload a single file, you must provide a filename and optional path for the extracted file on the target system. Remember to use forward slashes rather than backslashes for a directory separator since the target is a *nix system.

If you upload a ZIP file, the resulting script will use the realtive paths and filenames as they were inside the ZIP file.

All extracted files (and paths) will be relative to the current directory when the script  is run on the target machine unless you check the "Extract to root" checkbox.

Target directories will be created if nessisary.

Single File Examples:

You upload a file specifing "LOGO.PNG" as the target name. You then upload the resulting "extractme.sh" onto the target machine and run it.

If you checked "extract to root on target", then the file "LOGO.PNG" would be created in the root ("/") directory on the target machine.

If you didn't check the box, then the file "LOGO.PNG" would be created in the current directory when you run the script.

ZIP file example:

You upload a ZIP that contains the following files...

\README.TXT
\IMAGES\LOGO.PNG

You then upload the resulting "extractme.sh" onto the target machine and run..

If you checked "extract to root on target", then you'd get..

/README.TXT
/IMAGES/LOGO.PNG

...on the target machine no matter what directory you ran the script from. Note that "/IMAGES" would be created if it did not already exist.

Conversely, if "extract to root" was not checked and you ran the script in the directory "/etc", you'd get...

/etc/README.TXT
/etc/IMAGES/LOGO.PNG

...and again the directory "/etc/IMAGES" would be created if it did not already exist.

The "Escape nulls using the TR command" checkbox will produce a file that specifically escapes out null chars using the TR command rather than just inserting a "\000" into the stream. This is nessisary becuase of a bug in some ECHO command implementations (like BusyBox 1.3) that ignores embeded nulls. If you want to be safe and you know the target system supports the TR command and you don't mind wasting a frew extra chars, go ahead and leave this checked.

You can even use TELNET to transfer the Bash Box file

Becuase the generated file only uses typeable letters, you can get the generated script onto the target machine using just TELNET.

  1. Open the extractme.sh file on your local machine and select the whole file and copy it to your clipboard.
  2. Telenet onto the target system, login and change into a directory where you have write access
  3. Enter the command "cat >extractme.sh"
  4. Do a paste on your local machine to "type" the file into the telnet window. When the paste is finished, press Control-D to end the CAT.
  5. Enter "sh extractme.sh" on the target machine and your binary files will now be extracted on the target machine. It's like magic!

Why?

 Sometimes you really need to get a binary file onto a target system but you do not have access to FTP or file shares.es.

You could use uuencode to pack up the file and then cut/paste it, but many systems do not uudecode on them (particulatly small embeded systems).

The self-extracting scripts that this page generates can help you get your binary file(s) onto almost any target system that you can telnet onto.

While there are other more efficient ways to do this, some require you to be able to move binary data, some need you to have the uudecode utility on the target sytem, and some are just wonderfully complicated. The scripts generated by this page are very simple and straightforward to understand. This is very handy.

History

1/29/2009 - First published to much fanfare.

2/5/2009 - Updated to add the new "extract to root" option. Changed ln to cat to avoid making symlinks when the destination is on a different file system than the tmp directory.

2/6/2009 - Switched from depending echo to printf since echo on BusyBox 1.1.3 apparently doesn't handle nulls correctly but printf seems to. Also now compress some chars that have shorter escape sequences (a linefeed is now stored as "\n" rater than "\0012").

2/15/2009 - Added support for "Escape nulls with TR command" after finding an abnoxious bug in the BusyBox echo command. Changed cat to cp becuase it seems like a btter choice. Also added the name "Bash Box" to the text.

Support Support

support email address image