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.
Using IEEE 802.15.4 networking<br />
157<br />
interface (from the BeagleBone) are transmitted wirelessly <strong>and</strong> all data received over<br />
the XBee link are sent out on the UART (to the BeagleBone). The XBee modems<br />
may also be operated in Application Programming Interface (API) mode. In API<br />
mode, all data sent <strong>and</strong> received via the XBee link are contained in frames. Any data<br />
received by an XBee modem in API mode that are not contained <strong>with</strong>in a properly<br />
formed frame are discarded.<br />
In order for two XBee modems to communicate <strong>with</strong> each other in transparent<br />
mode, they must be properly configured. First, the modems must both operate on<br />
the same XBee channel (recall that there are 16 channels available). Second, they<br />
must use the same PAN ID. The default PAN ID is 0x3332 <strong>and</strong> the valid range is<br />
0-0xFFFF. The addresses must also be configured correctly.<br />
Just like the more familiar Ethernet <strong>and</strong> IEEE 802.11 adapters, XBee modems<br />
have MAC addresses. XBee MAC addresses are 64 bits long. Each modem can also<br />
have a short 16-bit address assigned to it. Using 16-bit addresses is more efficient<br />
than using 64-bit addresses. Setting a modem’s 16-bit address to 0xFFFF or 0xFFFE<br />
disables 16-bit addressing mode. The 16-bit address is stored in the MY variable on<br />
the XBee modem.<br />
In addition to the MY address variable, each modem has DH (destination address<br />
high) <strong>and</strong> DL (destination address low) variables for setting the destination address<br />
when the modem is operated in transparent mode. DH <strong>and</strong> DL are 32-bit variables.<br />
This allows 64-bit addresses to be used when operating in transparent mode. Setting<br />
DH to zero <strong>and</strong> storing a value less than 0xFFFF in DL causes a modem to use 16-bit<br />
addressing.<br />
Transparent mode is enabled by default. A modem can be changed to API mode<br />
by changing the AP variable from 0 to either 1 or 2. Setting AP to 1 enables API<br />
mode. If values are likely to be sent or received that must be escaped, AP should<br />
be set to 2. The values XON <strong>and</strong> XOFF, hex 0x11 <strong>and</strong> 0x13, respectively, must<br />
be escaped to prevent the BeagleBone from improperly starting <strong>and</strong> stopping any<br />
data transmitted.<br />
Comm<strong>and</strong>s can be sent to the XBee modem in order to change its configuration.<br />
When operating in API mode, this is done by sending special comm<strong>and</strong> packets. In<br />
transparent mode, comm<strong>and</strong>s are sent by forcing the modem into comm<strong>and</strong> (or AT)<br />
mode. A second of silence followed by the string “+++” <strong>and</strong> another second of<br />
silence sent to the modem will cause it to enter comm<strong>and</strong> mode. Comm<strong>and</strong>s (all<br />
of which begin <strong>with</strong> AT) can then be sent to the modem. After the time specified<br />
in the CT variable has gone by <strong>with</strong>out any comm<strong>and</strong>s sent to the modem, it will<br />
revert to transparent mode.<br />
Now that all the preliminaries have been covered, let us explicitly cover the steps<br />
needed to set up two XBee modems in a peer-to-peer topology. The details on how<br />
this is done <strong>with</strong> Digi-supplied software will be covered later in this chapter. Both<br />
modems must be set to the same channel <strong>and</strong> PAN ID. The DH value on each modem<br />
should be set to zero. The MY value on one modem should be set to the DL value of<br />
the other <strong>and</strong> vice versa. By default, modems are set to use transparent mode. Ensure<br />
that both modems are set to the appropriate mode.