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)
buf = self.data
l = []
while buf:
flow = self.NetflowRecord(buf)
l.append(flow)
buf = buf[len(flow):]
self.data = l
def unpack(self, buf):
Packet.unpack(self, buf)
try:
self.data = self._typesw[self.type](self.data)
setattr(self, self.data.__class__.__name__.lower(), self.data)
except:
self.data = buf
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
l = []
off = 0
for off in range(0, 4 * self.count, 4):
l.append(self.data[off:off + 4])
self.addrs = l
self.auth = self.data[off + 4:]
self.data = ''
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
self.data = self.ip = ip.IP(self.data)
class Unreach(Quote):
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
self.data = buf[self.length:]
self.fields = []
buf = buf[self.__hdr_len__:]
# decode each field into self. (eg. self.tsft) as well as append it self.fields list
field_decoder = [
('tsft', self.tsft_present, self.TSFT),
('flags', self.flags_present, self.Flags),
('rate', self.rate_present, self.Rate),
('channel', self.channel_present, self.Channel),
('fhss', self.fhss_present, self.FHSS),
('ant_sig', self.ant_sig_present, self.AntennaSignal),
('ant_noise', self.ant_noise_present, self.AntennaNoise),
('lock_qual', self.lock_qual_present, self.LockQuality),
('tx_attn', self.tx_attn_present, self.TxAttenuation),
def unpack(self, buf):
Packet.unpack(self, buf)
self.cred = RPC.Auth(self.data)
self.verf = RPC.Auth(self.data[len(self.cred):])
self.data = self.data[len(self.cred) + len(self.verf):]
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
if self.len & 0x8000:
n = self.len = self.len & 0x7FFF
self.msg, self.data = self.data[:n], self.data[n:]
else:
n = self.len = self.len & 0x3FFF
padlen = ord(self.data[0])
self.msg = self.data[1:1+n]
self.pad = self.data[1+n:1+n+padlen]
self.data = self.data[1+n+padlen:]
def unpack(self, buf):
Packet.unpack(self, buf)
l = []
for off in range(0, 4 * self.count, 4):
l.append(self.data[off:off+4])
self.addrs = l
self.auth = self.data[off+4:]
self.data = ''
def unpack(self, buf):
dpkt.Packet.unpack(self, buf)
buf = self.data
l = []
while buf:
tlv = self.TLV(buf)
l.append(tlv)
buf = buf[len(tlv):]
self.data = l