Skip to content
Snippets Groups Projects
Commit d6d61091 authored by Corentin Henry's avatar Corentin Henry
Browse files

Fix packet generator for classes inheritating from list

SetGen is broken for custom list classes as illustrated by the following
example:

    >>> packet = Ether() / IP()
    >>> packet_list = [packet, packet]
    >>> sendp(packet_list)
    ..
    Sent 2 packets.
    >>> # Now let's do the same with a custom class
    >>> class MyList(list): pass
    ...
    >>> weird_packet_list = MyList(packet_list)
    >>> len(weird_packet_list)
    2
    >>> sendp(weird_packet_list)
    .
    Sent 1 packets.
    >>> # Only one packet is sent instead of two.
    >>> # This is due to SetGen using type() instead of insinstance() to check
    >>> # the nature of the arguments. Indeed:
    >>> type(weird_packet_list)
    <class 'scapy.all.MyList'>
    >>> isinstance(weird_packet_list, list)
    True

--HG--
extra : rebase_source : aeb2b7bd46f3cb4cf0491bbea4a38157e93ecb71
parent ff04f75e
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment