10.09.2016 Views

Hacking_and_Penetration_Testing_with_Low_Power_Devices

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Adding tools the hard way<br />

69<br />

# check the file extension<br />

extension¼$(echo ${fname} j tr "." "\n" j tail -1)<br />

if [ "$extension" !¼ "deb" ] ; then<br />

echo "${fname} does not appear to be a Debian package file"<br />

echo -n\<br />

"Enter a comm<strong>and</strong> to uncompress or rename it or press Enter for none >"<br />

read resp<br />

if [ "$resp" !¼ "" ] ; then<br />

# run the comm<strong>and</strong><br />

'$resp'<br />

# fix the filename<br />

fname¼$(echo $fname j sed "s/\.${extension}$/\.deb/")<br />

fi<br />

fi<br />

comm<strong>and</strong>¼"dpkg -i /tmp/${fname}"<br />

${comm<strong>and</strong>}<br />

}<br />

# interate over the download list<br />

# read whole file into an array<br />

declare -i count¼0<br />

while read line<br />

do<br />

pkg¼$(echo ${line} j awk '{print $1}')<br />

pkg_list[$count]¼${pkg}<br />

url¼$(echo ${line} j awk '{print $2}')<br />

url_list[$count]¼${url}<br />

count+¼1<br />

done < "packages-to-download.txt"<br />

# now actually download <strong>and</strong> install<br />

count¼0<br />

for pkg in ${pkg_list[@]}<br />

do<br />

url¼${url_list[$count]}<br />

dl_pkg<br />

install_pkg<br />

count+¼1<br />

done<br />

ADDING TOOLS THE HARD WAY<br />

If packages are not available for a tool, building from source might be the only<br />

option. There are a number of different ways to build tools for the Beagles. The most<br />

straightforward method is to download the code <strong>and</strong> build it directly on the Beagle.<br />

Code can also be built from another Linux desktop system, a process known as cross

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

Saved successfully!

Ooh no, something went wrong!