Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
self.attrs = parse_attrs(self.data)
self.data = b''
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
n = struct.unpack('>I', self.data[:4])[0]
self.data = self.data[4:4+n]
def __len__(self):
def unpack(self, buf):
try:
dpkt.Packet.unpack(self, buf)
all_certs, all_certs_len = parse_variable_array(self.data, 3)
self.certificates = []
pointer = 3
while pointer < all_certs_len:
cert, parsed = parse_variable_array(self.data[pointer:], 3)
self.certificates.append((cert))
pointer += parsed
except struct.error:
raise dpkt.NeedData
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
self.attrs = parse_attrs(self.data)
self.data = ''
def unpack(self, buf):
# TPKT header
self.tpkt = tpkt.TPKT(buf)
if self.tpkt.v != 3:
raise dpkt.UnpackError('invalid TPKT version')
if self.tpkt.rsvd != 0:
raise dpkt.UnpackError('invalid TPKT reserved value')
n = self.tpkt.len - self.tpkt.__hdr_len__
if n > len(self.tpkt.data):
raise dpkt.UnpackError('invalid TPKT length')
buf = self.tpkt.data
# Q.931 payload
dpkt.Packet.unpack(self, buf)
buf = buf[self.__hdr_len__:]
self.ref_val = buf[:self.ref_len]
buf = buf[self.ref_len:]
self.type = struct.unpack('B', buf[:1])[0]
buf = buf[1:]
# Information Elements
l = []
while buf:
ie = self.IE(buf)
l.append(ie)
buf = buf[len(ie):]
self.data = l
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
l = []
while self.data:
chunk = Chunk(self.data)
l.append(chunk)
self.data = self.data[len(chunk):]
self.data = self.chunks = l
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
setattr(self, 'length', (self.len + 2) * 4)
setattr(self, 'auth_data', self.data[:(self.len - 1) * 4])
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
self.data = self.data[:self.len]
if self.type == AUTHENTICATION:
self.data = self.authentication = self.Authentication(self.data)
elif self.type == CAPABILITY:
self.data = self.capability = self.Capability(self.data)
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
if self.p & PFC_BIT == 0:
self.p = struct.unpack('>H', buf[:2])[0]
self.data = self.data[1:]
try:
self.data = self._protosw[self.p](self.data)
setattr(self, self.data.__class__.__name__.lower(), self.data)
except (KeyError, struct.error, dpkt.UnpackError):
pass
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
if self.p & ppp.PFC_BIT == 0:
try:
self.p = struct.unpack('>H', buf[:2])[0]
except struct.error:
raise dpkt.NeedData
self.data = self.data[1:]
try:
self.data = self._protosw[self.p](self.data)
setattr(self, self.data.__class__.__name__.lower(), self.data)
except (KeyError, struct.error, dpkt.UnpackError):
pass