Hack Like a Pro: Linux Basics for the Aspiring Hacker, Part 5 (Installing New Software)

Linux Basics for the Aspiring Hacker, Part 5 (Installing New Software)

Hack Like a Pro: Linux Basics for the Aspiring Hacker, Part 5 (Installing New Software)

Welcome back, my hacker wannabees!

Since nearly all hacker tools and platforms are developed in the Linux/Unix operating systems, this series of tutorials are for those of you who want to be hackers, but are unfamiliar with Linux.

We've looked at numerous basic commands in the first few tutorials, but here I want to focus on installing new software in Linux, and especially in BackTrack.

Image via wonderhowto.com

BackTrack v5r3 was built on Ubuntu, which is a type of Debian Linux. That's important because different Linux systems use different methods for package management (package management means downloading and installing new software packages).

Before we dive in, make sure to check out my previous guides on Linux basics to get current on our lessons.

Step 1: Using the GUI Package Manager

The simplest way to install software on BackTrack is to use the GUI package manager. In my KDE-based BackTrack 5, the GUI package manager is called KPackageKit (some of you may have Synaptic).

These package managers enable us find packages, download them, and install them on our system. We can open KPackageKit by navigating to System and then KPackageKit as shown in the screenshot below.

When open, you simply put the name into search field. It will then retrieve all the options fulfilling the criteria of your search, then just click on the icon next to the package you want to download.

In this example, we will be looking for the wireless hacking software, aircrack-ng.

Note that if the package is already installed, there will be an X next to it. If not, there will be a downward-pointing arrow. Click on the arrow and then click on the APPLY button below.

Step 2: Updating Your Repositories

Package managers search in specified repositories (websites housing packages) for the package you are seeking. If you get a message that the package was not found, it doesn't necessarily mean that it doesn't exist, but simply that it's not in the repositories your OS is searching.

BackTrack defaults to searching in backtrack-linux.org where many hacking tools are available. Unfortunately, if you are looking for something that is not a hacking tool or a new hacking tool that BackTrack hasn't yet placed in its repository, you may have to revise where your operating system searching for packages.

This can be done by editing the /etc/apt/sources.list file. Let's open it with KWrite and take a look.

As you can see, BackTrack has three default sources on its sources.list, all pointing to BackTrack repositories. We can add any repository with Linux software to this list, but since BackTrack is a Ubuntu distribution, we might want to add an Ubuntu repository to this list to download and install Ubuntu software. We can do this by adding a single line to this file:

Now when I use my package manager, it will search the three BackTrack repositories first, and if it fails to find the package in any of those places, it will then search for it in the Ubuntu repository.

Step 3: Command Line Package Management

Ubuntu also has a command line package manager called apt. The basic syntax for using apt to download packages is:

  • apt-get install aircrack-ng

So, let's open a terminal and type the above command to install aircrack-ng (of course, we just need to replace the name of the package to install other software).

If the package is in one of our repositories, it will download it and any of the necessary dependencies (files that the package need to run properly), and install it on your system automatically.

Step 4: Installing from Source

Finally, sometimes you will need to download software that is neither in a repository, nor in a package. Most often these are archived as tar or tarballs. These are files that are "tarred" together into a single file and often compressed (similar to zipping files with WinZip and then putting them together into a .zip file).

Let's say that aircrack-ng was not in our repository (some software never finds its way into a repository) and we had to download it from aircrack-ng.org website. We could download the file aircrack-ng-1.2-beta1.tar.

Once we've downlaoded it, then we need to untar it using the tar command:

  • tar xvf aircrack-ng-1.2-beta1.tar

This will untar and uncompress it, if it's compressed. Next we need to compile it with the GNU compiler. Compiling from source code will give us binaries (the program files) that are optimized for our hardware and operating system, meaning they will often run faster and more efficiently. We can compile this source code by typing:

  • gcc aircrack-ng

Finally, we can now run this file from within the directory where we unzipped it:

  • ./aircrack-ng

Note that to run the file, we preceded it with the ./, which tells Linux to execute this file from the directory we are presently in, so make certain you run this command in the same directory that you compiled the source code in.

That should cover all the major ways of installing software and I hope it wasn't too confusing. In most cases, we can simply use the GUI based package manager to install software, but like all things in life, there are exceptions.

