10.09.2016 Views

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.

138 CHAPTER 6 Input <strong>and</strong> output devices<br />

#!/usr/bin/env python<br />

# Simple python script to create the EEPROM file<br />

# for the Xbee cape as described in 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 />

from datetime import *<br />

# eeprom starts <strong>with</strong> header aa5533ee<br />

eeprom ¼ b’\xaa\x55\x33\xee’<br />

# revision number<br />

eeprom +¼ b’A1’<br />

# name<br />

eeprom +¼ b’Xbee Cape ala Doc Philip Polstra’<br />

# version<br />

eeprom +¼ b’00A1’<br />

# manufacturer 16 chars<br />

eeprom +¼ b’Philip A Polstra’<br />

# part number<br />

eeprom +¼ b’XbeeFullCape0001’<br />

# number of pins<br />

eeprom +¼ b’\x00\x04’<br />

# serial number in WWYY&&&&nnnn format<br />

# use datetime to create<br />

today ¼ datetime.date(datetime.now())<br />

sn ¼ today.strftime("%U") + today.strftime("%y")<br />

sn +¼ b’XBEE0001’<br />

eeprom +¼ sn<br />

# pin usage P9-22 <strong>and</strong> P9-21 are first 2 entries<br />

pins ¼ b’\xa0\x21\xc0\x01’<br />

pins +¼ b’\x00’ * 78<br />

# now add pins P8-7 <strong>and</strong> P8-9<br />

pins +¼ b’\xc0\x0f\xc0\x0f’<br />

pins +¼ b’\x00’ * 62<br />

eeprom +¼ pins<br />

# max 3.3 v current<br />

eeprom +¼ b’\x00\x64’<br />

# max 5 v current<br />

eeprom +¼ b’\x00\x00’<br />

# max system current<br />

eeprom +¼ b’\x00\x00’<br />

# dc supplied<br />

eeprom +¼ b’\x00\x00’<br />

# write the file<br />

ef ¼ open("xbee-eeprom.bin", "wb")<br />

ef.write(eeprom)<br />

ef.close()

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

Saved successfully!

Ooh no, something went wrong!