summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2017-03-15 03:54:32 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2017-03-15 03:54:32 +0200
commit0f986442b3cf2b7b5cdd386ca277779c9ced69fb (patch)
treea46f7880ba0d526aaaf8bc170b2b1c898043b2d7 /scripts
parentca4ceb64467f41b2c772c04c3567922960c6b085 (diff)
Scapy: fix offsets for GUI.
Change-Id: I0b6406fc0b9ceefb53a2ab98a441497326d9f7f0 Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/external_libs/scapy-2.3.1/python2/scapy/fields.py5
-rw-r--r--scripts/external_libs/scapy-2.3.1/python2/scapy/packet.py4
-rw-r--r--scripts/external_libs/scapy-2.3.1/python3/scapy/fields.py4
-rw-r--r--scripts/external_libs/scapy-2.3.1/python3/scapy/packet.py4
4 files changed, 12 insertions, 5 deletions
diff --git a/scripts/external_libs/scapy-2.3.1/python2/scapy/fields.py b/scripts/external_libs/scapy-2.3.1/python2/scapy/fields.py
index df85875a..ba65e637 100644
--- a/scripts/external_libs/scapy-2.3.1/python2/scapy/fields.py
+++ b/scripts/external_libs/scapy-2.3.1/python2/scapy/fields.py
@@ -34,7 +34,7 @@ class Field:
self.default = self.any2i(None,default)
self.sz = struct.calcsize(self.fmt)
self.owners = []
- self.offset =0;
+ self._offset =0;
def get_size_bytes (self):
if hasattr(self, 'size'):
@@ -42,6 +42,9 @@ class Field:
else:
return self.sz
+ def get_size_bits(self):
+ return getattr(self, 'size', self.sz * 8)
+
def register_owner(self, cls):
self.owners.append(cls)
diff --git a/scripts/external_libs/scapy-2.3.1/python2/scapy/packet.py b/scripts/external_libs/scapy-2.3.1/python2/scapy/packet.py
index 5bd2e693..8cd78b86 100644
--- a/scripts/external_libs/scapy-2.3.1/python2/scapy/packet.py
+++ b/scripts/external_libs/scapy-2.3.1/python2/scapy/packet.py
@@ -320,8 +320,8 @@ class Packet(BasePacket):
def self_build(self, field_pos_list=None):
- if self.raw_packet_cache is not None:
- return self.raw_packet_cache
+ #if self.raw_packet_cache is not None:
+ # return self.raw_packet_cache
p=""
for f in self.fields_desc:
if type(p) is tuple :
diff --git a/scripts/external_libs/scapy-2.3.1/python3/scapy/fields.py b/scripts/external_libs/scapy-2.3.1/python3/scapy/fields.py
index 66ccd552..9dcebcf3 100644
--- a/scripts/external_libs/scapy-2.3.1/python3/scapy/fields.py
+++ b/scripts/external_libs/scapy-2.3.1/python3/scapy/fields.py
@@ -35,6 +35,7 @@ class Field:
self.sz = struct.calcsize(self.fmt)
self.owners = []
self.offset =0;
+ self._offset =0
def get_size_bytes (self):
@@ -43,6 +44,9 @@ class Field:
else:
return self.sz
+ def get_size_bits(self):
+ return getattr(self, 'size', self.sz * 8)
+
def register_owner(self, cls):
self.owners.append(cls)
diff --git a/scripts/external_libs/scapy-2.3.1/python3/scapy/packet.py b/scripts/external_libs/scapy-2.3.1/python3/scapy/packet.py
index 5fcf57c6..7e0a0898 100644
--- a/scripts/external_libs/scapy-2.3.1/python3/scapy/packet.py
+++ b/scripts/external_libs/scapy-2.3.1/python3/scapy/packet.py
@@ -338,8 +338,8 @@ class Packet(BasePacket, metaclass = Packet_metaclass):
print ("field %-40s %02d %02d" % (f.name, f._offset,f.get_size_bytes () ) );
def self_build(self, field_pos_list=None):
- if self.raw_packet_cache is not None:
- return self.raw_packet_cache
+ #if self.raw_packet_cache is not None:
+ # return self.raw_packet_cache
p=b""
for f in self.fields_desc:
#print(f.name)