Skip to content

just use the original interface #55

@windrg

Description

@windrg

Hi,
Thanks for your work.
Now I'm writing to a script which reads a pcapng file from other sniffing machine
and add a comment on some specific packets and writes it in a seperate file in my machine.
In the middle of that, I met the below exception. I wonder why it's necessary to raise "duplicate interface_id...".

        if type(blk) is blocks.InterfaceDescription:
            # Have we already written this interface?
            if blk.interface_id in self.interfaces:
                # We have. Should this be an error?
                raise PcapngDumpError(
                    "duplicate interface_id {}".format(blk.interface_id)
                )
            # No, so add it
            self.interfaces.add(blk.interface_id)

Can we add "else" like this?

        if type(blk) is blocks.InterfaceDescription:
            # Have we already written this interface?
            if blk.interface_id in self.interfaces:
                # We have. Should this be an error?
                raise PcapngDumpError(
                    "duplicate interface_id {}".format(blk.interface_id)
                )
             else:
                # No, so add it
                self.interfaces.add(blk.interface_id)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions