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.
Remote control via python<br />
179<br />
The MeshDeckClient class is used for creating a daemon process on the drones.<br />
The MeshDeck clients use synchronous communication. There is no real need to use<br />
asynchronous communication because, unlike the server, the client has no tasks to<br />
perform in parallel. The comm<strong>and</strong> meshdeck.py -d will run the daemon on the<br />
default port of /dev/ttyO2 at 57,600 bps. As <strong>with</strong> the server, the port <strong>and</strong> baud rate<br />
can be appended if non-default values are used.<br />
In order for drones to be available, the daemon must be started when the systemboots.Thebestwaytoaccomplishthisistocreateastart-upscripttobe<br />
stored in /etc/init.d. The script can be called directly <strong>with</strong> a comm<strong>and</strong> such as<br />
start, stop, or restart. The comm<strong>and</strong> service meshdeckd <br />
can also be used. The following start-up script should be saved to /etc/init.d/<br />
meshdeckd:<br />
#! /bin/sh<br />
### BEGIN INIT INFO<br />
# Provides: meshdeckd<br />
# Required-Start: $remote_fs $syslog<br />
# Required-Stop: $remote_fs $syslog<br />
# Default-Start: 2 3 4 5<br />
# Default-Stop: 0 1 6<br />
# Short-Description: Init script for MeshDeck drone<br />
# Description: This script can be used to start <strong>and</strong><br />
# stop the MeshDeck drone daemon.<br />
### END INIT INFO<br />
# Author: Dr. Phil Polstra <br />
#<br />
# Part of the MeshDeck addon to The Deck as originally<br />
# presented at BlackHat Europe 2013.<br />
# Public domain, use <strong>and</strong> abuse as you see fit<br />
# no warranty, etc. etc.<br />
# Do NOT "set -e"<br />
# PATH should only include /usr/* if it runs after the\<br />
mountnfs.sh script<br />
PATH¼/sbin:/usr/sbin:/bin:/usr/bin<br />
DESC¼"MeshDeck drone daemon"<br />
NAME¼meshdeckd<br />
DAEMON¼/usr/sbin/$NAME<br />
DAEMON_ARGS¼"-d"<br />
PIDFILE¼/var/run/$NAME.pid<br />
SCRIPTNAME¼/etc/init.d/$NAME<br />
# Exit if the package is not installed<br />
[ -x "$DAEMON" ] jj exit 0