expliot.plugins.zbauditor.zbadeviceinfo

Support for Zigbee Auditor Device Information.

Classes

ZbAuditor

Zigbee Auditor Class.

TCategory

Representation of Test Category.

Test

Representation of Test.

TTarget

Representation of Test Target class.

ZbAuditorDevInfo

Zigbee Auditor Device information Plugin.

Module Contents

class expliot.plugins.zbauditor.zbadeviceinfo.ZbAuditor

Zigbee Auditor Class.

get_interface_info()

Return Device information in dictionary format.

Returns:

Dictionary of Device Name, FW Revision, Services

set_channel(channel, page=0)

Validate and Set Channel to Device.

get_channel()

Return Channel from Device.

get_radio_on_flag()

Return status of radio_on flag.

set_radio_on_flag(flag)

Set radio_on flag.

get_sniffer_on_flag()

Return status of sniffer_on flag.

set_sniffer_on_flag(flag)

Set sniffer_on flag.

radio_on()

Turn on device radio.

sniffer_on(channel, page=0)

Turn on device sniffer service.

packet_read(timeout=100)

Read data from device.

radio_off()

Turn off device radio.

sniffer_off()

Turn off device sniffer service.

inject_packet(packet)

Inject packet to Device.

scan_zb_network(mask)

Set Device in network scan mode.

Additionally it return network scan result as dictionary.

get_rxcount()

Return packet receive count from driver.

Returns:

rx count

get_txcount()

Return packet transmit count from driver.

Returns:

tx count

__del__()

Close the driver.

class expliot.plugins.zbauditor.zbadeviceinfo.TCategory(tech, iface, action)

Bases: namedtuple('TCategory', 'tech, iface, action')

Representation of Test Category.

The class that defines the category of the test case. It is part of the Test class member _category. It can be used to identify the type of test or search for a specific category. It is a namedtuple that defines three attributes (for categorizing test cases).

  1. tech: What technology does the test use

  2. iface: Interface of the test i.e. whether it is for software or hardware

  3. action: What action does the test perform i.e. is it an exploit or a

    recon test for example.

COAP = 'coap'
DICOM = 'dicom'
HTTP = 'http'
MDNS = 'mdns'
MODBUS = 'modbus'
MQTT = 'mqtt'
TCP = 'tcp'
TLS = 'tls'
UDP = 'udp'
UPNP = 'upnp'
BLE = 'ble'
IEEE802154 = '802154'
ZIGBEE = 'zigbee'
CAN = 'can'
I2C = 'i2c'
JTAG = 'jtag'
SPI = 'spi'
UART = 'uart'
CRYPTO = 'crypto'
FW = 'firmware'
DISCLOSURE = 'disclosure'
ZB_AUDITOR = 'zbauditor'
BUS_AUDITOR = 'busauditor'
FW_AUDITOR = 'fwauditor'
NMAP = 'nmap'
_tech
HW = 'hardware'
RD = 'radio'
SW = 'software'
_interfaces
ANALYSIS = 'analysis'
COMPLIANCE = 'compliance'
DISCOVERY = 'discovery'
EXPLOIT = 'exploit'
FUZZ = 'fuzz'
RECON = 'recon'
_actions
class expliot.plugins.zbauditor.zbadeviceinfo.Test(**kwargs)

Representation of Test.

The Base class for test cases (plugins). It defines the basic interface and basic implementation for the test cases. All test case plugins need to inherit from a test class derived from this class or this class itself depending on the purpose of the test case.

pre()

Action to take before the test.

post()

Action to take after the test.

execute()

Execute the test.

intro()

Show the intro for test.

output_dict_iter(cblog, robj, rlevel, key=None, value=None)

Callback method for recurse_list_dict().

It iterates over the dict

output passed from a plugin to output_handler(). It performs two operations on the dict

  1. If the output data is to be TLog(ged) (LOGPRETTY) on the console, then log the data recursively from the dict.

  2. Convert any bytes or bytearray objects in the dict to binary string and update the original dict object itself.

Args:
cblog (dict): Contains logging information i.e. to log the data or not?

and the Log prefix type.

robj (list or dict): The list or dict object at the specified recursion

level. This is updated by this callback i.e. bytes and bytearray objects found are converted to binary strings.

rlevel (int): The current recursion level at which this callback

instance is called.

key (str): The key if the robj is a dict. value (can be any type): 1. The value of the key if robj is a dict or

  1. A value from the robj if it is a list

Returns:

Nothing

output_handler(tlogtype=TLog.SUCCESS, msg=None, logkwargs=LOGPRETTY, **kwargs)

Handle the Test execution output data.

  • Add(append) data (dict) as an item in the TResult output (list).

  • And/or Log (print) the output

Args:
tlogtype (int): TLog prefix type to use i.e. Success, fail etc.

Check TLog class for prefix details.

msg (str): Specify a message to be logged, if any, apart from

output data.

logkwargs=LOGPRETTY(int): There are three options for kwargs logging

LOGPRETTY(0) - formatted logging for dict or list. LOGNORMAL(1) - Direct print of dict or list as is. LOGNO(2) - Do not log kwargs.

**kwargs: plugin output keyword arguments (or a **dictObject)

Returns:

Nothing.

run(arglist)

Run the test.

Args:

arglist (list): The argument list of the plugin.

Returns:
dict: The plugin result (status and output) on success,

or an empty dict in case of any error.

_assertpriv()

Raise an exception if the plugin needs root privileges.

Only if program is not executing as root.

Args:

None

Returns:

Nothing

_setid()

Set the Unique Test ID.

The ID is the plugin class name in lowercase.

Args:

None

Returns:

Nothing

_logstatus()

Handle the log status.

Args:

None

Returns:

Nothing

class expliot.plugins.zbauditor.zbadeviceinfo.TTarget(name, version, vendor)

Bases: namedtuple('TTarget', 'name, version, vendor')

Representation of Test Target class.

Class that hold details about the target of the test. It is a namedtuple and holds the below details:

  1. name - Target/product name

  2. version - Version of the product

  3. vendor - Vendor that owns the product

Please note, in case it is a generic test case that can be used for multiple products use Target.GENERIC for all attributes.

GENERIC = 'generic'
LINUX = 'linux'
AWS = 'aws'
_name
AMAZON = 'amazon'
_vendor
class expliot.plugins.zbauditor.zbadeviceinfo.ZbAuditorDevInfo

Bases: expliot.core.tests.test.Test

Zigbee Auditor Device information Plugin.

Output Format: [

{

‘device_name’: ‘ZigBee Auditor’, ‘fw_revision’: ‘1.0.3’, ‘serial_number’: ‘E761FB48B6E4’, ‘services’: {

‘read_revision’: True, ‘read_services’: True, ‘channel_selection’: True, ‘radio on_off’: True, ‘802.15.4_sniffer’: True, ‘802.15.4_injection’: True, ‘802.15.4_network_scan’: True, ‘2.4_ghz’: True

}

}

]

execute()

Execute the test.