Please take a moment to read, to help share the message and support the initiative to tell our leaders to focus on addressing the global world problems, instead of complaining about the effects of their lack of leadership. Be a leader yourself, and share this with as many people as possible. #demandglobalchange //

Please consider donating:


Creating and installing lzm modules in Backtrack 2

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

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 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) :

bt ~ # cd /tmp
bt tmp # mkdir MODULE
bt tmp # mkdir -p MODULE/usr/bin

Next, copy the file(s) into the folder structure. Put the file(s) in the right place within that structure

bt tmp # cp MODULE/usr/bin

Create a lzm file from the folder structure

bt tmp # dir2lzm MODULE/ module.lzm
[======================================================================] 1/1 100%
bt tmp #
bt tmp # ls -l module.lzm
-r——– 1 root root 4096 Feb 27 11:30 module.lzm



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

bt ~ # tar zxpf authforce-0.9.8.tar.gz
bt ~ # cd authforce-0.9.8
bt authforce-0.9.8 # ./configure
bt authforce-0.9.8 # make

Next, run “checkinstall”. This will automatically launch “make install”, so you don’t have to do it yourself

bt authforce-0.9.8 # checkinstall

Creating package authforce-0.9.8-i386-1…OK

A tgz file is being generated as result from the checkinstall script.

Finally, convert the tgz package into a lzm file :

bt authforce-0.9.8 # tgz2lzm authforce-0.9.8-i386-1.tgz authforce-0-9-8.lzm
Installing package authforce-0.9.8-i386-1…
authforce: Package created with checkinstall 1.5.3
Executing install script for authforce-0.9.8-i386-1…

[=========================================] 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)

bt tmp # mkdir /tmp/INSTALL
bt tmp # mkdir /mnt/iso
bt tmp # mount -o loop -t iso9660 /tmp/bt2final.iso /mnt/iso
bt tmp # cp -rf /mnt/iso/* /tmp/INSTALL/

Copy the new module into the BT/modules folder :

bt tmp # cp /tmp/module.lzm /tmp/INSTALL/BT/modules


Recreate the ISO file :

bt tmp # cd INSTALL/BT/
bt BT # ./
Target ISO file name [ Hit enter for ../../BT.iso ]: /tmp/bt2final-mod.iso
mkisofs 2.01 (i686-pc-linux-gnu)

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 :

2007 – 2015, Corelan Team (corelanc0d3r). All rights reserved.

Related Posts:

Comments are closed.

Corelan Live training

Since 2011, Corelan GCV has been teaching live win32 exploit dev classes at various security cons and private companies & organizations.

You can read more about the training and schedules here

Demand Global Change

The world needs your help !

Please take a few moments to read the "Demand Global Change Call For Action" document at
Read the full document at and share the message with as many people as possible.

Like the Facebook page, and SHARE it with everyone you know.


Want to support the Corelan Team community ? Click here to go to our donations page.

Want to donate BTC to Corelan Team?

Your donation will help funding server hosting.

Protected by Copyscape Web Plagiarism Tool

Corelan Team Merchandise

You can support Corelan Team by donating or purchasing items from the official Corelan Team merchandising store.

Corelan on IRC

You can chat with us and our friends on #corelan (freenode IRC)