In my next tutorial, we'll be looking at networking Linux using BackTrack. If you haven't already, make sure to check out the first four parts of this series, and if you have any questions, ask away in the comments below or hit up the Null Byte forum for more help.

Blue penguin photo by Joe Shlabotnik

73 Comments

Nice Post, Beside this i want to ask you About Tor Browser Bundle. I installed it as root on backtrack but when i tried to run it it gives me error Tor Browser Bundle Should not be run as a Root. Exiting, After that i made a non-root user with Adduser Command, Then i added it to group with usermod --groups admin,cdrom,audio myusername After all this i login with a non-root user and installed Tor and on giving command ./start-tor-browser it gives me error Unable to open Configuration file "home/myusername/tor-browser-en-US/App/../Data/Tor/torrc." I tried to go to Data/Tor/torrc with non-root user It also gives an error bash: cd: Tor: Permission Denied What should i do to run Tor on Backtrack 5 R3

If it was me, and I'm no professional, but if it was me, I'd sudo apt-get remove toe-browser-bundle if you let the package manager handle the install, or a less pretty way would be to do a find command looking for all tor related files then sudo rm them, then reinstall tor from the user account.

Or you could try changing permissions on all your TOR files. look up chown and chmod for that. It's a more elegant approach, but often is too time consuming at least in my experience.

I dunno, hope this helps, I haven't used a debian-derived distro in ages so I forget how things work there.

very good tutorials, I am new in this hack ocean and I am very fond to be computer security professional........

Criss:

IHATEPULLUPS is on the right track. Use apt-get remove to remove your tor installation. Then re-install it using the non-root user.

OTW

IHATEPULLUPS Thank For Replying but i don't know how to use chmod or chown commands. OTW i got it in tar.gz form then i extracted it and gave ./start-tor-browser command. and it gives me this error Unable to open Configuration file "home/myusername/tor-browser-en-US/App/../Data/Tor/torrc." i just started using linux with your lessons

Criss:

Did you remove or uninstall all the tor browser files?

chmod is a command to change the permissions on a file. You must have execute permissions on a file. Generally, you want to chmod 755 filename to give yourself execute permission.

OTW

I used chmod a=rwx and gave permission to the file but unexpectedly i gave me another error which states that "this Directory is not owned by this user (some numbers here) but by root(0) perhaps you are running tor as a wrong user" i don't understand where the problem exisit.

Criss:

It sounds like the tor browser is still owned by root. You need to uninstall and re-install as another user.

OTW

how to uninstall and reinstall with non-root user

Criss:

You need to login as root and then uninstall. Then, change to a regular user and re-install.

OTW

its a tar.gz file i just extracted it i didn't install it

Criss:

You need to extract and install. If you are logged in as a non-root user, preface you command with sudo.

OTW

Yipee it worked OTW & IHATEPULLUPS i really want to thank you guys and especially OTW i am a big fan of you :-)

Hey I have been having some issues while following along, as I cant seem to untar it, When I first downloaded it I got it in the .tar.gz format so I used the command

gunzip aircrack-ng-1.2-beta1.tar.gz

Then, after checking to make sure it had worked, I then attempted to use the command

tar xzvf aircrack-ng-1.2-beta1.tar and got an error message saying

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

Jack:

The command should be:

tar xvf aircrack-ng-1.2-beta1.tar

The z switch means to zip the file. The command as you wrote it trying to untar and zip, simultaneously. Simply take the z out.

OTW

I did the same with the new file aircrack-ng-1.2-beta3.tar.gz
My command lines are:
gunzip aircrack-ng-1.2-beta3.tar.gz
tar xvf aircrack-ng-1.2-beta3.tar

So far so good.
But right after that, I enter:
gcc aircrack-ng

Then it appears:

gcc: error: aircrack-ng: No such file or directory
gcc: fatal error: no input files
compilation terminated.

HELP me!!!

First, if you are using BT or Kali, you don't need to install aircrack-ng. It is already on your system.

Second, your input file name is wrong. The file name should be the complete name of the file. You could simply use the TAB key to autocomplete.

OTW

I'm in Kali. Plus, sure thing I can directly tar xvf aircrack-ng-1.2-beta3.tar.gz and still get the same result folder as doing gunzip then tar later. I did several times that part. What I don't understand is the tar command extract everything into a folder name aircrack-ng-1.2-beta3 but why you execute gcc aircrack-ng in the parent folder of aircrack-ng-1.2-beta3?

Even when I try gcc in the directory that contains aircrack-ng.c and aircrack-ng.h it doesn't work too.

Hey I'm new here. So I'm using Kali, what's the alternative for KPackageKit? It's got a software center like Ubuntu as you know. Should I use that? Thank you.

Burning:

Yes, use software center.

OTW

Excellent job mate... Simply like a maestro

OTW:
what does xvf after tar mean?

Giri:

Welcome to Null Byte.

The x stands for extract, the v stands for verbose and f means use the same file name of the tar file.

You find info on any Linux command by using the "man" before the command, such a "man tar".

OTW

OTW:
Thank you
All your works on hacking are awesome and easy to understand.Please keep up good work.:)

i'm GNOME i can't launch the package manager :(

Im using Kali, so what's that KPackageKit? I read you said its the same as "Software Center" but i cant find that one either.

The only thing I find is "Software Update" on System Tools, is that it?

Thanks for your attention, and for all your work in here ;D

Guilherme:

Welcome to Null Byte!

There is no package manger in Kali. Just another reason why beginners should not use Kali.

In Kali, you must use the Debian aptitude set of tools from the command line such as "apt-get install packagename".

OTW

Ahhhh oukay! No problem, I can deal with that.. haha
But most of those packages already are installed in Kali, right?

Thank you for the fast reply!

EDIT:
About that "Software Update", i got like 77 updates to do, should I?
Thanks!

Guilherme:

You are correct, many of the packages are already in Kali, but not all. In addition, they may be in different directories. As you know, what is newest is not always best (i.e., Windows 8).

It's Ok to do the updates. I may take awhile. I usually don't do the updates unless I detect a need.

OTW

Do you suggest me using BT instead of Kali? I started with BT, but then i saw that Kali existed (saw here on your tutorials) and downloaded it..

What do you Suggest? Which one is best?
Thank you!

I like Backtrack especially for beginners.

But is Kali stronger? I mean, for what i read in it's website, it says its better for hacking purpose than BT.

Is that true? Coz i think he lost a little of his 'linux layout' haha, and for that i liked BT more.

But if Kali is really 'more powerful' ill stick with Kali

Its up to you.

BT is better for beginners and just as "strong" as Kali without the bugs.

Kali has a lot of bugs? :(
jesus.. then im thinking about returning to BT

Thank you very much, and all your tutorials are awesome, congratulations!

EDIT:
Already downloading BT5r3.
Thank you.

How did you remove Kali and install BackTrack again? Was Kali booted dual with your Windows?

OTW

Instead of the KDE version of BT I got the GNOME version. When I navigate to system tools I don't see either of the programs/tools 'KPackagekit' or 'Synaptic'. I have preformed a find command in the terminal for both and both times it has come back empty.

I'm still logged in as root. Could that be the problem? Do I have to create a new log in?

Gumskull:

Synaptic should be in the file menu pull down at the top of the desktop. If not, you can always use the command line package manager.

OTW

P.S. This has nothing to do with your being logged in as root.

Okay but don't I need Synaptic to download the things I need?

Everything you need for my tutorials is already built into BT. If you want to add anything else, you can use the command line approach in Step #3 above.

OTW

hi there OTW. i was wondering if you could tell me how to install a torrent download manager im trying to download a dictionary file from your wpa2 tutorial. thanks alot for taking the time to write these how to's its helped me no end to use the linux OS.

Paul:

If you check your package manager there a many torrent clients in the Ubuntu and Debian repositories.

OTW

thanks for your reply, i have checked them and for some reason they aren't there i used root@paul:~# apt-get install bittorrent

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package bittorrent

am i just being stupid or isit not there? is does the same with bitornado too man....

Use synaptic and do a search of the repository

Okay, thanks.

Okay, thanks.
Again with the double replies. Sorry.

Thanks for the good, detailed, step-by-step tutorial.

Is there a GUI-based package manager in BackTrack 5 R3 GNOME? I can't find the KPackageKit or Synaptic in my pull down menu.

Hi OTW. First of all: Great job on all the guides. Cant wait to get through them. Since im only getting started, im using Kali. Should i still add Ubuntu repos or should i add debian repos instead? And where would one find those?

The Kali repo is primarily hacking tools. If you want other software, I would suggest adding another repo.

Thanks. Can i still add the Ubuntu repo, as suggested in this guide, or should i go for Debian repo? Read that Ubuntu is Debian based aswell as Kali, so it doesnt matter if i add Ubuntu or Debian? :)

It does matter slightly. They have slightly different programs. If you want to play it safe, add both.

Even though Aircrack-ng is installed by default in BackTrack and Kali Operating system, we can still use this commands to operate other packages.... Thanks a lot for the timely instruction

Although I am not a noob in Linux OSes , but I learn something new from this tutorial .
That ,locally compiled files run faster than the packages(like .deb , .bundle etc )
Thanks for adding this to local repository of my knowledge ;)

