Reader small image

You're reading from  BeagleBone for Secret Agents

Product typeBook
Published inSep 2014
PublisherPackt
ISBN-139781783986040
Edition1st Edition
Right arrow
Author (1)
Joshua Datko
Joshua Datko
author image
Joshua Datko

Josh Datko is the founder of Cryptotronix, LLC, an open source hardware company that specializes in embedded, cryptographic electronics. He graduated with distinction from the US Naval Academy with a Bachelor's of Science in Computer Science and then served 10 years in the Navy, both actively and as a reserve submarine officer. He has been deployed to locations worldwide including Afghanistan in support of Operation Enduring Freedom. In 2014, Josh presented at both the HOPE and DEF CON conferences. He completed his Master's of Science in Computer Science, with a focus on security and networking, from Drexel University.
Read more about Joshua Datko

Right arrow

Controlling the bridge with the Stem library


The bridge is controlled using the Stem library, which communicates with the Tor process over the Tor control protocol. The setup is managed in the BeagleBridge class. After establishing a connection with the Tor process, this class registers two event listeners for the Bandwidth and Configuration changed event. The bandwidth event is triggered each second and reports, via the print_bw callback, the bytes used in the last second. This information is used to draw the bandwidth graph. The following callback function shows how the callback interacts with the LCD:

def make_bw_callback(test,lcd):
  '''Returns a callback function for the bandwidth event'''
  def print_bw(event):
    '''Obtains the bandwidth used from the last second from the
       bridge, normalizes it to the total bandwidth, and draw 
       that information to the display'''
    up = int(test.get_up_ratio(event.written))
    down = int(test.get_down_ratio(event.read))
    lcd.display_graph...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
BeagleBone for Secret Agents
Published in: Sep 2014Publisher: PacktISBN-13: 9781783986040

Author (1)

author image
Joshua Datko

Josh Datko is the founder of Cryptotronix, LLC, an open source hardware company that specializes in embedded, cryptographic electronics. He graduated with distinction from the US Naval Academy with a Bachelor's of Science in Computer Science and then served 10 years in the Navy, both actively and as a reserve submarine officer. He has been deployed to locations worldwide including Afghanistan in support of Operation Enduring Freedom. In 2014, Josh presented at both the HOPE and DEF CON conferences. He completed his Master's of Science in Computer Science, with a focus on security and networking, from Drexel University.
Read more about Joshua Datko