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
Loading
Please register or sign in to comment