expliot.core.tests.test

Module Contents

class expliot.core.tests.test.TCategory(proto, iface, action)

Bases: collections.namedtuple()

TCategory class

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. proto - What protocol 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
MQTT = mqtt
UDP = udp
MODBUS = modbus
DICOM = dicom
BLE = ble
ZIGBEE = zigbee
CAN = can
UART = uart
JTAG = jtag
I2C = i2c
SPI = spi
_protocols
SW = software
HW = hardware
RD = radio
_interfaces
RECON = recon
DISCOVERY = discovery
ANALYSIS = analysis
FUZZ = fuzz
EXPLOIT = exploit
_actions
class expliot.core.tests.test.TTarget(name, version, vendor)

Bases: collections.namedtuple()

TTarget 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
class expliot.core.tests.test.TResult

Representation of a test result.

defaultrsn = No reason specified
setstatus(self, passed=True, reason=None)

Set the Test result status.

Parameters:
  • passed – True or False
  • reason – Reason for failure if any
Returns:

exception(self)

Set passed to False and reason to the exception message.

Returns:
class expliot.core.tests.test.TLog

TLog

Logger class for logging test case output. By default log to sys.stdout Must not instantiate. Use class methods. The logger needs to be initialized with the output file using init() class method

_f
_spre = [+]
_fpre = [-]
_tpre = [?]
_gpre = [*]
classmethod init(cls, file=None)

Initialize the file object. This method should be called in the beginning of the application to open the log output file.

Parameters:file – The file where to log Test output
Returns:void
classmethod close(cls)

Close the file object if it is not sys.stdout.

Returns:
classmethod _p(cls, prefix, msg)

The actual print methods that write the formatted message to the _f file. :param prefix: the prefix to be used for the message (defined above) :param msg: The actual message from the Test object :return: void

classmethod success(cls, msg)

Write a message with success prefix to the file.

Parameters:msg – The message to be written
Returns:void
classmethod fail(cls, msg)

Write a message with fail prefix to the file.

Parameters:msg – The message to be written
Returns:void
classmethod trydo(cls, msg)

Write a message with try prefix to the file.

Parameters:msg – The message to be written
Returns:void
classmethod generic(cls, msg)

Write a message with success prefix to the file.

Parameters:msg – The message to be written
Returns:void
class expliot.core.tests.test.Test(**kwargs)

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(self)
post(self)
execute(self)
intro(self)
run(self, arglist)
_assertpriv(self)

Raise an exception if the plugin needs root privileges but program is not executing as root.

Returns:
_setid(self)

Set the Unique Test ID. The ID is the plugin class name in lower case.

Returns:
_logstatus(self)

Handle the log status.

Returns: