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.
Adding tools the easy way<br />
65<br />
check_dpkg<br />
done < "christmas-list.txt"<br />
USING PACKAGES<br />
Inevitably, not all of your packages will have been installed from the previous script.<br />
In my experience, roughly 85% of the tools on your Christmas list will install <strong>with</strong>out<br />
issues. The next logical step is to take your to-do list of tools <strong>and</strong> start searching the<br />
Internet for Debian packages. The top sites to check first would be sourceforge.net,<br />
github.com, <strong>and</strong> code.google.com. Some of these tools have their own dedicated<br />
websites, so you might want to do a generic Google search if you don’t find what<br />
you are looking for on the three sites mentioned.<br />
When researching various tools, you will discover that some are available as<br />
Debian (<strong>and</strong> possibly RPM) packages <strong>and</strong> source code. Some tools are released as<br />
source code only. Even when Debian packages are available, they might refuse to<br />
work on the ARM platform. I have encountered situations in which the install fails<br />
because required packages are not available for ARM-based systems. I have also had<br />
the much more frustrating experience of a Debian package that won’t install because<br />
it is flagged as being available only for x86 processors despite being implemented<br />
entirely in an available scripting language such as Python or Ruby.<br />
Assuming you have successfully downloaded a Debian package in the form of a .<br />
deb file, installation is straightforward. The comm<strong>and</strong> sudo dpkg -i <br />
will install a package that can later be removed using sudo dpkg -r .<br />
Note that the filename is used to install (i.e., mypackage-2.1.deb) while the package<br />
name is used for removal (i.e., mypackage).<br />
If a package relies on other packages that are not installed, dpkg will complain.<br />
When this happens, the comm<strong>and</strong> sudo apt-get install -f may install the appropriate<br />
packages assuming they are all available in your selected repositories. If you<br />
continue to have issues, you might need to manually install the required packages<br />
before installing the tool from your Christmas list.<br />
The following script iterates over the list of packages that could not be installed<br />
<strong>with</strong> apt-get stored in the todo-packages.txt file. It will ask if you want to try <strong>and</strong> find<br />
a Debian package. If you say yes, it will open a browser <strong>with</strong> Google search results for<br />
the package. If you find a download link, you can store it in the packages-to-download.<br />
txt file or todo-source-packages.txt file depending on what you found. If you cannot<br />
locate the package or choose not to look, the package name is listed in the todo-sourcepackages.txt<br />
file <strong>with</strong>out a URL. You also have the option to drop the package entirely:<br />
#!/bin/bash<br />
# This script will iterate over the todo-packages.txt file<br />
# <strong>and</strong> ask you if you want to try <strong>and</strong> find a package,<br />
# skip it (find source later), or just drop it.<br />
# If you try to find a package you will be prompted<br />
# for a URL to download a .deb file. If you enter a blank<br />
# URL it is assumed you couldn't find the file <strong>and</strong> will have<br />
# to install it from source.