Closed jschwinger233 closed 3 years ago
Scapy hangs after rdpcap('bgp.pcap'), please download the pcap via link
rdpcap('bgp.pcap')
2.4.5rc1.dev89
3.8.10
Linux 5.8.0-50-generic
No response
curl -OL https://gist.github.com/jschwinger23/8a4cf4b13047b8b6086576413f1a60d5/raw/c51ac8e316c34b3b210f2e4965e4fa12c1ca7e78/bgp.pcap
load_contrib('bgp')
p = rdpcap('bgp.pcap')
If I press Ctrl-C to interrupt, the stack frames are
Ctrl-C
>>> load_contrib('bgp') WARNING: [bgp.py] use_2_bytes_asn: True >>> p = rdpcap('bgp.pcap') ^C--------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last) <ipython-input-2-3f100d0bd1c5> in <module> ----> 1 p = rdpcap('bgp.pcap') ~/.local/lib/python3.8/site-packages/scapy/utils.py in rdpcap(filename, count) 1115 # layout that will actually be supported and properly dissected. 1116 with PcapReader(filename) as fdesc: # type: ignore -> 1117 return fdesc.read_all(count=count) 1118 1119 ~/.local/lib/python3.8/site-packages/scapy/utils.py in read_all(self, count) 1383 def read_all(self, count=-1): 1384 # type: (int) -> PacketList -> 1385 res = self._read_all(count) 1386 from scapy import plist 1387 return plist.PacketList(res, name=os.path.basename(self.filename)) ~/.local/lib/python3.8/site-packages/scapy/utils.py in _read_all(self, count) 1293 count -= 1 1294 try: -> 1295 p = self.read_packet() # type: Packet 1296 except EOFError: 1297 break ~/.local/lib/python3.8/site-packages/scapy/utils.py in read_packet(self, size) 1629 try: 1630 cls = conf.l2types.num2layer[linktype] # type: Type[Packet] -> 1631 p = cls(s) # type: Packet 1632 except KeyboardInterrupt: 1633 raise ~/.local/lib/python3.8/site-packages/scapy/base_classes.py in __call__(cls, *args, **kargs) 387 cls.__dict__ 388 ) --> 389 i.__init__(*args, **kargs) 390 return i # type: ignore 391 ~/.local/lib/python3.8/site-packages/scapy/packet.py in __init__(self, _pkt, post_transform, _internal, _underlayer, **fields) 157 self.sniffed_on = None # type: Optional[_GlobInterfaceType] 158 if _pkt: --> 159 self.dissect(_pkt) 160 if not _internal: 161 self.dissection_done(self) ~/.local/lib/python3.8/site-packages/scapy/packet.py in dissect(self, s) 997 998 payl, pad = self.extract_padding(s) --> 999 self.do_dissect_payload(payl) 1000 if pad and conf.padding: 1001 self.add_payload(conf.padding_layer(pad)) ~/.local/lib/python3.8/site-packages/scapy/packet.py in do_dissect_payload(self, s) 972 cls = self.guess_payload_class(s) 973 try: --> 974 p = cls(s, _internal=1, _underlayer=self) 975 except KeyboardInterrupt: 976 raise ~/.local/lib/python3.8/site-packages/scapy/base_classes.py in __call__(cls, *args, **kargs) 387 cls.__dict__ 388 ) --> 389 i.__init__(*args, **kargs) 390 return i # type: ignore 391 ~/.local/lib/python3.8/site-packages/scapy/packet.py in __init__(self, _pkt, post_transform, _internal, _underlayer, **fields) 157 self.sniffed_on = None # type: Optional[_GlobInterfaceType] 158 if _pkt: --> 159 self.dissect(_pkt) 160 if not _internal: 161 self.dissection_done(self) ~/.local/lib/python3.8/site-packages/scapy/packet.py in dissect(self, s) 997 998 payl, pad = self.extract_padding(s) --> 999 self.do_dissect_payload(payl) 1000 if pad and conf.padding: 1001 self.add_payload(conf.padding_layer(pad)) ~/.local/lib/python3.8/site-packages/scapy/packet.py in do_dissect_payload(self, s) 972 cls = self.guess_payload_class(s) 973 try: --> 974 p = cls(s, _internal=1, _underlayer=self) 975 except KeyboardInterrupt: 976 raise ~/.local/lib/python3.8/site-packages/scapy/base_classes.py in __call__(cls, *args, **kargs) 387 cls.__dict__ 388 ) --> 389 i.__init__(*args, **kargs) 390 return i # type: ignore 391 ~/.local/lib/python3.8/site-packages/scapy/packet.py in __init__(self, _pkt, post_transform, _internal, _underlayer, **fields) 157 self.sniffed_on = None # type: Optional[_GlobInterfaceType] 158 if _pkt: --> 159 self.dissect(_pkt) 160 if not _internal: 161 self.dissection_done(self) ~/.local/lib/python3.8/site-packages/scapy/packet.py in dissect(self, s) 997 998 payl, pad = self.extract_padding(s) --> 999 self.do_dissect_payload(payl) 1000 if pad and conf.padding: 1001 self.add_payload(conf.padding_layer(pad)) ~/.local/lib/python3.8/site-packages/scapy/packet.py in do_dissect_payload(self, s) 972 cls = self.guess_payload_class(s) 973 try: --> 974 p = cls(s, _internal=1, _underlayer=self) 975 except KeyboardInterrupt: 976 raise ~/.local/lib/python3.8/site-packages/scapy/base_classes.py in __call__(cls, *args, **kargs) 387 cls.__dict__ 388 ) --> 389 i.__init__(*args, **kargs) 390 return i # type: ignore 391 ~/.local/lib/python3.8/site-packages/scapy/packet.py in __init__(self, _pkt, post_transform, _internal, _underlayer, **fields) 157 self.sniffed_on = None # type: Optional[_GlobInterfaceType] 158 if _pkt: --> 159 self.dissect(_pkt) 160 if not _internal: 161 self.dissection_done(self) ~/.local/lib/python3.8/site-packages/scapy/packet.py in dissect(self, s) 997 998 payl, pad = self.extract_padding(s) --> 999 self.do_dissect_payload(payl) 1000 if pad and conf.padding: 1001 self.add_payload(conf.padding_layer(pad)) ~/.local/lib/python3.8/site-packages/scapy/packet.py in do_dissect_payload(self, s) 972 cls = self.guess_payload_class(s) 973 try: --> 974 p = cls(s, _internal=1, _underlayer=self) 975 except KeyboardInterrupt: 976 raise ~/.local/lib/python3.8/site-packages/scapy/base_classes.py in __call__(cls, *args, **kargs) 387 cls.__dict__ 388 ) --> 389 i.__init__(*args, **kargs) 390 return i # type: ignore 391 ~/.local/lib/python3.8/site-packages/scapy/packet.py in __init__(self, _pkt, post_transform, _internal, _underlayer, **fields) 157 self.sniffed_on = None # type: Optional[_GlobInterfaceType] 158 if _pkt: --> 159 self.dissect(_pkt) 160 if not _internal: 161 self.dissection_done(self) ~/.local/lib/python3.8/site-packages/scapy/packet.py in dissect(self, s) 992 s = self.pre_dissect(s) 993 --> 994 s = self.do_dissect(s) 995 996 s = self.post_dissect(s) ~/.local/lib/python3.8/site-packages/scapy/packet.py in do_dissect(self, s) 949 if not s: 950 break --> 951 s, fval = f.getfield(self, s) 952 # Skip unused ConditionalField 953 if isinstance(f, ConditionalField) and fval is None: ~/.local/lib/python3.8/site-packages/scapy/fields.py in getfield(self, pkt, s) 1417 ): 1418 # type: (...) -> Tuple[bytes, K] -> 1419 i = self.m2i(pkt, s) 1420 remain = b"" 1421 if conf.padding_layer in i: ~/.local/lib/python3.8/site-packages/scapy/fields.py in m2i(self, pkt, m) 1410 def m2i(self, pkt, m): 1411 # type: (Optional[Packet], bytes) -> Packet -> 1412 return self.cls(m) 1413 1414 def getfield(self, ~/.local/lib/python3.8/site-packages/scapy/base_classes.py in __call__(cls, *args, **kargs) 387 cls.__dict__ 388 ) --> 389 i.__init__(*args, **kargs) 390 return i # type: ignore 391 ~/.local/lib/python3.8/site-packages/scapy/packet.py in __init__(self, _pkt, post_transform, _internal, _underlayer, **fields) 157 self.sniffed_on = None # type: Optional[_GlobInterfaceType] 158 if _pkt: --> 159 self.dissect(_pkt) 160 if not _internal: 161 self.dissection_done(self) ~/.local/lib/python3.8/site-packages/scapy/packet.py in dissect(self, s) 992 s = self.pre_dissect(s) 993 --> 994 s = self.do_dissect(s) 995 996 s = self.post_dissect(s) ~/.local/lib/python3.8/site-packages/scapy/packet.py in do_dissect(self, s) 949 if not s: 950 break --> 951 s, fval = f.getfield(self, s) 952 # Skip unused ConditionalField 953 if isinstance(f, ConditionalField) and fval is None: ~/.local/lib/python3.8/site-packages/scapy/contrib/bgp.py in getfield(self, pkt, s) 2463 current = remain[:orf_len] 2464 remain = remain[orf_len:] -> 2465 packet = self.m2i(pkt, current) 2466 lst.append(packet) 2467 ~/.local/lib/python3.8/site-packages/scapy/contrib/bgp.py in m2i(self, pkt, m) 2406 2407 else: -> 2408 ret = conf.raw_layer(m) 2409 2410 return ret ~/.local/lib/python3.8/site-packages/scapy/base_classes.py in __call__(cls, *args, **kargs) 387 cls.__dict__ 388 ) --> 389 i.__init__(*args, **kargs) 390 return i # type: ignore 391 ~/.local/lib/python3.8/site-packages/scapy/packet.py in __init__(self, _pkt, *args, **kwargs) 1923 if _pkt and not isinstance(_pkt, bytes): 1924 _pkt = bytes_encode(_pkt) -> 1925 super(Raw, self).__init__(_pkt, *args, **kwargs) 1926 1927 def answers(self, other): ~/.local/lib/python3.8/site-packages/scapy/packet.py in __init__(self, _pkt, post_transform, _internal, _underlayer, **fields) 146 self.fieldtype = {} # type: Dict[str, AnyField] 147 self.packetfields = [] # type: List[AnyField] --> 148 self.payload = NoPayload() 149 self.init_fields() 150 self.underlayer = _underlayer ~/.local/lib/python3.8/site-packages/scapy/packet.py in __setattr__(self, attr, val) 459 if attr == "sent_time": 460 self.update_sent_time(val) --> 461 return object.__setattr__(self, attr, val) 462 try: 463 return self.setfieldval(attr, val) KeyboardInterrupt: >>>
The pcap actually can be parsed by tshark, and here's the result:
$ tshark -r bgp.pcap -V Frame 1: 361 bytes on wire (2888 bits), 361 bytes captured (2888 bits) on interface unknown, id 0 Interface id: 0 (unknown) Interface name: unknown Encapsulation type: Ethernet (1) Arrival Time: Aug 22, 2021 18:55:17.463930000 +08 [Time shift for this packet: 0.000000000 seconds] Epoch Time: 1629629717.463930000 seconds [Time delta from previous captured frame: 0.000000000 seconds] [Time delta from previous displayed frame: 0.000000000 seconds] [Time since reference or first frame: 0.000000000 seconds] Frame Number: 1 Frame Length: 361 bytes (2888 bits) Capture Length: 361 bytes (2888 bits) [Frame is marked: False] [Frame is ignored: False] [Protocols in frame: eth:ethertype:ip:tcp:bgp] Ethernet II, Src: HuaweiTe_8b:cf:90 (f8:6e:ee:8b:cf:90), Dst: HuaweiTe_d9:8d:4c (cc:bb:fe:d9:8d:4c) Destination: HuaweiTe_d9:8d:4c (cc:bb:fe:d9:8d:4c) Address: HuaweiTe_d9:8d:4c (cc:bb:fe:d9:8d:4c) .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) .... ...0 .... .... .... .... = IG bit: Individual address (unicast) Source: HuaweiTe_8b:cf:90 (f8:6e:ee:8b:cf:90) Address: HuaweiTe_8b:cf:90 (f8:6e:ee:8b:cf:90) .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) .... ...0 .... .... .... .... = IG bit: Individual address (unicast) Type: IPv4 (0x0800) Internet Protocol Version 4, Src: 10.22.12.88, Dst: 10.22.12.44 0100 .... = Version: 4 .... 0101 = Header Length: 20 bytes (5) Differentiated Services Field: 0xc0 (DSCP: CS6, ECN: Not-ECT) 1100 00.. = Differentiated Services Codepoint: Class Selector 6 (48) .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0) Total Length: 347 Identification: 0x6688 (26248) Flags: 0x4000, Don't fragment 0... .... .... .... = Reserved bit: Not set .1.. .... .... .... = Don't fragment: Set ..0. .... .... .... = More fragments: Not set Fragment offset: 0 Time to live: 64 Protocol: TCP (6) Header checksum: 0xa5a5 [validation disabled] [Header checksum status: Unverified] Source: 10.22.12.88 Destination: 10.22.12.44 Transmission Control Protocol, Src Port: 47689, Dst Port: 179, Seq: 1, Ack: 1, Len: 307 Source Port: 47689 Destination Port: 179 [Stream index: 0] [TCP Segment Len: 307] Sequence number: 1 (relative sequence number) Sequence number (raw): 2001537567 [Next sequence number: 308 (relative sequence number)] Acknowledgment number: 1 (relative ack number) Acknowledgment number (raw): 438819095 0101 .... = Header Length: 20 bytes (5) Flags: 0x018 (PSH, ACK) 000. .... .... = Reserved: Not set ...0 .... .... = Nonce: Not set .... 0... .... = Congestion Window Reduced (CWR): Not set .... .0.. .... = ECN-Echo: Not set .... ..0. .... = Urgent: Not set .... ...1 .... = Acknowledgment: Set .... .... 1... = Push: Set .... .... .0.. = Reset: Not set .... .... ..0. = Syn: Not set .... .... ...0 = Fin: Not set [TCP Flags: ·······AP···] Window size value: 237 [Calculated window size: 237] [Window size scaling factor: -1 (unknown)] Checksum: 0xd946 [unverified] [Checksum Status: Unverified] Urgent pointer: 0 [SEQ/ACK analysis] [Bytes in flight: 307] [Bytes sent since last PSH flag: 307] [Timestamps] [Time since first frame in this TCP stream: 0.000000000 seconds] [Time since previous frame in this TCP stream: 0.000000000 seconds] TCP payload (307 bytes) Border Gateway Protocol - ROUTE-REFRESH Message Marker: ffffffffffffffffffffffffffffffff Length: 23 Type: ROUTE-REFRESH Message (5) Address family identifier (AFI): IPv4 (1) Subtype: Demarcation of the beginning of a route refresh (1) Subsequent address family identifier (SAFI): Unicast (1) Border Gateway Protocol - UPDATE Message Marker: ffffffffffffffffffffffffffffffff Length: 208 Type: UPDATE Message (2) Withdrawn Routes Length: 185 Withdrawn Routes 0.0.0.0/0 PathId 2 NLRI path id: 2 Prefix Length: 0 Withdrawn prefix: 0.0.0.0 10.233.25.178/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.178 10.233.25.144/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.144 10.233.25.147/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.147 10.233.25.187/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.187 10.233.25.159/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.159 10.233.25.140/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.140 10.233.25.177/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.177 10.233.25.143/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.143 10.233.25.152/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.152 10.233.25.155/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.155 10.233.25.139/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.139 10.233.25.179/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.179 10.233.25.145/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.145 10.233.25.182/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.182 10.233.25.148/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.148 10.233.25.151/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.151 10.233.25.188/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.188 10.233.25.157/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.157 10.233.25.163/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.163 10.233.25.132/32 PathId 4 NLRI path id: 4 Prefix Length: 32 Withdrawn prefix: 10.233.25.132 Total Path Attribute Length: 0 Border Gateway Protocol - UPDATE Message Marker: ffffffffffffffffffffffffffffffff Length: 53 Type: UPDATE Message (2) Withdrawn Routes Length: 0 Total Path Attribute Length: 21 Path attributes Path Attribute - ORIGIN: IGP Flags: 0x40, Transitive, Well-known, Complete 0... .... = Optional: Not set .1.. .... = Transitive: Set ..0. .... = Partial: Not set ...0 .... = Extended-Length: Not set .... 0000 = Unused: 0x0 Type Code: ORIGIN (1) Length: 1 Origin: IGP (0) Path Attribute - AS_PATH: empty Flags: 0x40, Transitive, Well-known, Complete 0... .... = Optional: Not set .1.. .... = Transitive: Set ..0. .... = Partial: Not set ...0 .... = Extended-Length: Not set .... 0000 = Unused: 0x0 Type Code: AS_PATH (2) Length: 0 Path Attribute - NEXT_HOP: 10.22.12.88 Flags: 0x40, Transitive, Well-known, Complete 0... .... = Optional: Not set .1.. .... = Transitive: Set ..0. .... = Partial: Not set ...0 .... = Extended-Length: Not set .... 0000 = Unused: 0x0 Type Code: NEXT_HOP (3) Length: 4 Next hop: 10.22.12.88 Path Attribute - LOCAL_PREF: 100 Flags: 0x40, Transitive, Well-known, Complete 0... .... = Optional: Not set .1.. .... = Transitive: Set ..0. .... = Partial: Not set ...0 .... = Extended-Length: Not set .... 0000 = Unused: 0x0 Type Code: LOCAL_PREF (5) Length: 4 Local preference: 100 Network Layer Reachability Information (NLRI) 10.233.0.22/32 PathId 2 NLRI path id: 2 Prefix Length: 32 NLRI prefix: 10.233.0.22 Border Gateway Protocol - ROUTE-REFRESH Message Marker: ffffffffffffffffffffffffffffffff Length: 23 Type: ROUTE-REFRESH Message (5) Address family identifier (AFI): IPv4 (1) Subtype: Demarcation of the ending of a route refresh (2) Subsequent address family identifier (SAFI): Unicast (1)
I ran a profile for this, and here's part of the output:
$ cat scapy_bug.py load_contrib('bgp') rdpcap('bgp.pcap') $ /usr/bin/python3 -mcProfile -s calls /usr/local/bin/scapy -c scapy_bug.py Ordered by: call count ncalls tottime percall cumtime percall filename:lineno(function) 43635869 12.852 0.000 13.095 0.000 packet.py:456(__setattr__) 11899790 1.702 0.000 1.702 0.000 packet.py:333(get_field) 11899650 0.934 0.000 0.934 0.000 fields.py:199(i2h) 11899650 6.199 0.000 14.138 0.000 packet.py:425(__getattr__) 11899650 5.304 0.000 7.006 0.000 packet.py:413(getfield_and_val) 5954674 0.603 0.000 0.603 0.000 {method 'get' of 'dict' objects} 4136270 0.783 0.000 0.783 0.000 {built-in method builtins.isinstance} 3966836/80 11.001 0.000 73.444 0.918 base_classes.py:370(__call__) 2014650 0.224 0.000 0.224 0.000 {method 'append' of 'list' objects} 1989295 0.476 0.000 0.480 0.000 {built-in method __new__ of type object at 0x908780} 1987594 1.930 0.000 2.380 0.000 typing.py:868(__new__) 1985987 0.322 0.000 0.322 0.000 {method 'pop' of 'dict' objects} 1984601/1984577 0.956 0.000 0.956 0.000 config.py:863(__getattribute__) 1983748 0.425 0.000 0.425 0.000 {method 'get' of 'mappingproxy' objects} 1983434 0.335 0.000 0.335 0.000 {built-in method time.time} 1983418/80 10.063 0.000 73.443 0.918 packet.py:129(__init__) 1983418/1983359 1.288 0.000 7.562 0.000 packet.py:224(init_fields) 1983418 0.243 0.000 0.243 0.000 packet.py:1044(update_sent_time) 1983418/1983417 0.874 0.000 1.300 0.000 packet.py:1745(__new__) 1983418 0.228 0.000 0.228 0.000 packet.py:1753(__init__) 1983416/1983357 3.676 0.000 6.016 0.000 packet.py:251(do_init_cached_fields) 1983275 1.740 0.000 40.862 0.000 packet.py:1921(__init__) 1983274 5.664 0.000 60.086 0.000 bgp.py:2390(m2i) 118568 0.035 0.000 0.059 0.000 compat.py:299(plain_str) 118473 0.017 0.000 0.017 0.000 {method 'decode' of 'bytes' objects} 77084 0.008 0.000 0.008 0.000 {method 'strip' of 'bytes' objects} 46492/46078 0.004 0.000 0.004 0.000 {built-in method builtins.len} 40109 0.012 0.000 0.012 0.000 dadict.py:130(__setitem__) 39694 0.009 0.000 0.009 0.000 {method 'split' of 'bytes' objects} 39394 0.008 0.000 0.008 0.000 {method 'startswith' of 'bytes' objects} 37183 0.004 0.000 0.004 0.000 {method 'lstrip' of 'bytes' objects} 23332 0.004 0.000 0.006 0.000 base_classes.py:343(<genexpr>) 18541 0.001 0.000 0.001 0.000 typing.py:1149(cast) 18359/18347 0.007 0.000 0.009 0.000 {built-in method builtins.hasattr} 13884 0.002 0.000 0.003 0.000 fields.py:2339(<genexpr>) 8585 0.001 0.000 0.001 0.000 {method 'startswith' of 'str' objects} 8422/8325 0.004 0.000 0.004 0.000 {built-in method builtins.getattr} 6721 0.001 0.000 0.002 0.000 dadict.py:95(iterkeys) 5291 0.001 0.000 0.001 0.000 {method 'rstrip' of 'str' objects} 5272 0.008 0.000 0.008 0.000 main.py:120(_validate_local) 4579 0.001 0.000 0.002 0.000 fields.py:174(register_owner) 4100 0.001 0.000 0.001 0.000 {built-in method _struct.calcsize} 4082 0.009 0.000 0.017 0.000 fields.py:160(__init__) 3419 0.001 0.000 0.001 0.000 {built-in method builtins.setattr} 3134 0.001 0.000 0.003 0.000 fields.py:218(any2i) 3104 0.001 0.000 0.001 0.000 fields.py:194(h2i) 3088 0.001 0.000 0.001 0.000 {method 'join' of 'str' objects} 2574 0.001 0.000 0.001 0.000 <frozen importlib._bootstrap>:222(_verbose_message) 2421 0.001 0.000 0.002 0.000 <frozen importlib._bootstrap_external>:123(<listcomp>) 2421 0.002 0.000 0.004 0.000 <frozen importlib._bootstrap_external>:121(_path_join) 2344 0.001 0.000 0.001 0.000 sre_parse.py:164(__getitem__) 2162/1769 0.016 0.000 0.239 0.000 {built-in method builtins.__build_class__} 2067 0.001 0.000 0.001 0.000 sre_parse.py:233(__next) 1870 0.000 0.000 0.000 0.000 {built-in method builtins.abs} 1635 0.000 0.000 0.001 0.000 fields.py:398(__getattr__) 1624 0.000 0.000 0.000 0.000 inspect.py:2551(kind) 1586 0.000 0.000 0.000 0.000 {method 'isupper' of 'str' objects} 1561 0.000 0.000 0.001 0.000 sre_parse.py:254(get) 1558 0.000 0.000 0.000 0.000 {method 'rpartition' of 'str' objects} 1335 0.000 0.000 0.000 0.000 {built-in method _imp.acquire_lock} 1335 0.000 0.000 0.000 0.000 {built-in method _imp.release_lock} 1228 0.000 0.000 0.000 0.000 dadict.py:126(__getitem__) 1216 0.000 0.000 0.000 0.000 {method '__init_subclass__' of 'object' objects} 1216 0.004 0.000 0.004 0.000 typing.py:900(__init_subclass__) 1214 0.000 0.000 0.000 0.000 {method 'setdefault' of 'dict' objects} 1184 0.000 0.000 0.000 0.000 inspect.py:2821(<genexpr>) 1184 0.000 0.000 0.000 0.000 inspect.py:2881(<genexpr>) 1121/1091 0.001 0.000 0.044 0.000 <frozen importlib._bootstrap>:1017(_handle_fromlist) 1104 0.000 0.000 0.000 0.000 sre_parse.py:249(match) 1098 0.000 0.000 0.000 0.000 {built-in method builtins.id} 1061 0.000 0.000 0.000 0.000 {built-in method _struct.pack} 1043 0.008 0.000 0.008 0.000 {built-in method posix.stat} 1029 0.001 0.000 0.009 0.000 <frozen importlib._bootstrap_external>:135(_path_stat) 992 0.023 0.000 0.067 0.000 base_classes.py:287(__new__) 984 0.000 0.000 0.001 0.000 typing.py:646(_is_dunder) 984 0.001 0.000 0.001 0.000 typing.py:762(__setattr__) 979 0.000 0.000 0.000 0.000 {built-in method builtins.callable} 974 0.000 0.000 0.000 0.000 {built-in method builtins.min} 974 0.001 0.000 0.002 0.000 config.py:263(register) 956 0.000 0.000 0.000 0.000 {method 'isidentifier' of 'str' objects} 940 0.001 0.000 0.001 0.000 base_classes.py:363(__getattr__) 905 0.000 0.000 0.003 0.000 enum.py:313(__call__) 898 0.000 0.000 0.000 0.000 enum.py:631(__new__) 890 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:129(<genexpr>) 884 0.000 0.000 0.000 0.000 {method 'endswith' of 'str' objects} 866 0.000 0.000 0.000 0.000 compat.py:306(chb) 825 0.000 0.000 0.000 0.000 sre_parse.py:160(__len__) 812 0.001 0.000 0.002 0.000 inspect.py:2489(__init__) 812 0.000 0.000 0.000 0.000 inspect.py:2539(name) 773 0.001 0.000 0.005 0.000 {built-in method builtins.any} 771 0.000 0.000 0.000 0.000 volatile.py:434(<genexpr>) 765 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:863(__enter__) 765 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:867(__exit__) 747 0.000 0.000 0.000 0.000 {method 'values' of 'mappingproxy' objects} 744 0.000 0.000 0.000 0.000 inspect.py:2857(parameters) 744 0.000 0.000 0.000 0.000 inspect.py:158(isfunction) 733 0.000 0.000 0.000 0.000 {built-in method posix.fspath} 719 0.000 0.000 0.000 0.000 {built-in method builtins.ord} 693 0.000 0.000 0.001 0.000 fields.py:2373(any2i) 688 0.000 0.000 0.001 0.000 fields.py:2347(any2i_one) 685 0.000 0.000 0.000 0.000 {built-in method from_bytes} 679 0.008 0.000 0.018 0.000 fields.py:2298(__init__) 665 0.001 0.000 0.001 0.000 <frozen importlib._bootstrap_external>:79(_unpack_uint32) 630/621 0.000 0.000 0.000 0.000 {built-in method builtins.iter} 623 0.000 0.000 0.000 0.000 {method 'find' of 'bytearray' objects} 615 0.000 0.000 0.000 0.000 {method 'items' of 'dict' objects} 608 0.000 0.000 0.001 0.000 {built-in method builtins.max} 583 0.000 0.000 0.000 0.000 {built-in method _thread.get_ident} 579 0.000 0.000 0.000 0.000 sre_parse.py:172(append) 572 0.000 0.000 0.000 0.000 {built-in method _thread.allocate_lock} 565 0.000 0.000 0.002 0.000 fields.py:954(__init__) 555 0.001 0.000 0.004 0.000 fields.py:2136(__init__) 545 0.000 0.000 0.000 0.000 {method 'translate' of 'str' objects} 543 0.000 0.000 0.000 0.000 sre_parse.py:286(tell) 526 0.000 0.000 0.000 0.000 {method 'find' of 'bytes' objects} 514 0.000 0.000 0.000 0.000 {method 'copy' of 'dict' objects} 513 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap_external>:1330(_path_importer_cache) 509 0.000 0.000 0.000 0.000 {method 'endswith' of 'bytes' objects} 509 0.001 0.000 0.017 0.000 re.py:289(_compile) 488 0.000 0.000 0.003 0.000 fields.py:1314(__init__) 479 0.001 0.000 0.001 0.000 packet.py:1972(bind_bottom_up) 475/125 0.001 0.000 0.001 0.000 sre_parse.py:174(getwidth) 473 0.000 0.000 0.002 0.000 fields.py:1192(__init__) 466 0.000 0.000 0.000 0.000 {method 'encode' of 'str' objects} 464 0.000 0.000 0.000 0.000 {method 'rfind' of 'str' objects} 461 0.001 0.000 0.001 0.000 {method 'split' of 're.Pattern' objects} 461 0.000 0.000 0.001 0.000 re.py:223(split) 456 0.000 0.000 0.004 0.000 <frozen importlib._bootstrap>:376(cached) 454 0.000 0.000 0.001 0.000 dadict.py:33(fixname) 450 0.001 0.000 0.001 0.000 packet.py:1994(bind_top_down) 445 0.001 0.000 0.002 0.000 <frozen importlib._bootstrap_external>:127(_path_split) 444 0.002 0.000 0.005 0.000 <frozen importlib._bootstrap_external>:354(cache_from_source) 443 0.004 0.000 0.018 0.000 <frozen importlib._bootstrap_external>:1498(find_spec) 443 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:68(_relax_case) 432 0.000 0.000 0.002 0.000 packet.py:2015(bind_layers) 418 0.000 0.000 0.000 0.000 {built-in method builtins.chr} 413/176 0.001 0.000 0.003 0.000 copy.py:128(deepcopy) 410 0.001 0.000 0.002 0.000 fields.py:1325(any2i) 407 0.000 0.000 0.000 0.000 sre_parse.py:111(__init__) 406 0.000 0.000 0.000 0.000 inspect.py:2601(__eq__) 397 0.000 0.000 0.000 0.000 {built-in method builtins.issubclass} 389/39 0.002 0.000 0.005 0.000 sre_compile.py:71(_compile) 380/345 0.000 0.000 0.000 0.000 {built-in method builtins.hash} 379 0.000 0.000 0.000 0.000 socket.py:91(<lambda>) 378 0.000 0.000 0.000 0.000 socket.py:86(<lambda>) 377 0.000 0.000 0.000 0.000 socket.py:81(<lambda>) 376 0.000 0.000 0.000 0.000 socket.py:76(<lambda>) 372 0.000 0.000 0.000 0.000 {built-in method sys.getrecursionlimit} 372 0.000 0.000 0.000 0.000 inspect.py:513(_is_wrapper) 372 0.000 0.000 0.001 0.000 inspect.py:493(unwrap) 372 0.002 0.000 0.006 0.000 inspect.py:2124(_signature_from_function) 372 0.001 0.000 0.008 0.000 inspect.py:2218(_signature_from_callable) 372 0.001 0.000 0.001 0.000 inspect.py:2772(__init__) 372 0.000 0.000 0.008 0.000 inspect.py:2851(from_callable) 372 0.000 0.000 0.000 0.000 inspect.py:2861(return_annotation) 372 0.000 0.000 0.000 0.000 inspect.py:2884(<dictcomp>) 372 0.001 0.000 0.002 0.000 inspect.py:2880(_hash_basis) 372 0.000 0.000 0.008 0.000 inspect.py:3103(signature) 354 0.000 0.000 0.000 0.000 compat.py:281(bytes_encode) 338 0.000 0.000 0.006 0.000 <frozen importlib._bootstrap_external>:145(_path_is_mode_type) 336 0.000 0.000 0.001 0.000 fields.py:1222(__init__) 330 0.000 0.000 0.000 0.000 typing.py:669(<genexpr>) 329 0.000 0.000 0.000 0.000 fields.py:304(__getattr__) 326 0.000 0.000 0.008 0.000 fields.py:2476(__init__) 321/5 0.000 0.000 0.567 0.113 <frozen importlib._bootstrap>:211(_call_with_frames_removed) 313 0.000 0.000 0.001 0.000 fields.py:1204(__init__) 311 0.000 0.000 0.006 0.000 <frozen importlib._bootstrap_external>:154(_path_isfile) 308 0.000 0.000 0.000 0.000 {method 'add' of 'set' objects} 303 0.000 0.000 0.000 0.000 enum.py:417(__setattr__) 296 0.000 0.000 0.008 0.000 asn1fields.py:45(__init__) 288 0.001 0.000 0.001 0.000 <frozen importlib._bootstrap>:78(acquire) 288 0.001 0.000 0.001 0.000 <frozen importlib._bootstrap>:103(release) 288 0.001 0.000 0.002 0.000 <frozen importlib._bootstrap>:157(_get_module_lock) 282 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap>:58(__init__) 282 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap>:176(cb) 279 0.000 0.000 0.000 0.000 copy.py:182(_deepcopy_atomic) 275 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:143(__init__) 275 0.000 0.000 0.003 0.000 <frozen importlib._bootstrap>:147(__enter__) 275 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap>:151(__exit__) 275/5 0.001 0.000 0.569 0.114 <frozen importlib._bootstrap>:986(_find_and_load) 273 0.000 0.000 0.000 0.000 data.py:345(__getitem__) 271 0.000 0.000 0.000 0.000 six.py:590(iteritems) 267 0.000 0.000 0.000 0.000 fields.py:2813(__setattr__) 267 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:342(__init__) 267/4 0.001 0.000 0.569 0.142 <frozen importlib._bootstrap>:956(_find_and_load_unlocked) 266 0.000 0.000 0.000 0.000 {method 'extend' of 'list' objects} 264 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:725(find_spec) 264/262 0.002 0.000 0.025 0.000 <frozen importlib._bootstrap>:890(_find_spec) 263 0.000 0.000 0.000 0.000 {method 'split' of 'str' objects} 259 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:175(_path_isabs) 257 0.000 0.000 0.000 0.000 hmac.py:17(<genexpr>) 257 0.000 0.000 0.000 0.000 hmac.py:18(<genexpr>)
Thanks a lot for the report ! I could reproduce and will investigate
Hi, could you try out https://github.com/secdev/scapy/pull/3349 ? Thanks
Hi, could you try out #3349 ?
It works! Thanks very much!
Brief description
Scapy hangs after
rdpcap('bgp.pcap')
, please download the pcap via linkScapy version
2.4.5rc1.dev89
Python version
3.8.10
Operating system
Linux 5.8.0-50-generic
Additional environment information
No response
How to reproduce
curl -OL https://gist.github.com/jschwinger23/8a4cf4b13047b8b6086576413f1a60d5/raw/c51ac8e316c34b3b210f2e4965e4fa12c1ca7e78/bgp.pcap
load_contrib('bgp')
andp = rdpcap('bgp.pcap')
, then it runs forever.Actual result
If I press
Ctrl-C
to interrupt, the stack frames areExpected result
The pcap actually can be parsed by tshark, and here's the result:
Related resources
I ran a profile for this, and here's part of the output: