Getting the BackTrack menu structure (and tools) in Ubuntu

UPDATE [11-7-2010]: It is *best* to use the actual BackTrack distribution due to the patches and optimizations they make to the kernel. Patching the standard Ubuntu kernel would make it no longer *Ubuntu*. I’d highly suggest you either:

  1. Install BackTrack on a real or virtual machine environment
  2. Manually download and install the security tools you need to use on your system.


I recently outlined how to install all the BackTrack tools on your Ubuntu system. It’s a pretty easy process these days because BackTrack is Debian based. However, by default, BackTrack uses KDE, and therefore all of the tools, when installed in Ubuntu with Gnome show up in the “Other” folder as just one big really long list of tools.

There also were problems with launching the tools from the menu, because often times you’d get the error message below:

That’s not very helpful, so I have done a little work and gotten the BackTrack tools AND menu structure within Ubuntu 9.10. I’ve also written a Perl script that will fix the error message above.

So, here’s a brief overview of the steps in this lengthy blog post:

  1. Prepare the GNOME menu with the appropriate BackTrack menu structure
  2. Install BackTrack 4 tools within Ubuntu
  3. Run a Perl script to update the newly created menu entries so that they will launch a terminal correctly within Ubuntu

Here’s a quick preview of the finished product:

BackTrack 4 Menu in Ubuntu!

NOTE: This involves modifying your current GNOME menu settings, and could cause issues with your menu if done incorrectly. Make a backup first, and note that this worked on my system, but your mileage may vary!

The first step before installing any of the tools is to prepare the GNOME menu. Open up a shell:

sudo cp /etc/xdg/menus/ /etc/xdg/menus/
sudo geany /etc/xdg/menus/

Note that I am using the application Geany, which is a programmer’s editor for Linux, much like Notepad++ for Windows. You can use gedit if you’d prefer, but Geany may help you in modifying this XML file because it offers code folding and syntax highlighting.

If you opened it with Geany, click on the Document menu, Select Set Filetype, select Markup Languages, and then finally select XML Document.

Select file type within Geany

With Geany, I find it easiest to collapse the menu blocks for the other sub-menus within Gnome’s Applications menu.

After collapsing the System Tools section, paste the following XML directly after it. This will define the BackTrack menu’s and submenu’s:

Adding BackTrack menu structure with Geany

NOTE that because of the length, I have moved the XML code to a new post. Please obtain the BackTrack menu XML from this post.

After updating this with the BackTrack XML, you may now save and close the document.

At this point, we can follow the instructions in my previous post to install the BackTrack utilities.

Let’s begin by launching a root bash shell by typing:

sudo bash

The next step is to add the BackTrack repositories to your apt-get sources.list file:

1. Add the Backtrack repository:

sudo echo deb binary/ >> /etc/apt/sources.list

2. Import the Backtrack PGP key and update your sources (and set a proxy server to use if you need it):

export http_proxy=""
wget && sudo apt-key add public-key && sudo aptitude update

3. Build your package list (NOTE that I am specifying a proxy server — remove this part from the command if you do not use a proxy):

links -http-proxy -dump | awk '{print $3}' | grep -i deb | cut -d . -f 1 > backtrack.txt

If you do not use a proxy server, then the command will look like this:

links -dump | awk '{print $3}' | grep -i deb | cut -d . -f 1 > backtrack.txt

4. Install packages:

for i in $(cat backtrack.txt); do sudo aptitude -y install $i; done

Credit for the BackTrack menu settings goes to or4n9e at Remote Exploit’s forums.

Next, we need to run a Perl script to ensure that the newly installed applications can be correctly executed from our GNOME Applications menu.

Copy the following code and save it to a file. I saved mine to a file called

