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.

66 CHAPTER 4 Filling the toolbox<br />

# Packages to be downloaded are stored in packages-to-download.txt<br />

# <strong>and</strong> those to be installed from source are stored in<br />

# source-to-download.txt.<br />

#<br />

# Originally created by Dr. Phil Polstra<br />

# for the book <strong>Hacking</strong> <strong>and</strong> <strong>Penetration</strong> <strong>Testing</strong> With <strong>Low</strong> <strong>Power</strong>\<br />

<strong>Devices</strong>.<br />

#<br />

#set for your browser<br />

browser_comm<strong>and</strong>¼'google-chrome'<br />

# remove old versions of our files if they exist<br />

if [ -e packages-to-download.txt ] ; then<br />

rm -f packages-to-download.txt<br />

fi<br />

if [ -e source-to-download.txt ] ; then<br />

rm -f source-to-download.txt<br />

fi<br />

# This is the main function in this script<br />

find_dpkg () {<br />

# ask the user what they want to do<br />

echo -n "Would you like to try find a package for ${pkg} Yes/No\<br />

use source/Drop the package [Y]/N/D> "<br />

read resp<br />

if [ $resp ¼¼ 'n' ] jj [ $resp ¼¼ 'N' ] ; then<br />

# Just add it to the list of packages to build from source<br />

echo ${pkg} >>source-to-download.txt<br />

elif [ $resp ¼¼ "d" ] jj [ $resp ¼¼ "D" ] ; then<br />

# Just drop it don't do anything<br />

echo "Dropping ${pkg} like it is hot"<br />

else<br />

# launch a browser<br />

${browser_comm<strong>and</strong>} "http://google.com/search?q¼\"${pkg}\"\<br />

+install+download+linux" >/dev/null<br />

# now give them a chance to enter a download<br />

echo -n "Enter a download URL for ${pkg} or just press enter\<br />

if you didn't find one > "<br />

read url<br />

if [ ! $url ] ; then<br />

echo ${pkg} >> source-to-download.txt<br />

else<br />

# if we are here they entered something<br />

# ask if it is a source package or dpkg<br />

# it makes sense to ask now so we don't have to search again\<br />

later

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

Saved successfully!

Ooh no, something went wrong!