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.

Remote control via python<br />

183<br />

Merely adding a start-up script to /etc/init.d is not enough to cause the MeshDeck<br />

client daemon to start automatically when the system boots. Symbolic links to the<br />

start-up script must be created in the subdirectories for each of the target run levels.<br />

The update-rc.d utility allows these symbolic links to be easily created. The appropriate<br />

comm<strong>and</strong> is sudo update-rc.d meshdeckd defaults.<br />

An install script can be used to automatically install all of the prerequisites for<br />

running the MeshDeck as either a client or a server. The script can also set up the<br />

appropriate start-up scripts. The following start-up script will install the MeshDeck<br />

<strong>and</strong> ask if it should be configured as a drone daemon. The latest version of this script<br />

<strong>and</strong> associated files can be obtained from my GitHub site by executing the comm<strong>and</strong><br />

git clone https://github.com/ppolstra/MeshDeck:<br />

#! /bin/bash<br />

# Install script for the MeshDeck addon to The Deck<br />

# Initially created for a presentation at Blackhat EU 2013<br />

# This version 2.0 was created for the book<br />

# <strong>Hacking</strong> <strong>and</strong> <strong>Penetration</strong> <strong>Testing</strong> With <strong>Low</strong> <strong>Power</strong> <strong>Devices</strong><br />

# by Dr. Phil Polstra<br />

#<br />

# Public domain, no warranty, etc. etc.<br />

#<br />

# first check if you are root<br />

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

echo "Ummm... you might want to run this script as root";<br />

exit 1<br />

fi<br />

# check to see if they have Python<br />

comm<strong>and</strong> -v python >/dev/null 2>&1 jj {<br />

echo "Sorry, but you need Python for this stuff to work";<br />

exit 1; }<br />

# extract XBee Python module to /tmp then install<br />

echo "Installing XBee Python module"<br />

tar -xzf XBee-2.1.0.tar.gz -C /tmp jj {<br />

echo "Could not install XBee module";<br />

exit 1; }<br />

currdir¼$PWD<br />

cd /tmp/XBee-2.1.0<br />

python setup.py install jj {<br />

echo "XBee module install failed";<br />

exit 1; }<br />

echo "XBee Python module successfully installed"

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

Saved successfully!

Ooh no, something went wrong!