10.09.2016 Views

Hacking_and_Penetration_Testing_with_Low_Power_Devices

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

62 CHAPTER 4 Filling the toolbox<br />

on the face of it this might seem like a bad thing, it is actually fine. This function is<br />

only called a few times from a script that is likely only run once. The simpler script is<br />

preferred to an optimized one in this case. Second, there are other display managers<br />

that you could use such as JWM or IceWM that might yield better performance.<br />

Third, you can set it up so that only a particular user has a graphical desktop by running<br />

the script as that user. This would free up resources used by an unused windowing<br />

system on drones but still allow graphical programs to be run if needed. Finally,<br />

we have learned several powerful shell scripting techniques in this small script that<br />

we will use in our own scripts later.<br />

ADDING TOOLS THE EASY WAY<br />

One of the primary reasons for selecting Ubuntu as a base operating system is that it<br />

has extremely good repository support for hacking tools. In cases where packages are<br />

not available in st<strong>and</strong>ard repositories (sometimes due to licensing issues), Debian<br />

package files are often available. Creating a Christmas list of tools <strong>and</strong> then installing<br />

them starting <strong>with</strong> the easiest way <strong>and</strong> working toward harder methods until we are<br />

successful seems to be a sensible approach.<br />

USING REPOSITORIES<br />

If you know the name of a package you want to install <strong>and</strong> it is in your repositories,<br />

this is easily done using the comm<strong>and</strong> sudo apt-get install . If the<br />

package is already installed, you will be informed of such. You will also be told<br />

if the package isn’t found in your currently configured repositories. If the package<br />

is available, you may be prompted on whether to install it if it requires additional<br />

packages to be installed. Adding the -y flag to the apt-get comm<strong>and</strong> (sudo aptget<br />

-y install ) will automatically answer yes to this prompt.<br />

You can update the local package directory <strong>and</strong> upgrade all installed packages by<br />

executing the comm<strong>and</strong> sudo apt-get update && sudo apt-get upgrade. The && is a<br />

logical AND operator. Unlike the logical OR we encountered previously, expressions<br />

on either side of the && will always be run. Furthermore, the comm<strong>and</strong> after<br />

the && is only run after the comm<strong>and</strong> before the && completes. It is a good idea to<br />

run this comm<strong>and</strong> before installing any new software.<br />

If you are uncertain of an exact package name or have no idea which package<br />

contains a certain tool, you can use apt-cache search to find<br />

c<strong>and</strong>idate packages. Note that sudo is not required here as anyone is allowed to look<br />

at the package directory. Unfortunately, in some cases, you might end up <strong>with</strong> a lot of<br />

obviously wrong packages whose names or contained tools just happen to contain<br />

your search string. Grep is your friend in these cases. For example, apt-cache<br />

search gnome returns hundreds of result. Piping the results to grep '^gnome' limits<br />

results to those that start <strong>with</strong> the string “gnome.” The comm<strong>and</strong> apt-cache search<br />

gnome j grep '^gnome' returns only a h<strong>and</strong>ful of results.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!