Today, I will explain how you can create your own lzm modules & patch the backtrack 2 final ISO file (by adding your new module).
First of all, get a fresh copy of the bt2final.iso file from http://www.remote-exploit.org/backtrack_download.html
Write the ISO file to a CD and boot from the CD. This will load the bt2final version. By default, if you make changes to the live cd, the changes will be lost after rebooting the CD. You can of course install Backtrack to harddisk or a USB stick and install your patches afterwards, but you would still create some scripts to make sure changes to the filesystem are stored and used next time.
So ideally, you would want to include your custom scripts, new tools, updated tools or drivers into the ISO file, so you can use it to either boot from CD (including your own scripts) or install it to harddisk/usb and use your own tools as well.
These tools can be loaded at boot time by converting them into a module and adding the module into the boot process by adding the module into the ISO file.
This is how it works.
First of all, I’ll show you how you can create your own module (lzm file). Basically, there are 2 ways to create a lzm file : either from a directory, or from a source tarball.
Create a lzm file from a directory
Suppose you have a script myscript.sh that needs to be place in /usr/bin. First of all, boot up backtrack Next, create the following folder structure (reflecting the file paths that will be used by your script and script lzm file) :
Next, copy the file(s) into the folder structure. Put the file(s) in the right place within that structure
Create a lzm file from the folder structure
Create a lzm file from a source tarball
If your tool or script needs to be installed/compiled, then there’s another way to create a lzm file :
Boot from the Backtrack CD and put the source tarball on your system. Let’s assume you want to convert “authforce-0.9.8.tar.gz” into a lzm module, but the tool needs to be compiled first
First, extract the files and run the ./configure and make tool
Next, run “checkinstall”. This will automatically launch “make install”, so you don’t have to do it yourself
A tgz file is being generated as result from the checkinstall script.
Finally, convert the tgz package into a lzm file :
[=========================================] 19/19 100%
You are now left with a file called authforce-0.9.8.lzm
Patch the ISO file
After creating your lzm files, you need to put those files on CD. In order to do so, you need to edit the ISO file. Either mount the original ISO file from backtrack or edit the ISO file using a tool such as Magic ISO
The new lzm files need to be placed in the /BT/modules folder. If you use MagicISO, this is as easy as dragging & dropping the files in that folder. Save the ISO file, burn to CD, and you’re done.
If you want to do it from within Backtrack, use the following procedure :
Create a temp folder and mount the ISO file (stored as /tmp/bt2final.iso)
Copy the new module into the BT/modules folder :
Recreate the ISO file :
Scanning ../. Scanning .././BT Scanning .././BT/base Scanning .././BT/configs Scanning .././BT/modules Scanning .././BT/optional … Done with: Directory tree cleanup Block(s) 0 Writing: Extension record Start Block 65 Done with: Extension record Block(s) 1 Writing: The File(s) Start Block 66 1.41% done, estimate finish Fri Mar 9 02:22:37 2007 2.81% done, estimate finish Fri Mar 9 02:22:37 2007 4.21% done, estimate finish Fri Mar 9 02:22:13 2007 5.61% done, estimate finish Fri Mar 9 02:22:19 2007 … Total translation table size: 2048 Total rockridge attributes bytes: 8261 Total directory bytes: 34816 Path table size(bytes): 244 Done with: The File(s) Block(s) 356309 Writing: Ending Padblock Start Block 356375 Done with: Ending Padblock Block(s) 150 Max brk space used 0 356525 extents written (696 MB)
Now write the new ISO file and you’re ready to rock ‘n roll again
Links : http://backtrack.offensive-security.com
Tags:
© Corelan Consulting BV. All rights reserved. The contents of this page may not be reproduced, redistributed, or republished, in whole or in part, for commercial or non-commercial purposes without prior written permission. See the Terms of Use and Privacy Policy for details.