katnip.targets.serial module

Warning

This module is not tested yet.

class katnip.targets.serial.SerialTarget(name, device, baudrate=115200, timeout=0.5, open_at='setup', logger=None, expect_response=False)

Bases: kitty.targets.server.ServerTarget

Fuzzing over serial (uart) line.

You can tell the target whether to reconnect each test (‘pre_test’), or only at the beginning of the entire fuzzing session (‘setup’), by specifying the matching string as the open_at parameter to __init__

__init__(name, device, baudrate=115200, timeout=0.5, open_at='setup', logger=None, expect_response=False)
Parameters:
  • name – name of the target
  • device – serial device name/path
  • baudrate – baud rate of the serial channel (default: 115200)
  • timeout – receive timeout on the channel in seconds (default: 0.5)
  • open_at (str) – at what stage should the port be opened. Either ‘setup’ or ‘pre_test’ (default: ‘setup’)
  • logger – logger for this object (default: None)
  • expect_response – should wait for response from the victim (default: False)
Examples:
>>> SerialTarget('SomeTarget', '/dev/ttyUSB0', 57600)
>>> SerialTarget('ToTarget', '/dev/ttyUSB0', timeout=5)
post_test(test_num)

Called after each test

Parameters:test_num – the test number
pre_test(test_num)

Called before each test

Parameters:test_num – the test number
setup()
teardown()