Skip to content

S7Comm Response Parsing Error #740

@donadelden

Description

@donadelden

I am not able to read the values of an S7Comm packet received after a read request. Instead, I get errors or empty strings.

Reproduce
After reading the attached file qut7-sample.zip (it is a sample of the QUT S7 dataset)

for packet in pyshark.FileCapture(pcap_file, display_filter='s7comm'):
    s7 = packet.s7comm
    if int(s7.header_rosctr) == 3 and hasattr(s7, "data_item"): 
        # this is the packet I've been having trouble reading
        for i in s7.data_item.all_fields:
            print(f"{raw_value}") 

While raw_value returns an empty value, int_value returns .../.venv/lib/python3.12/site-packages/pyshark/packet/fields.py", line 66, in int_value\n return int(self.raw_value)\n ^^^^^^^^^^^^^^^^^^^\nValueError: invalid literal for int() with base 10: \'\'\n'

Expected behavior
I'm expecting to get the value of the field, as correctly displayed on Wireshark:
Image
Instead, you get an empty string.

Versions

  • OS: Ubuntu 24.04.3, Python 3.12
  • Pyshark 0.6,
  • Tshark/Wireshark 4.2.2-1.1build3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions