Package killerbee :: Module dev_wislab :: Class WISLAB
[hide private]
[frames] | no frames]

Class WISLAB

source code

Instance Methods [hide private]
None
__init__(self, dev='10.10.10.2', recvport=17754, recvip='10.10.10.1')
Instantiates the KillerBee class for the Wislab Sniffer.
source code
 
close(self)
Actually close the receiving UDP socket.
source code
 
check_capability(self, capab) source code
 
get_capabilities(self) source code
None
__set_capabilities(self)
Sets the capability information appropriate for the client and firmware version.
source code
List
get_dev_info(self)
Returns device information in a list identifying the device.
source code
If fetch==True, returns a String of the page. Otherwise, it returns True if an HTTP 200 code was received.
__make_rest_call(self, path, fetch=True)
Wrapper to the sniffer's RESTful services.
source code
Boolean
__sniffer_status(self)
Because the firmware accepts only toggle commands for sniffer on/off, we need to check what state it's in before taking action.
source code
 
__sync_status(self)
This updates the standard self.__stream_open variable based on the status as reported from asking the remote sniffer.
source code
Boolean
__sniffer_channel(self)
Because the firmware accepts only toggle commands for sniffer on/off, we need to check what state it's in before taking action.
source code
None
sniffer_on(self, channel=None)
Turns the sniffer on such that pnext() will start returning observed data.
source code
None
sniffer_off(self)
Turns the sniffer off.
source code
None
set_channel(self, channel)
Sets the radio interface to the specifid channel (limited to 2.4 GHz channels 11-26)
source code
 
inject(self, packet, channel=None, count=1, delay=0)
Not implemented.
source code
List
pnext(self, timeout=100)
Returns a dictionary containing packet data, else None.
source code
None
jammer_on(self, channel=None)
Not yet implemented.
source code
None
jammer_off(self, channel=None)
Not yet implemented.
source code
Static Methods [hide private]
Integer, or None if unable to determine modulation
__get_default_modulation(channel)
Return the Wislab-specific integer representing the modulation which should be choosen to be IEEE 802.15.4 complinating for a given channel number.
source code
 
__parse_zep_v2(data)
Parse the packet from the ZigBee encapsulation protocol version 2/3 and return the fields desired for usage by pnext().
source code
Method Details [hide private]

__init__(self, dev='10.10.10.2', recvport=17754, recvip='10.10.10.1')
(Constructor)

source code 

Instantiates the KillerBee class for the Wislab Sniffer.

Parameters:
  • dev (String) - IP address (ex 10.10.10.2)
  • recvport (Integer) - UDP port to listen for sniffed packets on.
  • recvip (String) - IP address of the host, where the sniffer will send sniffed packets to.
Returns: None
None

__set_capabilities(self)

source code 

Sets the capability information appropriate for the client and firmware version.

Returns: None
None

get_dev_info(self)

source code 

Returns device information in a list identifying the device.

Returns: List
List of 3 strings identifying device.

__make_rest_call(self, path, fetch=True)

source code 

Wrapper to the sniffer's RESTful services. Reports URL/HTTP errors as KBInterfaceErrors.

Returns: If fetch==True, returns a String of the page. Otherwise, it returns True if an HTTP 200 code was received.

__sniffer_status(self)

source code 

Because the firmware accepts only toggle commands for sniffer on/off, we need to check what state it's in before taking action. It's also useful to make sure our command worked.

Returns: Boolean

__sniffer_channel(self)

source code 

Because the firmware accepts only toggle commands for sniffer on/off, we need to check what state it's in before taking action. It's also useful to make sure our command worked.

Returns: Boolean

sniffer_on(self, channel=None)

source code 

Turns the sniffer on such that pnext() will start returning observed data.

Parameters:
  • channel (Integer) - Sets the channel, optional
Returns: None

__get_default_modulation(channel)
Static Method

source code 

Return the Wislab-specific integer representing the modulation which should be choosen to be IEEE 802.15.4 complinating for a given channel number. Captured values from sniffing Wislab web interface, unsure why these are done as such. Available modulations are listed at: http://www.sewio.net/open-sniffer/develop/http-rest-interface/

Returns: Integer, or None if unable to determine modulation

set_channel(self, channel)

source code 

Sets the radio interface to the specifid channel (limited to 2.4 GHz channels 11-26)

Parameters:
  • channel (Integer) - Sets the channel, optional
Returns: None

__parse_zep_v2(data)
Static Method

source code 

Parse the packet from the ZigBee encapsulation protocol version 2/3 and return the fields desired for usage by pnext(). There is support here for some oddities specific to the Wislab implementation of ZEP and the packet, such as CC24xx format FCS headers being expected.

The ZEP protocol parsing is mainly based on Wireshark source at: http://anonsvn.wireshark.org/wireshark/trunk/epan/dissectors/packet-zep.c * ZEP v2 Header will have the following format (if type=1/Data): * |Preamble|Version| Type |Channel ID|Device ID|CRC/LQI Mode|LQI Val|NTP Timestamp|Sequence#|Reserved|Length| * |2 bytes |1 byte |1 byte| 1 byte | 2 bytes | 1 byte |1 byte | 8 bytes | 4 bytes |10 bytes|1 byte| * ZEP v2 Header will have the following format (if type=2/Ack): * |Preamble|Version| Type |Sequence#| * |2 bytes |1 byte |1 byte| 4 bytes | #define ZEP_PREAMBLE "EX" #define ZEP_V2_HEADER_LEN 32 #define ZEP_V2_ACK_LEN 8 #define ZEP_V2_TYPE_DATA 1 #define ZEP_V2_TYPE_ACK 2 #define ZEP_LENGTH_MASK 0x7F

pnext(self, timeout=100)

source code 

Returns a dictionary containing packet data, else None.

Parameters:
  • timeout (Integer) - Timeout to wait for packet reception in usec
Returns: List
Returns None is timeout expires and no packet received. When a packet is received, a dictionary is returned with the keys bytes (string of packet bytes), validcrc (boolean if a vaid CRC), rssi (unscaled RSSI), and location (may be set to None). For backwards compatibility, keys for 0,1,2 are provided such that it can be treated as if a list is returned, in the form [ String: packet contents | Bool: Valid CRC | Int: Unscaled RSSI ]

jammer_on(self, channel=None)

source code 

Not yet implemented.

Parameters:
  • channel (Integer) - Sets the channel, optional
Returns: None

jammer_off(self, channel=None)

source code 

Not yet implemented.

Returns: None
None