# Written by Mick Grove
#  [v0.1]		11/20/2009
# BSD Licensed
#       Redistribution and use in source and binary forms, with or without
#       modification, are permitted provided that the following conditions are
#       met:
#       * Redistributions of source code must retain the above copyright
#         notice, this list of conditions and the following disclaimer.
#       * Redistributions in binary form must reproduce the above
#         copyright notice, this list of conditions and the following disclaimer
#         in the documentation and/or other materials provided with the
#         distribution.
#       * Neither the name of the  nor the names of its
#         contributors may be used to endorse or promote products derived from
#         this software without specific prior written permission.
use strict;
use warnings;
use Tie::File;

my $dir     = "/usr/local/share/applications";
my $section = "Desktop Entry";
my $in_section;
my @files;

opendir(BIN, $dir) or die "Can't open $dir: $!";
while (defined(my $file = readdir BIN))
    next if $file =~ /^\.\.?$/;    # skip . and ..
    if ($file =~ m/.*\.desktop$/i)
        push(@files, $file);

foreach my $curfile (@files)
    open( FH, "<", "$dir/$curfile" ) or die "$!";
    chomp( my @fileparts =  );

    my $termval = TerminalStatus(\@fileparts);
    next if $termval eq 0;    # skip if this is not a terminal application

    #lets see if this is actually a BT program
    my $btprogram = IsBTProgram(\@fileparts);
    next if $btprogram == 0;    # skip if this is not a BT application

    my $ExecKey     = "Exec";
    my $TerminalKey = "Terminal";
    my @tiedfile;

    #open this file for editing
    tie @tiedfile, 'Tie::File', "$dir/$curfile" or die "$!";

    #read file line by line here
    # updating "Exec" line
    foreach my $fline (@tiedfile)
        next if $fline =~ /^#/;       # skip comments
        next if $fline =~ /^\s*$/;    # skip empty lines

        if ($fline =~ /^\[$section\]$/)
            $in_section = 1;

        if ($fline =~ /^\[/)
            $in_section = 0;

        my $oldline;
        my $updatedline;
        if ($in_section and $fline =~ /^$ExecKey\s*=\s*(.*)$/)

            # this means we have the "Exec key"
            $oldline = $1;
            next if $oldline =~ m/^.*xterm -e.*;bash.*$/i;    #skip
            $oldline =~ s/"/\\"/img;
            $updatedline = "Exec=xterm -e \"$oldline;bash\"";
            $fline       = $updatedline;

            print "New exec: " . $fline . "\n";
        elsif ($in_section and $fline =~ /^$TerminalKey\s*=\s*(.*)$/)

            # this means we have the "Terminal key"
            # we will set it to "0" to turn it off --- we are launching
            #   xterm ourselves, if we set to 1, we'll get an extra
            #   terminal opened
            $oldline     = $1;
            $updatedline = "Terminal=0";
            $fline       = $updatedline;

    untie @tiedfile;

print "\n\nAll menu entries have been updated\n";

### Subroutines ###
sub TerminalStatus
    my @lines       = @{$_[0]};
    my $TerminalKey = "Terminal";
    my $ExecKey     = "Exec";
    my $termkeyval  = 0;            #default = 0 FALSE, 1= TRUE
    my $i           = 0;
    my $execkeyval = 0;  #default = 0 = this exec line probably wasn't set by us

    foreach my $fline (@lines)
        next if $fline =~ /^#/;       # skip comments
        next if $fline =~ /^\s*$/;    # skip empty lines

        if ($fline =~ /^\[$section\]$/)
            $in_section = 1;

        if ($fline =~ /^\[/)
            $in_section = 0;

        if ($in_section and $fline =~ /^$TerminalKey\s*=\s*(.*)$/)

            # this means we have the "terminal key"
            $termkeyval = $1;
            next;    #last;

        if ($in_section and $fline =~ /^$ExecKey\s*=\s*(.*)$/)

            # this means we have the "exec key"
            $execkeyval = $1;
            if ($execkeyval =~ m/^.*xterm -e.*;bash.*$/i)
                $execkeyval = 1;    # this script likely set this value before
            next;                   #last;

    if ($execkeyval eq 1)
        # force this to true, because this can be updated by this script,
        #   b/c we appear to have modified this entry before.
        $termkeyval = 1;
    return $termkeyval;

sub IsBTProgram
    my @lines    = @{$_[0]};
    my $key      = "Categories";
    my $isbtprog = 0;              #default = FALSE = 0
    my $i        = 0;
    foreach my $fline (@lines) {
        next if $fline =~ /^#/;       # skip comments
        next if $fline =~ /^\s*$/;    # skip empty lines

        if ($fline =~ /^\[$section\]$/) {
            $in_section = 1;

        if ($fline =~ /^\[/) {
            $in_section = 0;
        if ($in_section and $fline =~ /^$key\s*=\s*(.*)$/)

            # this means we have the "terminal key"
            if ($1 =~ m/.*BT-.*/i)
                $isbtprog = 1;
    return $isbtprog;

I saved that file to my home folder at /home/mick

Next we need to run the script, but first we will backup all menu files in case something goes wrong. Open up a terminal:

cd ~/
mkdir menu_backup
sudo cp /usr/local/share/applications/* ~/menu_backup

Now we have made a backup of the menus, so it is safe to run our Perl script now:

sudo perl ./

That’s it! Your BackTrack tools (with menu structure) are ready to use within Ubuntu!

If for some reason there was a problem with executing the Perl script or your menu isn’t working, you can copy the backed up menu items to their original location:

sudo cp ~/menu_backup/* /usr/local/share/applications/

115 thoughts on “Getting the BackTrack menu structure (and tools) in Ubuntu

  1. After installing all the tools, you still have to find some depends for ex. and so on… and you might need some kernel patches that backtrack use… so the point of installing all the tools is… well not so big..


      1. Thanks a lot for this guide!
        Since BT4 uses its own kernel patches and optimizations, I was wondering if you have any hints on how to replace Ubuntu’s default kernel with BT4’s latest kernel? (I mean, do they have a repo for their kernel or do we have to get their .config from BT’s CD and recompile?)

      2. I was wondering if you have found a solution? I’d love to use BT’s tools on Ubuntu 9 (or even 10 in a few months) instead of that crappy intrepid/KDE3… but figuring out what dependencies are needed and patching the kernel looks like a lot of work…

    1. Yes, they should be the same. However, if you have problems this guide does outline how to backup your menu settings and restore them.

    1. What does not using a proxy have to do with Ubuntu Netbook Remix menu? The problem I’m getting is after everything is said and done, I get a Backtrack menu that is just a period. When I click on the menu item, it lists all of the utilities but within no folders or anything.

      1. I was not replying to you, just making a note of that to anyone who has never used “links”.

        About your menu problem. I would run the backup the rerun the pearl script. You probably could put Ubuntu on your netbook. It runs fine on my EeePC 900A.

  2. ducdm :
    I got the below error during run file I’m using Ubuntu 9.10.
    Argument “false” isn’t numeric in numeric eq (==) at line 66.
    All menu entries have been updated

  3. Thank you for making this tutorial, after applying the perl script (with no errors in terminal) everything works great! thank you,

    SWFintruder gets the child proccess error, can i fix this? with Geany?:)

  4. Thank you for making this tutorial!

    After applying the perl script (with no errors in terminal), my applications seem to have just gone i.e. I click applications nothing happens.

    I tried copying the backed up menu items to their locations using
    sudo cp ~/menu_backup/* /usr/local/share/applications/, but to on avail.

    Please advice

  5. ducdm :

    ducdm :
    I got the below error during run file I’m using Ubuntu 9.10.
    Argument “false” isn’t numeric in numeric eq (==) at line 66.
    All menu entries have been updated

    I am having the same issue here, I have followed it up to the letter and so far everything looks great, but getting this one final error. please help. so close.

  6. What would need to change in the file for programs to launch in gnome-terminal and not xterm? I tried to just change the xterm to gnome-terminal at line 107 (left the -e the same, and also changed it to -x), but i get the error “child process….”. Could you show how to launch the apps in gnome-terminal?

  7. Browny : Is it just me or does not respond? Is it just me czy repo.offensive-nie odpowiedzieć? Tried to connect many times. Próbował połączyć wiele razy. no success bez powodzenia

    i have same problem…

  8. I also get the error:

    Argument “false” isn’t numeric in numeric eq (==) at line 66.
    All menu entries have been updated

    Any ideas on how to solve it?

  9. for the step:

    export http_proxy=”″

    wget && sudo apt-key add public-key && sudo aptitude update

    i get the following:

    Connecting to||:80… failed: Connection timed out.

    it does this multiple times, and has yet to work. also, if i’m not using a proxy server, do i simply eliminate the first line of code? this may be an obvious question, but i am quite new to ubuntu and have no idea what im doing… ill learn:)


  10. same issue here guys, i hope some one will be able to help, best regards
    wget && sudo apt-key add public-key
    –2010-02-24 09:52:50–
    Connecting to||:80… connected.
    HTTP request sent, awaiting response… 504 Gateway Timeout
    2010-02-24 09:56:00 ERROR 504: Gateway Timeout

  11. I am stuck here and getting the following:

    root@ubuntu:~# links -dump | awk ‘{print $3}’ | grep -i deb | cut -d . -f 1 > backtrack.txt
    The program ‘links’ is currently not installed. You can install it by typing:
    apt-get install links
    links: command not found

    Not familiar with links.

    1. Tom,

      When it says:

      The program ‘links’ is currently not installed. You can install it by typing:
      apt-get install links
      links: command not found

      The ‘links’ app is not installed and is pointing you to do the command of ‘apt-get install links’ and by doing that you are installing the ‘links’ program.

  12. Mick,

    I’ve been able to get the new repository source added and working (, and I can install packages manually with apt-get or synaptic, but I am stuck following step 3 of your tutorial. The links command is broken now and substituting the new repo address does not seem to fix it. Can you post a sample backtrack.text file so I can see what the file should look like, so that I can (hopefully) replicate it with the new repositories? Any help you can give is appreciated.


  13. root@m42h21-laptop:#perl
    Argument “false” isn’t numeric in numeric eq (==) at line 66.
    Argument “false” isn’t numeric in numeric eq (==) at line 66.

    All menu entries have been updated

    is this normal ??

  14. FYI, I’m working on an updated guide. I hope to have it done soon. So far, things are mostly working, just working out a few kinks.

    1. You can’t just do it that way, it doesn’t make sense any more. I haven’t used Linux in 10 years (i.e. it’s been so long that everyone used Slackware then), and am not having much trouble getting it to work (under Ubuntu installed on a huge flash drive, no less) by making intuitive changes to this guide. Instead of that whole mess starting with “links” (which in and of itself was a bitch to install and turned out to be unnecessary), just wget and do what you want with the result – probably just grep Package, then use cut to remove everything before the colon, dead easy.

  15. damn, spoke too soon. had to leave the mass apt-get update/upgrade going overnight and after coming back, restarting and sorting out the various resulting issues (not BT-related), I’m only seeing Backtrack->Information Gathering->[All> and Maltego 2.0.2 CE]😦
    pretty much have to leave SPM open to have a convenient list of all the BT tools I currently have installed, now, but this is still a great start. thanks, would have had no idea where to begin otherwise – I can’t just use BT because of a screwy issue with its kernel inherently being too old to support the Intel Wireless 1000 because of currently available firmware, and obviously it is tricky to upgrade.

    also, when you’re able to finish revising this, Aquire/Aquisition etc. is spelled starting with “Acq”:)

    1. Simply going the route that you outlined has caused problems for me. I initially planned to do it this way but it was not successful. I’m still working to get the new guide updated, but have not had much time lately to devote to it.

      The problem is that this will never be a 100% replacement for BackTrack, due to some of the modifications/patches to the kernel made in the official BT distribution.

  16. IMO it’s not a problem, as only two categories of people would want to install pentesting tools – pentesters, and wannabe crackers (script kiddies). Surely it shouldn’t be a problem for any pentester to apply the patches found on the aircrack website and recompile their kernel. The whole operation only took me about 20 minutes on my pc.

    1. I think you missed the point, which is simply that BT is its own distribution, i.e. if you have all the tools installed but you’re not running BT then you’re not running BT… or you’re running what amounts to BT with a ton of other crap installed, rather than debian or ubuntu or whatever.

      Surely you also realize that what you’re suggesting is security through obscurity, right? Many (maybe even the majority) of the tools included in BT also have some legitimate interest for a lay audience, and it seems to me that most script kids wouldn’t be interested in the entire package in the first place.

      1. I was replying to Mick. I simply stated that if his guide cannot be “a 100% replacement for BT” it shouldn’t be a problem for computer security professionals who just need a quick way to add up-to-date security tools to their distro of choice, and don’t care about your true-BT vs fake-BT-with-crap-installed purism. What has this to do with security through obscurity? Bah, whatever.

  17. Argument “false” isn’t numeric in numeric eq (==) at ./ line 66.

    All menu entries have been updated

    i got this msg after runing the perl script
    so i got no backtrack menu and no tools

  18. Mick,

    I was just wondering when/if you still plan on having a new tutorial available for installing BT4 on Ubuntu with the updated repositories? I really like your previous write-up and am interested in seeing if I can get it working again on my new system. -Thanks for the great work!

  19. I usually never post comments on blogs, but I found this post after digging and Googling for hours (to find precisely what I needed). I am very happy to have found this tutorial. I know there are others who feel the same. I have bookmarked this page because I am anxiously awaiting your newest update that includes the newest repositories. Also, I am curious to know if you will update again after Lucid Lynx Final is released April 29th? Thanks so much!

      1. C’mon Mick! You’re our only hope!😉 Ok, I guess we could go out and try to find the PGP key link ourselves, but you’ve done so much already. Please let me know when you have the time to update the guide. If you need help and can point a few people in the right directions, maybe others could help? The repository address update was good … but still can’t find that darn PGP (GPG) key.

  20. Hi !

    Please make another tutorial about how to do this on Ubuntu LTS 10.04 and try to modify that perl script to use gnome terminal instead of xterm !
    Also,in Backtrack 4 the user is is root and it is not necessary anymore to write the password for root every time he is trying to run a Backtrack script (tool). Could you solve this problem, please, because I think it is useless to install all Backtrack tools on Ubuntu since you cannot run any of them without writing the root password ? (I think if this problem is not solved many real hackers/pentesers will prefer using Backtrack OS because of this it is faster and speed is needed. )

    Thank you in advance !

    PS: Expecting your answer !

  21. Update: I’ve forgot to say that the menu structure and perl script don’t work on newly Ubuntu 10.04. Also I’ve tried to modify that file which you are saying about and then install the tools but the menu structure still unchanged.
    Second, it gives me that error: Argument “false” isn’t numeric in numeric eq (==) at ./ line 67. when trying to run the perl scipt. I please you to fix that also if don’t bother.

    Thanks !

  22. Hi, thanks for this guide. I was wondering if it could work (if modified) under Debian GNU/Linux 4(Lenny) too, Backtrack is based on Debian if I’m right.

  23. Hey,
    Nice Job.
    I have one big problem thou. i cant connect to the link. it seems like that they moved the site. Any idea where to get the binarys and key now?

  24. I think what we need to work on is a maintained package that installs the backtrack tools and menu system. Shouldn’t be too hard, and as long as we maintain it it should work fine with new updates. What do you guys think?

  25. Hey Mick whats the news on the new guide. I am using Ubuntu 10.04 and I get this error with the OPerl Script:

    Argument “false” isn’t numeric in numeric eq (==) at line 66.
    Argument “false” isn’t numeric in numeric eq (==) at line 66.

    All menu entries have been updated

    Line 66 is this:

    next if $termval == 0; # skip if this is not a terminal application

    Please help:)

  26. Hey,
    I really like your article. You said:

    UPDATE [2-14-2010]: I know the download repo’s used in this guide are out of date. I am working to update this guide to reflect the change because the repo change also requires more than a trivial change to my guide. If you want to experiment with it, the new repository is at —

    will you update this guide? I think al lot of people would be thankful for this.


  27. Serveral things I have found while trying to install BT4 into Ubuntu 10.04. Scapy will not install at all. you keep getting errors. and if you try to install all of the BT4 software, then your operating system gets fried and no longer works. Which results in the need to reinstall everything all over again. (Done this 15 time in an attempt to get all of the software install.) Any one got any ideas how to fix this problem? I am lost.

  28. Hello,

    I am looking forward to your updated guide. This is an excellent resource, thanks be to Mick!

    I will keep checking back…

    Thanks again for your hard work!

  29. We should take a moment to thank Mick for his help.
    I cannot think of many resources/individuals who go through the trouble of making available such a useful and lengthy tutorial.
    Let’s pitch in when possible and make this a perfect resource.
    Looking forward to the new guide when ready!

  30. There is an alternative way of getting the packets list, but you need to have Backtrack installed (a bootable USB key / CD-ROM with a live version of Backtrack will do the job). Just run backtrack and use the following command:

    sudo dpkg –get-selections >backtrack.txt

    It will generate the file you’re looking for. Just remember to use CD to navigate to some convenient place before (especially if you use a non-persistent version of BT).

    1. I’m sorry but the way you suggested would take DAYS to get even a semi-right list from…. That method gets EVERYTHING. Not just tools, also kernel installs, system stability applications, all the KDE stuff on BT4,…. you get the idea… And sorting through it would be a nightmare unless you knew what they were all called to begin with, and if you new that… then why the hell would you need the list in the first place ?

  31. I’m still trying Mick, Hope you haven’t gave up!
    Please could you give us some idea if there will be a update to this tuturial as I’ve killed my synaptic package manager now trying this.
    I’ve got BT4 R1 and BT4R2, but I like the look and feel of ubuntu and the tools of BT4 so that is why I’d like to mix the 2…..Good luck and if you have the time, Keep up the Good work!!…………………deeds3353

  32. You guys wanna be hackers and pen-testers… yet you cannot take this guide, re-code it and make it work for a modern set-up? …. I’m workin this on Linux mint, got it from Gnacktrack, did this all on my own. Then i came here because that perl script was what i needed. So thanks but uh… good luck. *sigh* .. no wonder hackers got a bad name…….

    1. And please… if you say “well some of us aren’t as good as you and need a toutorial” I will flame your but halfway across the globe. If you don’t know how, you aren’t good enough to be worthy to know yet. Simple. As. That. And most of you never will be good enough to use all the tools correctly. So just leave it alone. They aren’t toys.

    1. It’s the code on this page. Do a search on *this* page for “”. You have to copy and paste the code and save it into a file.

  33. I did everything, no errors, no missing codes i just changed the line 48 for the pearl script and line 168 for the backtrack update cuz my menu file is not in local is in usr/shared anyway
    but nothing happened my menu still the same no changes, the only thing i have is the backtrack tools alredy in my software system

    so any ideas my dear Mick? what did i do wrong?

    thanks a lot

  34. if you get the message:
    Argument “false” isn’t numeric in numeric eq (==) at ./ line 66.
    bla bla
    edit the perl script at line 66, change ‘==’ to eq so it looks like this

    066 next if $termval eq 0; # skip if this is not a terminal application
    068 #lets see if this is actually a BT program
    069 my $btprogram = IsBTProgram(\@fileparts);
    070 next if $btprogram eq 0;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s