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.

184 CHAPTER 7 Building an army of devices<br />

# setup the files<br />

echo "Creating files in /usr/bin, /usr/sbin, <strong>and</strong> /etc/init.d"<br />

cd $currdir<br />

(cp meshdeck.py /usr/bin/MeshDeck.py && chmod 744\<br />

/usr/bin/MeshDeck.py) jj {<br />

echo "Could not copy MeshDeck.py to /usr/bin";<br />

exit 1; }<br />

# create symbolic link in /usr/sbin<br />

if [ ! -h /usr/sbin/meshdeckd ]; then<br />

ln -s /usr/bin/MeshDeck.py /usr/sbin/meshdeckd jj {<br />

echo "Failed to create symbolic link in /usr/sbin";<br />

exit 1; } ;<br />

fi<br />

# create file in /etc/init.d<br />

(cp meshdeckd /etc/init.d/. && chmod 744 /etc/init.d/meshdeckd)\<br />

jj {<br />

echo "Failed to create daemon script in /etc/init.d";<br />

exit 1; }<br />

# is this a drone? if so should be automatically start it?<br />

read -p "Set this to automatically run as a drone?" yn<br />

case $yn in<br />

[Nn]* ) exit;;<br />

* ) update-rc.d meshdeckd defaults;<br />

read -p "start daemon now?" yn<br />

case $yn in<br />

[Nn]* ) exit;;<br />

* ) /etc/init.d/meshdeckd start;;<br />

esac<br />

;;<br />

esac<br />

SAVING POWER<br />

A Series 2 XBee modem that is sending or receiving data uses approximately<br />

40-50 mA of current at 3.3 V. The extended range Series 2 XBee-PRO adapters<br />

consume approximately 55 <strong>and</strong> 250-295 mA of current when receiving <strong>and</strong> transmitting,<br />

respectively. Significant power savings can be realized by reducing transmission<br />

times <strong>and</strong> by putting the modems to sleep whenever possible.<br />

Buffering information <strong>and</strong> transmitting data in batches of packets of maximum<br />

size allow the transmission circuit in an XBee modem to be energized for a shorter<br />

period of time. This is how the previously described MeshDeck Python module operates.<br />

The transmit power can also be reduced by setting the PL (power level) variable

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

Saved successfully!

Ooh no, something went wrong!