From 5cc8115afccc5e273c861017d4edbec2c473f097 Mon Sep 17 00:00:00 2001 From: Phil <phil@secdev.org> Date: Mon, 11 Feb 2008 11:31:39 +0100 Subject: [PATCH] Do not display conditional fields that are not present in show() and repr() --- scapy.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scapy.py b/scapy.py index 91a20c50..cbed74e5 100755 --- a/scapy.py +++ b/scapy.py @@ -5280,6 +5280,8 @@ class Packet(Gen): s = "" ct = conf.color_theme for f in self.fields_desc: + if isinstance(f, ConditionalField) and not f._evalcond(self): + continue if f.name in self.fields: val = f.i2repr(self, self.fields[f.name]) elif f.name in self.overloaded_fields: @@ -5809,6 +5811,8 @@ Creates an EPS file describing a packet. If filename is not provided a temporary ct.layer_name(self.name), ct.punct("]###")) for f in self.fields_desc: + if isinstance(f, ConditionalField) and not f._evalcond(self): + continue if isinstance(f, Emph): ncol = ct.emph_field_name vcol = ct.emph_field_value -- GitLab