This code allows you to connect to a serial port and display incoming data in real time. It also includes options to format, filter, and log the data.
The code is written in Python and requires the serial
and sys
modules. It includes the following features:
The following data format options are available:
hex
: binary data is converted to a hexadecimal string representationascii
: binary data is converted to an ASCII string representationbinary
: binary data is converted to a binary string representation
The following logging options are available:
none
: no data is loggedfile
: data is logged to a specified file
The following filtering options are available:
none
: no filtering is appliedprintable
: only printable ASCII characters are included in the output
The following is the recommended procedure for using the code:
- Clone the repository or download the code
- Install the required modules (
serial
andsys
) - Connect to the serial port
- Specify the baud rate and any optional parameters (data format, logging, and filtering)
- Run the code
- View the incoming data in real-time
- The data can be optionally filtered and/or logged for analysis later
To connect to a serial port at 9600 baud and display incoming data in hexadecimal format, use the following command:
python serialdatalogger.py COM1 9600 hex
To filter out non-printable ASCII characters from the output, use the following command:
python serialdatalogger.py COM1 9600 hex none none printable
To log the incoming data to a file called log.txt, use the following command:
python serialdatalogger.py COM1 9600 hex file log.txt none
The serial data hex dump code provides a flexible and customizable tool for digital forensics investigators to extract and analyze data from devices that communicate via a serial port. By using the various formatting, filtering, and logging options, investigators can obtain valuable information that can aid in their investigations.