hello, this is a little off point... but, i wanted to know how one could download a software like Audacity unto kali linux?

Guys . i have a problem here . I had kali linux and worked perfect . somehow i crashed it and now i installed kali linux lite . BUT . i have no text editor suck as gedit or something . and i cannot apt-get nothing . is there any sources.list file i can download to replace the old one so i can download synaptic ?

Doesn't work for me with ParrotSec OS.
gcc aircrack-ng
gcc: error: aircrack-ng: No such file or directory
gcc: fatal error: no input files
compilation terminated.

Everything works great with me from your part1 guide until the last two steps in part5.

i could not compile and run aircrack-ng
i keep getting the messages below:

im using ubuntu OS

and having the same problem
gcc aircrack-ng
gcc: error: aircrack-ng: No such file or directory
gcc: fatal error: no input files
compilation terminated.

and also i could not run the "./aircrack-ng"
it tells me bash: ./aircrack-ng: No such file or directory

Did you successfully download aircrack?

Yes, i followed the instructions precisely.

Where is the source directory of aircrack-ng, may be im must use ./aircrack-ng from there

the unzipped folder is in home/user/Downloads
so do i need to use this command ./aircrack-ng from there?

I just installed Kali on an 8GB thumb drive, and I'm running it from that. I'd like to install new software, but every time I shut down, everything goes away, and I have to start with a default Kali. Is there a place to learn how to make the install persistent?

Yes, there are several tutorials on Null Byte on how to install Kali with persistence on USB.

Thanks, OWT. I'll search around for them.

I have one more question...

I installed Kali on an 8GB USB stick with the Mac Linux USB Loader on my Macbook. I wanted to use my Seagate 500GB external drive to do it, but when I tried to use the USB loader, the drive would never show up under the options to install to. It worked fine with the stick, though.

I was wondering if this may be because the drive is to big to install Kali on. I made sure to format as Fat32 and made a Master Boot partition.

Any idea why it wouldn't show up?
I appreciate the tutorials and all your help.

I've tried a dozen Linux tutorials and this one is hands-down the best. Thanks for all your efforts and keep up the good work.

Are there any GUI Package Managers for Kali? If so, how would I go about installing them? I have followed guides to install synaptics (which included updating the repositories) and it comes back saying, "Package synaptic is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source...". Should I just stick to using the command line package management? Thanks in advance, I am new to this.

Go to Applications --> System Tools --> Add/Remove Software

Thank you for demonstration, really i have problem where i cant find both KPackageKit or Synaptic, i have tried to download it through apt-get install synaptic but failed

hello otw sir,
i am one of your novice hacker, who is in a problem of installing aircrack in backtrack.
(i apologize for by mistake posting my question on a different page ie linux basics part 28)

step 1
i did apt-get remove aircrack-ng to remove the aircrack-ng and then i downloaded it from the aircrack-ng.org (tar file)

step 2
tar xvf aircrack-ng-1.2-rc4.tar.gz to extract the tar file

step 3
gcc aircrack-ng error not working

Below is the screenshot of the problem

Hope to get a positive reply
kudos for all your efforts sir
thank you

use gunzip command to decompress it from .gz format like
gunzip aircrack-ng-1.2-rc4.tar.gz
then use tar and the same format that you used before without .gz extension

when i use gcc comand.it's show me no file or directory..and when i use ./aircrack-ng,show me same no such file or directory..how solve my problem??

Share Your Thoughts

  • Hot
  • Latest