pyecsca.sca.target.chipwhisperer module

Provides a ChipWhisperer target class.

ChipWhisperer is a side-channel analysis tool and framework. A ChipWhisperer target is one that uses the ChipWhisperer’s SimpleSerial communication protocol and is communicated with using ChipWhisperer-Lite or Pro.

class pyecsca.sca.target.chipwhisperer.ChipWhispererTarget(target, scope, programmer, **kwargs)[source]

Bases: Flashable, SimpleSerialTarget

ChipWhisperer-based target, using the SimpleSerial-ish protocol and communicating using ChipWhisperer-Lite/Pro.

connect()[source]

Connect to the target device.

flash(fw_path)[source]

Flash the firmware at fw_path to the target.

Parameters:

fw_path (str) – The path to the firmware blob.

Return type:

bool

Returns:

Whether the flashing was successful.

write(data)[source]

Write the data bytes to the target’s serial input.

Parameters:

data (bytes) – The data to write.

Return type:

None

read(num=0, timeout=0)[source]

Read upto num bytes or until timeout milliseconds from the target’s serial output.

Parameters:
  • num (int) – The number of bytes to read, 0 for all available.

  • timeout (int) – The timeout in milliseconds.

Return type:

bytes

Returns:

The bytes read.

reset()[source]
disconnect()[source]

Disconnect from the target device.

recv_msgs(timeout)

Receive SimpleSerialMessage messages, while waiting upto timeout seconds.

Parameters:

timeout (int) – How long to wait.

Return type:

Mapping[str, SimpleSerialMessage]

Returns:

The received messages with their char.

send_cmd(cmd, timeout)

Send a SimpleSerialMessage and receive the response messages that the command produces, within a timeout.

Parameters:
  • cmd (SimpleSerialMessage) – The command message to send.

  • timeout (int) – The timeout value to wait for the responses.

Return type:

Mapping[str, SimpleSerialMessage]

Returns:

A mapping of the starting character of the message to the message.