repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
JarryShaw/PyPCAPKit
src/protocols/internet/ipv4.py
IPv4._read_mode_route
def _read_mode_route(self, size, kind): """Read options with route data. Positional arguments: * size - int, length of option * kind - int, 7/131/137 (RR/LSR/SSR) Returns: * dict -- extracted option with route data Structure of these options: ...
python
def _read_mode_route(self, size, kind): """Read options with route data. Positional arguments: * size - int, length of option * kind - int, 7/131/137 (RR/LSR/SSR) Returns: * dict -- extracted option with route data Structure of these options: ...
[ "def", "_read_mode_route", "(", "self", ",", "size", ",", "kind", ")", ":", "if", "size", "<", "3", "or", "(", "size", "-", "3", ")", "%", "4", "!=", "0", ":", "raise", "ProtocolError", "(", "f'{self.alias}: [Optno {kind}] invalid format'", ")", "_rptr", ...
Read options with route data. Positional arguments: * size - int, length of option * kind - int, 7/131/137 (RR/LSR/SSR) Returns: * dict -- extracted option with route data Structure of these options: * [RFC 791] Loose Source Route ...
[ "Read", "options", "with", "route", "data", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/ipv4.py#L448-L505
JarryShaw/PyPCAPKit
src/protocols/internet/ipv4.py
IPv4._read_mode_qs
def _read_mode_qs(self, size, kind): """Read Quick Start option. Positional arguments: * size - int, length of option * kind - int, 25 (QS) Returns: * dict -- extracted Quick Start (QS) option Structure of Quick-Start (QS) option [RFC 4782]: ...
python
def _read_mode_qs(self, size, kind): """Read Quick Start option. Positional arguments: * size - int, length of option * kind - int, 25 (QS) Returns: * dict -- extracted Quick Start (QS) option Structure of Quick-Start (QS) option [RFC 4782]: ...
[ "def", "_read_mode_qs", "(", "self", ",", "size", ",", "kind", ")", ":", "if", "size", "!=", "8", ":", "raise", "ProtocolError", "(", "f'{self.alias}: [Optno {kind}] invalid format'", ")", "_type", "=", "self", ".", "_read_opt_type", "(", "kind", ")", "_fcrr",...
Read Quick Start option. Positional arguments: * size - int, length of option * kind - int, 25 (QS) Returns: * dict -- extracted Quick Start (QS) option Structure of Quick-Start (QS) option [RFC 4782]: * A Quick-Start Request. 0...
[ "Read", "Quick", "Start", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/ipv4.py#L507-L574
JarryShaw/PyPCAPKit
src/protocols/internet/ipv4.py
IPv4._read_mode_ts
def _read_mode_ts(self, size, kind): """Read Time Stamp option. Positional arguments: * size - int, length of option * kind - int, 68 (TS) Returns: * dict -- extracted Time Stamp (TS) option Structure of Timestamp (TS) option [RFC 791]: ...
python
def _read_mode_ts(self, size, kind): """Read Time Stamp option. Positional arguments: * size - int, length of option * kind - int, 68 (TS) Returns: * dict -- extracted Time Stamp (TS) option Structure of Timestamp (TS) option [RFC 791]: ...
[ "def", "_read_mode_ts", "(", "self", ",", "size", ",", "kind", ")", ":", "if", "size", ">", "40", "or", "size", "<", "4", ":", "raise", "ProtocolError", "(", "f'{self.alias}: [Optno {kind}] invalid format'", ")", "_tptr", "=", "self", ".", "_read_unpack", "(...
Read Time Stamp option. Positional arguments: * size - int, length of option * kind - int, 68 (TS) Returns: * dict -- extracted Time Stamp (TS) option Structure of Timestamp (TS) option [RFC 791]: +--------+--------+--------+--------+ ...
[ "Read", "Time", "Stamp", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/ipv4.py#L576-L658
JarryShaw/PyPCAPKit
src/protocols/internet/ipv4.py
IPv4._read_mode_tr
def _read_mode_tr(self, size, kind): """Read Traceroute option. Positional arguments: size - int, length of option kind - int, 82 (TR) Returns: * dict -- extracted Traceroute (TR) option Structure of Traceroute (TR) option [RFC 1393][RFC 6814]: ...
python
def _read_mode_tr(self, size, kind): """Read Traceroute option. Positional arguments: size - int, length of option kind - int, 82 (TR) Returns: * dict -- extracted Traceroute (TR) option Structure of Traceroute (TR) option [RFC 1393][RFC 6814]: ...
[ "def", "_read_mode_tr", "(", "self", ",", "size", ",", "kind", ")", ":", "if", "size", "!=", "12", ":", "raise", "ProtocolError", "(", "f'{self.alias}: [Optno {kind}] invalid format'", ")", "_idnm", "=", "self", ".", "_read_unpack", "(", "2", ")", "_ohcn", "...
Read Traceroute option. Positional arguments: size - int, length of option kind - int, 82 (TR) Returns: * dict -- extracted Traceroute (TR) option Structure of Traceroute (TR) option [RFC 1393][RFC 6814]: 0 8 16 ...
[ "Read", "Traceroute", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/ipv4.py#L660-L710
JarryShaw/PyPCAPKit
src/protocols/internet/ipv4.py
IPv4._read_mode_sec
def _read_mode_sec(self, size, kind): """Read options with security info. Positional arguments: size - int, length of option kind - int, 130 (SEC )/ 133 (ESEC) Returns: * dict -- extracted option with security info (E/SEC) Structure of these options...
python
def _read_mode_sec(self, size, kind): """Read options with security info. Positional arguments: size - int, length of option kind - int, 130 (SEC )/ 133 (ESEC) Returns: * dict -- extracted option with security info (E/SEC) Structure of these options...
[ "def", "_read_mode_sec", "(", "self", ",", "size", ",", "kind", ")", ":", "if", "size", "<", "3", ":", "raise", "ProtocolError", "(", "f'{self.alias}: [Optno {kind}] invalid format'", ")", "_clvl", "=", "self", ".", "_read_unpack", "(", "1", ")", "data", "="...
Read options with security info. Positional arguments: size - int, length of option kind - int, 130 (SEC )/ 133 (ESEC) Returns: * dict -- extracted option with security info (E/SEC) Structure of these options: * [RFC 1108] Security (SEC) ...
[ "Read", "options", "with", "security", "info", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/ipv4.py#L712-L776
JarryShaw/PyPCAPKit
src/protocols/internet/ipv4.py
IPv4._read_mode_rsralt
def _read_mode_rsralt(self, size, kind): """Read Router Alert option. Positional arguments: size - int, length of option kind - int, 148 (RTRALT) Returns: * dict -- extracted Router Alert (RTRALT) option Structure of Router Alert (RTRALT) option [RF...
python
def _read_mode_rsralt(self, size, kind): """Read Router Alert option. Positional arguments: size - int, length of option kind - int, 148 (RTRALT) Returns: * dict -- extracted Router Alert (RTRALT) option Structure of Router Alert (RTRALT) option [RF...
[ "def", "_read_mode_rsralt", "(", "self", ",", "size", ",", "kind", ")", ":", "if", "size", "!=", "4", ":", "raise", "ProtocolError", "(", "f'{self.alias}: [Optno {kind}] invalid format'", ")", "_code", "=", "self", ".", "_read_unpack", "(", "2", ")", "data", ...
Read Router Alert option. Positional arguments: size - int, length of option kind - int, 148 (RTRALT) Returns: * dict -- extracted Router Alert (RTRALT) option Structure of Router Alert (RTRALT) option [RFC 2113]: +--------+--------+--------+---...
[ "Read", "Router", "Alert", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/ipv4.py#L778-L816
JarryShaw/PyPCAPKit
src/protocols/pcap/header.py
Header.read_header
def read_header(self): """Read global header of PCAP file. Structure of global header (C): typedef struct pcap_hdr_s { guint32 magic_number; /* magic number */ guint16 version_major; /* major version number */ guint16 version_minor; /* min...
python
def read_header(self): """Read global header of PCAP file. Structure of global header (C): typedef struct pcap_hdr_s { guint32 magic_number; /* magic number */ guint16 version_major; /* major version number */ guint16 version_minor; /* min...
[ "def", "read_header", "(", "self", ")", ":", "_magn", "=", "self", ".", "_read_fileng", "(", "4", ")", "if", "_magn", "==", "b'\\xd4\\xc3\\xb2\\xa1'", ":", "lilendian", "=", "True", "self", ".", "_nsec", "=", "False", "self", ".", "_byte", "=", "'little'...
Read global header of PCAP file. Structure of global header (C): typedef struct pcap_hdr_s { guint32 magic_number; /* magic number */ guint16 version_major; /* major version number */ guint16 version_minor; /* minor version number */ ...
[ "Read", "global", "header", "of", "PCAP", "file", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/pcap/header.py#L110-L170
JarryShaw/PyPCAPKit
src/protocols/pcap/header.py
Header._read_protos
def _read_protos(self, size): """Read next layer protocol type. Positional arguments: * size -- int, buffer size Returns: * str -- link layer protocol name """ _byte = self._read_unpack(4, lilendian=True) _prot = LINKTYPE.get(_byte) ret...
python
def _read_protos(self, size): """Read next layer protocol type. Positional arguments: * size -- int, buffer size Returns: * str -- link layer protocol name """ _byte = self._read_unpack(4, lilendian=True) _prot = LINKTYPE.get(_byte) ret...
[ "def", "_read_protos", "(", "self", ",", "size", ")", ":", "_byte", "=", "self", ".", "_read_unpack", "(", "4", ",", "lilendian", "=", "True", ")", "_prot", "=", "LINKTYPE", ".", "get", "(", "_byte", ")", "return", "_prot" ]
Read next layer protocol type. Positional arguments: * size -- int, buffer size Returns: * str -- link layer protocol name
[ "Read", "next", "layer", "protocol", "type", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/pcap/header.py#L190-L202
JarryShaw/PyPCAPKit
src/protocols/pcap/frame.py
Frame.read_frame
def read_frame(self): """Read each block after global header. Structure of record/package header (C): typedef struct pcaprec_hdr_s { guint32 ts_sec; /* timestamp seconds */ guint32 ts_usec; /* timestamp microseconds */ guint32 incl_len;...
python
def read_frame(self): """Read each block after global header. Structure of record/package header (C): typedef struct pcaprec_hdr_s { guint32 ts_sec; /* timestamp seconds */ guint32 ts_usec; /* timestamp microseconds */ guint32 incl_len;...
[ "def", "read_frame", "(", "self", ")", ":", "# _scur = self._file.tell()", "_temp", "=", "self", ".", "_read_unpack", "(", "4", ",", "lilendian", "=", "True", ",", "quiet", "=", "True", ")", "if", "_temp", "is", "None", ":", "raise", "EOFError", "_tsss", ...
Read each block after global header. Structure of record/package header (C): typedef struct pcaprec_hdr_s { guint32 ts_sec; /* timestamp seconds */ guint32 ts_usec; /* timestamp microseconds */ guint32 incl_len; /* number of octets of packet ...
[ "Read", "each", "block", "after", "global", "header", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/pcap/frame.py#L88-L145
JarryShaw/PyPCAPKit
src/protocols/pcap/frame.py
Frame._decode_next_layer
def _decode_next_layer(self, dict_, length=None): """Decode next layer protocol. Positional arguments: dict_ -- dict, info buffer proto -- str, next layer protocol name length -- int, valid (not padding) length Returns: * dict -- current protocol...
python
def _decode_next_layer(self, dict_, length=None): """Decode next layer protocol. Positional arguments: dict_ -- dict, info buffer proto -- str, next layer protocol name length -- int, valid (not padding) length Returns: * dict -- current protocol...
[ "def", "_decode_next_layer", "(", "self", ",", "dict_", ",", "length", "=", "None", ")", ":", "seek_cur", "=", "self", ".", "_file", ".", "tell", "(", ")", "try", ":", "next_", "=", "self", ".", "_import_next_layer", "(", "self", ".", "_prot", ",", "...
Decode next layer protocol. Positional arguments: dict_ -- dict, info buffer proto -- str, next layer protocol name length -- int, valid (not padding) length Returns: * dict -- current protocol with packet extracted
[ "Decode", "next", "layer", "protocol", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/pcap/frame.py#L229-L259
JarryShaw/PyPCAPKit
src/protocols/pcap/frame.py
Frame._import_next_layer
def _import_next_layer(self, proto, length, error=False): """Import next layer extractor. Positional arguments: * proto -- str, next layer protocol name * length -- int, valid (not padding) length Keyword arguments: * error -- bool, if function call on error...
python
def _import_next_layer(self, proto, length, error=False): """Import next layer extractor. Positional arguments: * proto -- str, next layer protocol name * length -- int, valid (not padding) length Keyword arguments: * error -- bool, if function call on error...
[ "def", "_import_next_layer", "(", "self", ",", "proto", ",", "length", ",", "error", "=", "False", ")", ":", "if", "proto", "==", "1", ":", "from", "pcapkit", ".", "protocols", ".", "link", "import", "Ethernet", "as", "Protocol", "elif", "proto", "==", ...
Import next layer extractor. Positional arguments: * proto -- str, next layer protocol name * length -- int, valid (not padding) length Keyword arguments: * error -- bool, if function call on error Returns: * bool -- flag if extraction of next l...
[ "Import", "next", "layer", "extractor", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/pcap/frame.py#L261-L293
JarryShaw/PyPCAPKit
src/const/hip/registration_failure.py
RegistrationFailure.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return RegistrationFailure(key) if key not in RegistrationFailure._member_map_: extend_enum(RegistrationFailure, key, default) return RegistrationFailure[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return RegistrationFailure(key) if key not in RegistrationFailure._member_map_: extend_enum(RegistrationFailure, key, default) return RegistrationFailure[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "RegistrationFailure", "(", "key", ")", "if", "key", "not", "in", "RegistrationFailure", ".", "_member_map_", ":", "exten...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/hip/registration_failure.py#L23-L29
JarryShaw/PyPCAPKit
src/const/ipv4/tos_pre.py
TOS_PRE.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return TOS_PRE(key) if key not in TOS_PRE._member_map_: extend_enum(TOS_PRE, key, default) return TOS_PRE[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return TOS_PRE(key) if key not in TOS_PRE._member_map_: extend_enum(TOS_PRE, key, default) return TOS_PRE[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "TOS_PRE", "(", "key", ")", "if", "key", "not", "in", "TOS_PRE", ".", "_member_map_", ":", "extend_enum", "(", "TOS_P...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/ipv4/tos_pre.py#L22-L28
JarryShaw/PyPCAPKit
src/protocols/raw.py
Raw.read_raw
def read_raw(self, length, *, error=None): """Read raw packet data.""" if length is None: length = len(self) raw = dict( packet=self._read_fileng(length), error=error or None, ) return raw
python
def read_raw(self, length, *, error=None): """Read raw packet data.""" if length is None: length = len(self) raw = dict( packet=self._read_fileng(length), error=error or None, ) return raw
[ "def", "read_raw", "(", "self", ",", "length", ",", "*", ",", "error", "=", "None", ")", ":", "if", "length", "is", "None", ":", "length", "=", "len", "(", "self", ")", "raw", "=", "dict", "(", "packet", "=", "self", ".", "_read_fileng", "(", "le...
Read raw packet data.
[ "Read", "raw", "packet", "data", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/raw.py#L73-L83
JarryShaw/PyPCAPKit
src/const/hip/notify_message.py
NotifyMessage.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return NotifyMessage(key) if key not in NotifyMessage._member_map_: extend_enum(NotifyMessage, key, default) return NotifyMessage[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return NotifyMessage(key) if key not in NotifyMessage._member_map_: extend_enum(NotifyMessage, key, default) return NotifyMessage[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "NotifyMessage", "(", "key", ")", "if", "key", "not", "in", "NotifyMessage", ".", "_member_map_", ":", "extend_enum", "...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/hip/notify_message.py#L49-L55
JarryShaw/PyPCAPKit
src/const/hip/notify_message.py
NotifyMessage._missing_
def _missing_(cls, value): """Lookup function used when value is not found.""" if not (isinstance(value, int) and 0 <= value <= 65535): raise ValueError('%r is not a valid %s' % (value, cls.__name__)) if 2 <= value <= 6: extend_enum(cls, 'Unassigned [%d]' % value, value) ...
python
def _missing_(cls, value): """Lookup function used when value is not found.""" if not (isinstance(value, int) and 0 <= value <= 65535): raise ValueError('%r is not a valid %s' % (value, cls.__name__)) if 2 <= value <= 6: extend_enum(cls, 'Unassigned [%d]' % value, value) ...
[ "def", "_missing_", "(", "cls", ",", "value", ")", ":", "if", "not", "(", "isinstance", "(", "value", ",", "int", ")", "and", "0", "<=", "value", "<=", "65535", ")", ":", "raise", "ValueError", "(", "'%r is not a valid %s'", "%", "(", "value", ",", "...
Lookup function used when value is not found.
[ "Lookup", "function", "used", "when", "value", "is", "not", "found", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/hip/notify_message.py#L58-L103
JarryShaw/PyPCAPKit
src/toolkit/dpkt.py
ipv6_hdr_len
def ipv6_hdr_len(ipv6): """Calculate length of headers before IPv6-Frag""" hdr_len = ipv6.__hdr_len__ for code in (0, 60, 43): ext_hdr = ipv6.extension_hdrs.get(code) if ext_hdr is not None: hdr_len += ext_hdr.length return hdr_len
python
def ipv6_hdr_len(ipv6): """Calculate length of headers before IPv6-Frag""" hdr_len = ipv6.__hdr_len__ for code in (0, 60, 43): ext_hdr = ipv6.extension_hdrs.get(code) if ext_hdr is not None: hdr_len += ext_hdr.length return hdr_len
[ "def", "ipv6_hdr_len", "(", "ipv6", ")", ":", "hdr_len", "=", "ipv6", ".", "__hdr_len__", "for", "code", "in", "(", "0", ",", "60", ",", "43", ")", ":", "ext_hdr", "=", "ipv6", ".", "extension_hdrs", ".", "get", "(", "code", ")", "if", "ext_hdr", "...
Calculate length of headers before IPv6-Frag
[ "Calculate", "length", "of", "headers", "before", "IPv6", "-", "Frag" ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/dpkt.py#L20-L27
JarryShaw/PyPCAPKit
src/toolkit/dpkt.py
packet2chain
def packet2chain(packet): """Fetch DPKT packet protocol chain.""" chain = [type(packet).__name__] payload = packet.data while not isinstance(payload, bytes): chain.append(type(payload).__name__) payload = payload.data return ':'.join(chain)
python
def packet2chain(packet): """Fetch DPKT packet protocol chain.""" chain = [type(packet).__name__] payload = packet.data while not isinstance(payload, bytes): chain.append(type(payload).__name__) payload = payload.data return ':'.join(chain)
[ "def", "packet2chain", "(", "packet", ")", ":", "chain", "=", "[", "type", "(", "packet", ")", ".", "__name__", "]", "payload", "=", "packet", ".", "data", "while", "not", "isinstance", "(", "payload", ",", "bytes", ")", ":", "chain", ".", "append", ...
Fetch DPKT packet protocol chain.
[ "Fetch", "DPKT", "packet", "protocol", "chain", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/dpkt.py#L30-L37
JarryShaw/PyPCAPKit
src/toolkit/dpkt.py
packet2dict
def packet2dict(packet, timestamp, *, data_link): """Convert DPKT packet into dict.""" def wrapper(packet): dict_ = dict() for field in packet.__hdr_fields__: dict_[field] = getattr(packet, field, None) payload = packet.data if not isinstance(payload, bytes): ...
python
def packet2dict(packet, timestamp, *, data_link): """Convert DPKT packet into dict.""" def wrapper(packet): dict_ = dict() for field in packet.__hdr_fields__: dict_[field] = getattr(packet, field, None) payload = packet.data if not isinstance(payload, bytes): ...
[ "def", "packet2dict", "(", "packet", ",", "timestamp", ",", "*", ",", "data_link", ")", ":", "def", "wrapper", "(", "packet", ")", ":", "dict_", "=", "dict", "(", ")", "for", "field", "in", "packet", ".", "__hdr_fields__", ":", "dict_", "[", "field", ...
Convert DPKT packet into dict.
[ "Convert", "DPKT", "packet", "into", "dict", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/dpkt.py#L40-L54
JarryShaw/PyPCAPKit
src/toolkit/dpkt.py
ipv4_reassembly
def ipv4_reassembly(packet, *, count=NotImplemented): """Make data for IPv4 reassembly.""" ipv4 = getattr(packet, 'ip', None) if ipv4 is not None: if ipv4.df: # dismiss not fragmented packet return False, None data = dict( bufid=( ipaddress.ip_addr...
python
def ipv4_reassembly(packet, *, count=NotImplemented): """Make data for IPv4 reassembly.""" ipv4 = getattr(packet, 'ip', None) if ipv4 is not None: if ipv4.df: # dismiss not fragmented packet return False, None data = dict( bufid=( ipaddress.ip_addr...
[ "def", "ipv4_reassembly", "(", "packet", ",", "*", ",", "count", "=", "NotImplemented", ")", ":", "ipv4", "=", "getattr", "(", "packet", ",", "'ip'", ",", "None", ")", "if", "ipv4", "is", "not", "None", ":", "if", "ipv4", ".", "df", ":", "# dismiss n...
Make data for IPv4 reassembly.
[ "Make", "data", "for", "IPv4", "reassembly", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/dpkt.py#L57-L79
JarryShaw/PyPCAPKit
src/toolkit/dpkt.py
ipv6_reassembly
def ipv6_reassembly(packet, *, count=NotImplemented): """Make data for IPv6 reassembly.""" ipv6 = getattr(packet, 'ip6', None) if ipv6 is not None: ipv6_frag = ipv6.extension_hdrs.get(44) if ipv6_frag is None: # dismiss not fragmented packet return False, None hdr_l...
python
def ipv6_reassembly(packet, *, count=NotImplemented): """Make data for IPv6 reassembly.""" ipv6 = getattr(packet, 'ip6', None) if ipv6 is not None: ipv6_frag = ipv6.extension_hdrs.get(44) if ipv6_frag is None: # dismiss not fragmented packet return False, None hdr_l...
[ "def", "ipv6_reassembly", "(", "packet", ",", "*", ",", "count", "=", "NotImplemented", ")", ":", "ipv6", "=", "getattr", "(", "packet", ",", "'ip6'", ",", "None", ")", "if", "ipv6", "is", "not", "None", ":", "ipv6_frag", "=", "ipv6", ".", "extension_h...
Make data for IPv6 reassembly.
[ "Make", "data", "for", "IPv6", "reassembly", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/dpkt.py#L82-L106
JarryShaw/PyPCAPKit
src/toolkit/dpkt.py
tcp_reassembly
def tcp_reassembly(packet, *, count=NotImplemented): """Make data for TCP reassembly.""" if getattr(packet, 'ip', None): ip = packet['ip'] elif getattr(packet, 'ip6', None): ip = packet['ip6'] else: return False, None tcp = getattr(ip, 'tcp', None) if tcp is not None: ...
python
def tcp_reassembly(packet, *, count=NotImplemented): """Make data for TCP reassembly.""" if getattr(packet, 'ip', None): ip = packet['ip'] elif getattr(packet, 'ip6', None): ip = packet['ip6'] else: return False, None tcp = getattr(ip, 'tcp', None) if tcp is not None: ...
[ "def", "tcp_reassembly", "(", "packet", ",", "*", ",", "count", "=", "NotImplemented", ")", ":", "if", "getattr", "(", "packet", ",", "'ip'", ",", "None", ")", ":", "ip", "=", "packet", "[", "'ip'", "]", "elif", "getattr", "(", "packet", ",", "'ip6'"...
Make data for TCP reassembly.
[ "Make", "data", "for", "TCP", "reassembly", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/dpkt.py#L109-L140
JarryShaw/PyPCAPKit
src/toolkit/dpkt.py
tcp_traceflow
def tcp_traceflow(packet, timestamp, *, data_link, count=NotImplemented): """Trace packet flow for TCP.""" if getattr(packet, 'ip', None): ip = packet['ip'] elif getattr(packet, 'ip6', None): ip = packet['ip6'] else: return False, None tcp = getattr(ip, 'tcp', None) if tc...
python
def tcp_traceflow(packet, timestamp, *, data_link, count=NotImplemented): """Trace packet flow for TCP.""" if getattr(packet, 'ip', None): ip = packet['ip'] elif getattr(packet, 'ip6', None): ip = packet['ip6'] else: return False, None tcp = getattr(ip, 'tcp', None) if tc...
[ "def", "tcp_traceflow", "(", "packet", ",", "timestamp", ",", "*", ",", "data_link", ",", "count", "=", "NotImplemented", ")", ":", "if", "getattr", "(", "packet", ",", "'ip'", ",", "None", ")", ":", "ip", "=", "packet", "[", "'ip'", "]", "elif", "ge...
Trace packet flow for TCP.
[ "Trace", "packet", "flow", "for", "TCP", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/dpkt.py#L143-L167
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2.read_http
def read_http(self, length): """Read Hypertext Transfer Protocol (HTTP/2). Structure of HTTP/2 packet [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ ...
python
def read_http(self, length): """Read Hypertext Transfer Protocol (HTTP/2). Structure of HTTP/2 packet [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ ...
[ "def", "read_http", "(", "self", ",", "length", ")", ":", "if", "length", "is", "None", ":", "length", "=", "len", "(", "self", ")", "if", "length", "<", "9", ":", "raise", "ProtocolError", "(", "f'HTTP/2: invalid format'", ",", "quiet", "=", "True", "...
Read Hypertext Transfer Protocol (HTTP/2). Structure of HTTP/2 packet [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) ...
[ "Read", "Hypertext", "Transfer", "Protocol", "(", "HTTP", "/", "2", ")", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L99-L155
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2._read_http_none
def _read_http_none(self, size, kind, flag): """Read HTTP packet with unsigned type.""" if any((int(bit, base=2) for bit in flag)): raise ProtocolError(f'HTTP/2: [Type {kind}] invalid format', quiet=True) data = dict( flags=None, payload=self._read_fileng(siz...
python
def _read_http_none(self, size, kind, flag): """Read HTTP packet with unsigned type.""" if any((int(bit, base=2) for bit in flag)): raise ProtocolError(f'HTTP/2: [Type {kind}] invalid format', quiet=True) data = dict( flags=None, payload=self._read_fileng(siz...
[ "def", "_read_http_none", "(", "self", ",", "size", ",", "kind", ",", "flag", ")", ":", "if", "any", "(", "(", "int", "(", "bit", ",", "base", "=", "2", ")", "for", "bit", "in", "flag", ")", ")", ":", "raise", "ProtocolError", "(", "f'HTTP/2: [Type...
Read HTTP packet with unsigned type.
[ "Read", "HTTP", "packet", "with", "unsigned", "type", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L172-L182
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2._read_http_data
def _read_http_data(self, size, kind, flag): """Read HTTP/2 DATA frames. Structure of HTTP/2 DATA frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ ...
python
def _read_http_data(self, size, kind, flag): """Read HTTP/2 DATA frames. Structure of HTTP/2 DATA frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ ...
[ "def", "_read_http_data", "(", "self", ",", "size", ",", "kind", ",", "flag", ")", ":", "_plen", "=", "0", "_flag", "=", "dict", "(", "END_STREAM", "=", "False", ",", "# bit 0", "PADDED", "=", "False", ",", "# bit 3", ")", "for", "index", ",", "bit",...
Read HTTP/2 DATA frames. Structure of HTTP/2 DATA frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | ...
[ "Read", "HTTP", "/", "2", "DATA", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L184-L252
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2._read_http_headers
def _read_http_headers(self, size, kind, flag): """Read HTTP/2 HEADERS frames. Structure of HTTP/2 HEADERS frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------...
python
def _read_http_headers(self, size, kind, flag): """Read HTTP/2 HEADERS frames. Structure of HTTP/2 HEADERS frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------...
[ "def", "_read_http_headers", "(", "self", ",", "size", ",", "kind", ",", "flag", ")", ":", "_plen", "=", "0", "_elen", "=", "0", "_flag", "=", "dict", "(", "END_STREAM", "=", "False", ",", "# bit 0", "END_HEADERS", "=", "False", ",", "# bit 2", "PADDED...
Read HTTP/2 HEADERS frames. Structure of HTTP/2 HEADERS frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | ...
[ "Read", "HTTP", "/", "2", "HEADERS", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L254-L340
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2._read_http_priority
def _read_http_priority(self, size, kind, flag): """Read HTTP/2 PRIORITY frames. Structure of HTTP/2 PRIORITY frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+------...
python
def _read_http_priority(self, size, kind, flag): """Read HTTP/2 PRIORITY frames. Structure of HTTP/2 PRIORITY frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+------...
[ "def", "_read_http_priority", "(", "self", ",", "size", ",", "kind", ",", "flag", ")", ":", "if", "size", "!=", "9", ":", "raise", "ProtocolError", "(", "f'HTTP/2: [Type {kind}] invalid format'", ",", "quiet", "=", "True", ")", "if", "any", "(", "(", "int"...
Read HTTP/2 PRIORITY frames. Structure of HTTP/2 PRIORITY frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | ...
[ "Read", "HTTP", "/", "2", "PRIORITY", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L342-L384
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2._read_http_rst_stream
def _read_http_rst_stream(self, size, kind, flag): """Read HTTP/2 RST_STREAM frames. Structure of HTTP/2 RST_STREAM frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+...
python
def _read_http_rst_stream(self, size, kind, flag): """Read HTTP/2 RST_STREAM frames. Structure of HTTP/2 RST_STREAM frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+...
[ "def", "_read_http_rst_stream", "(", "self", ",", "size", ",", "kind", ",", "flag", ")", ":", "if", "size", "!=", "8", ":", "raise", "ProtocolError", "(", "f'HTTP/2: [Type {kind}] invalid format'", ",", "quiet", "=", "True", ")", "if", "any", "(", "(", "in...
Read HTTP/2 RST_STREAM frames. Structure of HTTP/2 RST_STREAM frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) |...
[ "Read", "HTTP", "/", "2", "RST_STREAM", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L386-L421
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2._read_http_settings
def _read_http_settings(self, size, kind, flag): """Read HTTP/2 SETTINGS frames. Structure of HTTP/2 SETTINGS frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+------...
python
def _read_http_settings(self, size, kind, flag): """Read HTTP/2 SETTINGS frames. Structure of HTTP/2 SETTINGS frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+------...
[ "def", "_read_http_settings", "(", "self", ",", "size", ",", "kind", ",", "flag", ")", ":", "if", "size", "%", "5", "!=", "0", ":", "raise", "ProtocolError", "(", "f'HTTP/2: [Type {kind}] invalid format'", ",", "quiet", "=", "True", ")", "_flag", "=", "dic...
Read HTTP/2 SETTINGS frames. Structure of HTTP/2 SETTINGS frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | ...
[ "Read", "HTTP", "/", "2", "SETTINGS", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L423-L487
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2._read_http_push_promise
def _read_http_push_promise(self, size, kind, flag): """Read HTTP/2 PUSH_PROMISE frames. Structure of HTTP/2 PUSH_PROMISE frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+----------...
python
def _read_http_push_promise(self, size, kind, flag): """Read HTTP/2 PUSH_PROMISE frames. Structure of HTTP/2 PUSH_PROMISE frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+----------...
[ "def", "_read_http_push_promise", "(", "self", ",", "size", ",", "kind", ",", "flag", ")", ":", "if", "size", "<", "4", ":", "raise", "ProtocolError", "(", "f'HTTP/2: [Type {kind}] invalid format'", ",", "quiet", "=", "True", ")", "_plen", "=", "0", "_flag",...
Read HTTP/2 PUSH_PROMISE frames. Structure of HTTP/2 PUSH_PROMISE frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8)...
[ "Read", "HTTP", "/", "2", "PUSH_PROMISE", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L489-L566
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2._read_http_ping
def _read_http_ping(self, size, kind, flag): """Read HTTP/2 PING frames. Structure of HTTP/2 PING frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ ...
python
def _read_http_ping(self, size, kind, flag): """Read HTTP/2 PING frames. Structure of HTTP/2 PING frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ ...
[ "def", "_read_http_ping", "(", "self", ",", "size", ",", "kind", ",", "flag", ")", ":", "if", "size", "!=", "8", ":", "raise", "ProtocolError", "(", "f'HTTP/2: [Type {kind}] invalid format'", ",", "quiet", "=", "True", ")", "_flag", "=", "dict", "(", "ACK"...
Read HTTP/2 PING frames. Structure of HTTP/2 PING frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | ...
[ "Read", "HTTP", "/", "2", "PING", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L568-L614
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2._read_http_goaway
def _read_http_goaway(self, size, kind, flag): """Read HTTP/2 GOAWAY frames. Structure of HTTP/2 GOAWAY frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+------------...
python
def _read_http_goaway(self, size, kind, flag): """Read HTTP/2 GOAWAY frames. Structure of HTTP/2 GOAWAY frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+------------...
[ "def", "_read_http_goaway", "(", "self", ",", "size", ",", "kind", ",", "flag", ")", ":", "_dlen", "=", "size", "-", "8", "if", "_dlen", "<", "0", ":", "raise", "ProtocolError", "(", "f'HTTP/2: [Type {kind}] invalid format'", ",", "quiet", "=", "True", ")"...
Read HTTP/2 GOAWAY frames. Structure of HTTP/2 GOAWAY frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) | ...
[ "Read", "HTTP", "/", "2", "GOAWAY", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L616-L666
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2._read_http_window_update
def _read_http_window_update(self, size, kind, flag): """Read HTTP/2 WINDOW_UPDATE frames. Structure of HTTP/2 WINDOW_UPDATE frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+-------...
python
def _read_http_window_update(self, size, kind, flag): """Read HTTP/2 WINDOW_UPDATE frames. Structure of HTTP/2 WINDOW_UPDATE frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+-------...
[ "def", "_read_http_window_update", "(", "self", ",", "size", ",", "kind", ",", "flag", ")", ":", "if", "size", "!=", "4", ":", "raise", "ProtocolError", "(", "f'HTTP/2: [Type {kind}] invalid format'", ",", "quiet", "=", "True", ")", "if", "any", "(", "(", ...
Read HTTP/2 WINDOW_UPDATE frames. Structure of HTTP/2 WINDOW_UPDATE frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (...
[ "Read", "HTTP", "/", "2", "WINDOW_UPDATE", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L668-L707
JarryShaw/PyPCAPKit
src/protocols/application/httpv2.py
HTTPv2._read_http_continuation
def _read_http_continuation(self, size, kind, flag): """Read HTTP/2 WINDOW_UPDATE frames. Structure of HTTP/2 WINDOW_UPDATE frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+--------...
python
def _read_http_continuation(self, size, kind, flag): """Read HTTP/2 WINDOW_UPDATE frames. Structure of HTTP/2 WINDOW_UPDATE frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+--------...
[ "def", "_read_http_continuation", "(", "self", ",", "size", ",", "kind", ",", "flag", ")", ":", "_flag", "=", "dict", "(", "END_HEADERS", "=", "False", ",", "# bit 2", ")", "for", "index", ",", "bit", "in", "enumerate", "(", "flag", ")", ":", "if", "...
Read HTTP/2 WINDOW_UPDATE frames. Structure of HTTP/2 WINDOW_UPDATE frame [RFC 7540]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (...
[ "Read", "HTTP", "/", "2", "WINDOW_UPDATE", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/httpv2.py#L709-L750
JarryShaw/PyPCAPKit
src/const/ipv4/option_number.py
OptionNumber.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return OptionNumber(key) if key not in OptionNumber._member_map_: extend_enum(OptionNumber, key, default) return OptionNumber[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return OptionNumber(key) if key not in OptionNumber._member_map_: extend_enum(OptionNumber, key, default) return OptionNumber[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "OptionNumber", "(", "key", ")", "if", "key", "not", "in", "OptionNumber", ".", "_member_map_", ":", "extend_enum", "("...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/ipv4/option_number.py#L44-L50
JarryShaw/PyPCAPKit
src/protocols/transport/transport.py
Transport._import_next_layer
def _import_next_layer(self, proto, length): """Import next layer extractor. Positional arguments: * proto -- str, next layer protocol name * length -- int, valid (not padding) length Returns: * bool -- flag if extraction of next layer succeeded ...
python
def _import_next_layer(self, proto, length): """Import next layer extractor. Positional arguments: * proto -- str, next layer protocol name * length -- int, valid (not padding) length Returns: * bool -- flag if extraction of next layer succeeded ...
[ "def", "_import_next_layer", "(", "self", ",", "proto", ",", "length", ")", ":", "if", "self", ".", "_exproto", "==", "'null'", "and", "self", ".", "_exlayer", "==", "'None'", ":", "from", "pcapkit", ".", "protocols", ".", "raw", "import", "Raw", "as", ...
Import next layer extractor. Positional arguments: * proto -- str, next layer protocol name * length -- int, valid (not padding) length Returns: * bool -- flag if extraction of next layer succeeded * Info -- info of next layer * ProtoChain --...
[ "Import", "next", "layer", "extractor", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/transport/transport.py#L65-L90
JarryShaw/PyPCAPKit
src/const/ipv4/protection_authority.py
ProtectionAuthority.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return ProtectionAuthority(key) if key not in ProtectionAuthority._member_map_: extend_enum(ProtectionAuthority, key, default) return ProtectionAuthority[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return ProtectionAuthority(key) if key not in ProtectionAuthority._member_map_: extend_enum(ProtectionAuthority, key, default) return ProtectionAuthority[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "ProtectionAuthority", "(", "key", ")", "if", "key", "not", "in", "ProtectionAuthority", ".", "_member_map_", ":", "exten...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/ipv4/protection_authority.py#L22-L28
JarryShaw/PyPCAPKit
src/const/ipv6/router_alert.py
RouterAlert.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return RouterAlert(key) if key not in RouterAlert._member_map_: extend_enum(RouterAlert, key, default) return RouterAlert[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return RouterAlert(key) if key not in RouterAlert._member_map_: extend_enum(RouterAlert, key, default) return RouterAlert[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "RouterAlert", "(", "key", ")", "if", "key", "not", "in", "RouterAlert", ".", "_member_map_", ":", "extend_enum", "(", ...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/ipv6/router_alert.py#L85-L91
JarryShaw/PyPCAPKit
src/const/ipv6/qs_function.py
QS_Function.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return QS_Function(key) if key not in QS_Function._member_map_: extend_enum(QS_Function, key, default) return QS_Function[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return QS_Function(key) if key not in QS_Function._member_map_: extend_enum(QS_Function, key, default) return QS_Function[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "QS_Function", "(", "key", ")", "if", "key", "not", "in", "QS_Function", ".", "_member_map_", ":", "extend_enum", "(", ...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/ipv6/qs_function.py#L16-L22
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor.run
def run(self): """Start extraction.""" flag = True if self._exeng == 'dpkt': flag, engine = self.import_test('dpkt', name='DPKT') if flag: return self._run_dpkt(engine) elif self._exeng == 'scapy': flag, engine = self.import_test('scapy...
python
def run(self): """Start extraction.""" flag = True if self._exeng == 'dpkt': flag, engine = self.import_test('dpkt', name='DPKT') if flag: return self._run_dpkt(engine) elif self._exeng == 'scapy': flag, engine = self.import_test('scapy...
[ "def", "run", "(", "self", ")", ":", "flag", "=", "True", "if", "self", ".", "_exeng", "==", "'dpkt'", ":", "flag", ",", "engine", "=", "self", ".", "import_test", "(", "'dpkt'", ",", "name", "=", "'DPKT'", ")", "if", "flag", ":", "return", "self",...
Start extraction.
[ "Start", "extraction", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L224-L261
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor.record_header
def record_header(self): """Read global header. - Extract global header. - Make Info object out of header properties. - Append Info. - Write plist file. """ self._gbhdr = Header(self._ifile) self._vinfo = self._gbhdr.version self._dlink = self._g...
python
def record_header(self): """Read global header. - Extract global header. - Make Info object out of header properties. - Append Info. - Write plist file. """ self._gbhdr = Header(self._ifile) self._vinfo = self._gbhdr.version self._dlink = self._g...
[ "def", "record_header", "(", "self", ")", ":", "self", ".", "_gbhdr", "=", "Header", "(", "self", ".", "_ifile", ")", "self", ".", "_vinfo", "=", "self", ".", "_gbhdr", ".", "version", "self", ".", "_dlink", "=", "self", ".", "_gbhdr", ".", "protocol...
Read global header. - Extract global header. - Make Info object out of header properties. - Append Info. - Write plist file.
[ "Read", "global", "header", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L345-L370
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._cleanup
def _cleanup(self): """Cleanup after extraction & analysis.""" self._expkg = None self._extmp = None self._flag_e = True self._ifile.close()
python
def _cleanup(self): """Cleanup after extraction & analysis.""" self._expkg = None self._extmp = None self._flag_e = True self._ifile.close()
[ "def", "_cleanup", "(", "self", ")", ":", "self", ".", "_expkg", "=", "None", "self", ".", "_extmp", "=", "None", "self", ".", "_flag_e", "=", "True", "self", ".", "_ifile", ".", "close", "(", ")" ]
Cleanup after extraction & analysis.
[ "Cleanup", "after", "extraction", "&", "analysis", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L566-L571
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._aftermathmp
def _aftermathmp(self): """Aftermath for multiprocessing.""" if not self._flag_e and self._flag_m: # join processes [proc.join() for proc in self._mpprc] if self._exeng == 'server': self._mpsvc.join() # restore attributes if se...
python
def _aftermathmp(self): """Aftermath for multiprocessing.""" if not self._flag_e and self._flag_m: # join processes [proc.join() for proc in self._mpprc] if self._exeng == 'server': self._mpsvc.join() # restore attributes if se...
[ "def", "_aftermathmp", "(", "self", ")", ":", "if", "not", "self", ".", "_flag_e", "and", "self", ".", "_flag_m", ":", "# join processes", "[", "proc", ".", "join", "(", ")", "for", "proc", "in", "self", ".", "_mpprc", "]", "if", "self", ".", "_exeng...
Aftermath for multiprocessing.
[ "Aftermath", "for", "multiprocessing", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L573-L594
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._update_eof
def _update_eof(self): """Update EOF flag.""" self._aftermathmp() self._ifile.close() self._flag_e = True
python
def _update_eof(self): """Update EOF flag.""" self._aftermathmp() self._ifile.close() self._flag_e = True
[ "def", "_update_eof", "(", "self", ")", ":", "self", ".", "_aftermathmp", "(", ")", "self", ".", "_ifile", ".", "close", "(", ")", "self", ".", "_flag_e", "=", "True" ]
Update EOF flag.
[ "Update", "EOF", "flag", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L597-L601
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._read_frame
def _read_frame(self): """Headquarters for frame reader.""" if self._exeng == 'scapy': return self._scapy_read_frame() elif self._exeng == 'dpkt': return self._dpkt_read_frame() elif self._exeng == 'pyshark': return self._pyshark_read_frame() e...
python
def _read_frame(self): """Headquarters for frame reader.""" if self._exeng == 'scapy': return self._scapy_read_frame() elif self._exeng == 'dpkt': return self._dpkt_read_frame() elif self._exeng == 'pyshark': return self._pyshark_read_frame() e...
[ "def", "_read_frame", "(", "self", ")", ":", "if", "self", ".", "_exeng", "==", "'scapy'", ":", "return", "self", ".", "_scapy_read_frame", "(", ")", "elif", "self", ".", "_exeng", "==", "'dpkt'", ":", "return", "self", ".", "_dpkt_read_frame", "(", ")",...
Headquarters for frame reader.
[ "Headquarters", "for", "frame", "reader", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L603-L612
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._default_read_frame
def _default_read_frame(self, *, frame=None, mpkit=None): """Read frames with default engine. - Extract frames and each layer of packets. - Make Info object out of frame properties. - Append Info. - Write plist & append Info. """ from pcapkit.toolkit.default imp...
python
def _default_read_frame(self, *, frame=None, mpkit=None): """Read frames with default engine. - Extract frames and each layer of packets. - Make Info object out of frame properties. - Append Info. - Write plist & append Info. """ from pcapkit.toolkit.default imp...
[ "def", "_default_read_frame", "(", "self", ",", "*", ",", "frame", "=", "None", ",", "mpkit", "=", "None", ")", ":", "from", "pcapkit", ".", "toolkit", ".", "default", "import", "(", "ipv4_reassembly", ",", "ipv6_reassembly", ",", "tcp_reassembly", ",", "t...
Read frames with default engine. - Extract frames and each layer of packets. - Make Info object out of frame properties. - Append Info. - Write plist & append Info.
[ "Read", "frames", "with", "default", "engine", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L614-L685
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._run_scapy
def _run_scapy(self, scapy_all): """Call scapy.all.sniff to extract PCAP files.""" # if not self._flag_a: # self._flag_a = True # warnings.warn(f"'Extractor(engine=scapy)' object is not iterable; " # "so 'auto=False' will be ignored", AttributeWarning,...
python
def _run_scapy(self, scapy_all): """Call scapy.all.sniff to extract PCAP files.""" # if not self._flag_a: # self._flag_a = True # warnings.warn(f"'Extractor(engine=scapy)' object is not iterable; " # "so 'auto=False' will be ignored", AttributeWarning,...
[ "def", "_run_scapy", "(", "self", ",", "scapy_all", ")", ":", "# if not self._flag_a:", "# self._flag_a = True", "# warnings.warn(f\"'Extractor(engine=scapy)' object is not iterable; \"", "# \"so 'auto=False' will be ignored\", AttributeWarning, stacklevel=stackleve...
Call scapy.all.sniff to extract PCAP files.
[ "Call", "scapy", ".", "all", ".", "sniff", "to", "extract", "PCAP", "files", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L687-L704
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._scapy_read_frame
def _scapy_read_frame(self): """Read frames with Scapy.""" from pcapkit.toolkit.scapy import (ipv4_reassembly, ipv6_reassembly, packet2chain, packet2dict, tcp_reassembly, tcp_traceflow) # fetch Scapy packet ...
python
def _scapy_read_frame(self): """Read frames with Scapy.""" from pcapkit.toolkit.scapy import (ipv4_reassembly, ipv6_reassembly, packet2chain, packet2dict, tcp_reassembly, tcp_traceflow) # fetch Scapy packet ...
[ "def", "_scapy_read_frame", "(", "self", ")", ":", "from", "pcapkit", ".", "toolkit", ".", "scapy", "import", "(", "ipv4_reassembly", ",", "ipv6_reassembly", ",", "packet2chain", ",", "packet2dict", ",", "tcp_reassembly", ",", "tcp_traceflow", ")", "# fetch Scapy ...
Read frames with Scapy.
[ "Read", "frames", "with", "Scapy", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L706-L757
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._run_dpkt
def _run_dpkt(self, dpkt): """Call dpkt.pcap.Reader to extract PCAP files.""" # if not self._flag_a: # self._flag_a = True # warnings.warn(f"'Extractor(engine=dpkt)' object is not iterable; " # "so 'auto=False' will be ignored", AttributeWarning, stack...
python
def _run_dpkt(self, dpkt): """Call dpkt.pcap.Reader to extract PCAP files.""" # if not self._flag_a: # self._flag_a = True # warnings.warn(f"'Extractor(engine=dpkt)' object is not iterable; " # "so 'auto=False' will be ignored", AttributeWarning, stack...
[ "def", "_run_dpkt", "(", "self", ",", "dpkt", ")", ":", "# if not self._flag_a:", "# self._flag_a = True", "# warnings.warn(f\"'Extractor(engine=dpkt)' object is not iterable; \"", "# \"so 'auto=False' will be ignored\", AttributeWarning, stacklevel=stacklevel())", ...
Call dpkt.pcap.Reader to extract PCAP files.
[ "Call", "dpkt", ".", "pcap", ".", "Reader", "to", "extract", "PCAP", "files", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L759-L780
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._dpkt_read_frame
def _dpkt_read_frame(self): """Read frames.""" from pcapkit.toolkit.dpkt import (ipv4_reassembly, ipv6_reassembly, packet2chain, packet2dict, tcp_reassembly, tcp_traceflow) # fetch DPKT packet timestamp,...
python
def _dpkt_read_frame(self): """Read frames.""" from pcapkit.toolkit.dpkt import (ipv4_reassembly, ipv6_reassembly, packet2chain, packet2dict, tcp_reassembly, tcp_traceflow) # fetch DPKT packet timestamp,...
[ "def", "_dpkt_read_frame", "(", "self", ")", ":", "from", "pcapkit", ".", "toolkit", ".", "dpkt", "import", "(", "ipv4_reassembly", ",", "ipv6_reassembly", ",", "packet2chain", ",", "packet2dict", ",", "tcp_reassembly", ",", "tcp_traceflow", ")", "# fetch DPKT pac...
Read frames.
[ "Read", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L782-L848
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._run_pyshark
def _run_pyshark(self, pyshark): """Call pyshark.FileCapture to extract PCAP files.""" # if not self._flag_a: # self._flag_a = True # warnings.warn(f"'Extractor(engine=pyshark)' object is not iterable; " # "so 'auto=False' will be ignored", AttributeWa...
python
def _run_pyshark(self, pyshark): """Call pyshark.FileCapture to extract PCAP files.""" # if not self._flag_a: # self._flag_a = True # warnings.warn(f"'Extractor(engine=pyshark)' object is not iterable; " # "so 'auto=False' will be ignored", AttributeWa...
[ "def", "_run_pyshark", "(", "self", ",", "pyshark", ")", ":", "# if not self._flag_a:", "# self._flag_a = True", "# warnings.warn(f\"'Extractor(engine=pyshark)' object is not iterable; \"", "# \"so 'auto=False' will be ignored\", AttributeWarning, stacklevel=stackle...
Call pyshark.FileCapture to extract PCAP files.
[ "Call", "pyshark", ".", "FileCapture", "to", "extract", "PCAP", "files", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L850-L874
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._pyshark_read_frame
def _pyshark_read_frame(self): """Read frames.""" from pcapkit.toolkit.pyshark import packet2dict, tcp_traceflow # fetch PyShark packet packet = next(self._extmp) # def _pyshark_packet2chain(packet): # """Fetch PyShark packet protocol chain.""" # return ...
python
def _pyshark_read_frame(self): """Read frames.""" from pcapkit.toolkit.pyshark import packet2dict, tcp_traceflow # fetch PyShark packet packet = next(self._extmp) # def _pyshark_packet2chain(packet): # """Fetch PyShark packet protocol chain.""" # return ...
[ "def", "_pyshark_read_frame", "(", "self", ")", ":", "from", "pcapkit", ".", "toolkit", ".", "pyshark", "import", "packet2dict", ",", "tcp_traceflow", "# fetch PyShark packet", "packet", "=", "next", "(", "self", ".", "_extmp", ")", "# def _pyshark_packet2chain(pack...
Read frames.
[ "Read", "frames", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L876-L914
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._run_pipeline
def _run_pipeline(self, multiprocessing): """Use pipeline multiprocessing to extract PCAP files.""" if not self._flag_m: raise UnsupportedCall(f"Extractor(engine={self._exeng})' has no attribute '_run_pipline'") if not self._flag_q: self._flag_q = True warnin...
python
def _run_pipeline(self, multiprocessing): """Use pipeline multiprocessing to extract PCAP files.""" if not self._flag_m: raise UnsupportedCall(f"Extractor(engine={self._exeng})' has no attribute '_run_pipline'") if not self._flag_q: self._flag_q = True warnin...
[ "def", "_run_pipeline", "(", "self", ",", "multiprocessing", ")", ":", "if", "not", "self", ".", "_flag_m", ":", "raise", "UnsupportedCall", "(", "f\"Extractor(engine={self._exeng})' has no attribute '_run_pipline'\"", ")", "if", "not", "self", ".", "_flag_q", ":", ...
Use pipeline multiprocessing to extract PCAP files.
[ "Use", "pipeline", "multiprocessing", "to", "extract", "PCAP", "files", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L916-L977
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._pipeline_read_frame
def _pipeline_read_frame(self, *, mpfdp, mpkit): """Extract frame.""" # check EOF if self._flag_e: raise EOFError def _analyse_frame(*, frame, mpkit): """Analyse frame.""" # wait until ready while mpkit.current != self._frnum: ...
python
def _pipeline_read_frame(self, *, mpfdp, mpkit): """Extract frame.""" # check EOF if self._flag_e: raise EOFError def _analyse_frame(*, frame, mpkit): """Analyse frame.""" # wait until ready while mpkit.current != self._frnum: ...
[ "def", "_pipeline_read_frame", "(", "self", ",", "*", ",", "mpfdp", ",", "mpkit", ")", ":", "# check EOF", "if", "self", ".", "_flag_e", ":", "raise", "EOFError", "def", "_analyse_frame", "(", "*", ",", "frame", ",", "mpkit", ")", ":", "\"\"\"Analyse frame...
Extract frame.
[ "Extract", "frame", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L979-L1012
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._run_server
def _run_server(self, multiprocessing): """Use server multiprocessing to extract PCAP files.""" if not self._flag_m: raise UnsupportedCall(f"Extractor(engine={self._exeng})' has no attribute '_run_server'") if not self._flag_q: self._flag_q = True warnings.wa...
python
def _run_server(self, multiprocessing): """Use server multiprocessing to extract PCAP files.""" if not self._flag_m: raise UnsupportedCall(f"Extractor(engine={self._exeng})' has no attribute '_run_server'") if not self._flag_q: self._flag_q = True warnings.wa...
[ "def", "_run_server", "(", "self", ",", "multiprocessing", ")", ":", "if", "not", "self", ".", "_flag_m", ":", "raise", "UnsupportedCall", "(", "f\"Extractor(engine={self._exeng})' has no attribute '_run_server'\"", ")", "if", "not", "self", ".", "_flag_q", ":", "se...
Use server multiprocessing to extract PCAP files.
[ "Use", "server", "multiprocessing", "to", "extract", "PCAP", "files", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L1015-L1082
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._server_extract_frame
def _server_extract_frame(self, *, mpfdp, mpkit, mpbuf): """Extract frame.""" # check EOF if self._flag_e: raise EOFError # extract frame try: frame = Frame(self._ifile, num=self._frnum, proto=self._dlink, layer=self._exlyr, prot...
python
def _server_extract_frame(self, *, mpfdp, mpkit, mpbuf): """Extract frame.""" # check EOF if self._flag_e: raise EOFError # extract frame try: frame = Frame(self._ifile, num=self._frnum, proto=self._dlink, layer=self._exlyr, prot...
[ "def", "_server_extract_frame", "(", "self", ",", "*", ",", "mpfdp", ",", "mpkit", ",", "mpbuf", ")", ":", "# check EOF", "if", "self", ".", "_flag_e", ":", "raise", "EOFError", "# extract frame", "try", ":", "frame", "=", "Frame", "(", "self", ".", "_if...
Extract frame.
[ "Extract", "frame", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L1084-L1101
JarryShaw/PyPCAPKit
src/foundation/extraction.py
Extractor._server_analyse_frame
def _server_analyse_frame(self, *, mpkit, mpfrm, mprsm, mpbuf): """Analyse frame.""" while True: # fetch frame # print(self._frnum, 'trying') frame = mpbuf.pop(self._frnum, None) if frame is EOFError: break if frame is None: ...
python
def _server_analyse_frame(self, *, mpkit, mpfrm, mprsm, mpbuf): """Analyse frame.""" while True: # fetch frame # print(self._frnum, 'trying') frame = mpbuf.pop(self._frnum, None) if frame is EOFError: break if frame is None: ...
[ "def", "_server_analyse_frame", "(", "self", ",", "*", ",", "mpkit", ",", "mpfrm", ",", "mprsm", ",", "mpbuf", ")", ":", "while", "True", ":", "# fetch frame", "# print(self._frnum, 'trying')", "frame", "=", "mpbuf", ".", "pop", "(", "self", ".", "_frnum", ...
Analyse frame.
[ "Analyse", "frame", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/extraction.py#L1104-L1119
JarryShaw/PyPCAPKit
src/const/tcp/checksum.py
Checksum.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Checksum(key) if key not in Checksum._member_map_: extend_enum(Checksum, key, default) return Checksum[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Checksum(key) if key not in Checksum._member_map_: extend_enum(Checksum, key, default) return Checksum[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "Checksum", "(", "key", ")", "if", "key", "not", "in", "Checksum", ".", "_member_map_", ":", "extend_enum", "(", "Che...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/tcp/checksum.py#L18-L24
JarryShaw/PyPCAPKit
src/const/arp/operation.py
Operation.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Operation(key) if key not in Operation._member_map_: extend_enum(Operation, key, default) return Operation[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Operation(key) if key not in Operation._member_map_: extend_enum(Operation, key, default) return Operation[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "Operation", "(", "key", ")", "if", "key", "not", "in", "Operation", ".", "_member_map_", ":", "extend_enum", "(", "O...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/arp/operation.py#L41-L47
JarryShaw/PyPCAPKit
src/protocols/application/NotImplemented/httpv2.py
HTTPv2.read_http
def read_http(self, length): """Read Hypertext Transfer Protocol version 2. Structure of HTTP/2 packet [RFC 7230]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ ...
python
def read_http(self, length): """Read Hypertext Transfer Protocol version 2. Structure of HTTP/2 packet [RFC 7230]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ ...
[ "def", "read_http", "(", "self", ",", "length", ")", ":", "_plen", "=", "self", ".", "_read_binary", "(", "3", ")", "_type", "=", "self", ".", "_read_unpack", "(", "1", ")", "_flag", "=", "self", ".", "_read_binary", "(", "1", ")", "_stid", "=", "s...
Read Hypertext Transfer Protocol version 2. Structure of HTTP/2 packet [RFC 7230]: +-----------------------------------------------+ | Length (24) | +---------------+---------------+---------------+ | Type (8) | Flags (8) ...
[ "Read", "Hypertext", "Transfer", "Protocol", "version", "2", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/application/NotImplemented/httpv2.py#L57-L75
JarryShaw/PyPCAPKit
src/foundation/analysis.py
analyse
def analyse(file, length=None, *, _termination=False): """Analyse application layer packets.""" seekset = file.tell() if not _termination: # FTP analysis flag, ftp = _analyse_ftp(file, length, seekset=seekset) if flag: return ftp # HTTP/1.* analysis flag,...
python
def analyse(file, length=None, *, _termination=False): """Analyse application layer packets.""" seekset = file.tell() if not _termination: # FTP analysis flag, ftp = _analyse_ftp(file, length, seekset=seekset) if flag: return ftp # HTTP/1.* analysis flag,...
[ "def", "analyse", "(", "file", ",", "length", "=", "None", ",", "*", ",", "_termination", "=", "False", ")", ":", "seekset", "=", "file", ".", "tell", "(", ")", "if", "not", "_termination", ":", "# FTP analysis", "flag", ",", "ftp", "=", "_analyse_ftp"...
Analyse application layer packets.
[ "Analyse", "application", "layer", "packets", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/analysis.py#L24-L50
JarryShaw/PyPCAPKit
src/const/ipv6/routing.py
Routing.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Routing(key) if key not in Routing._member_map_: extend_enum(Routing, key, default) return Routing[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Routing(key) if key not in Routing._member_map_: extend_enum(Routing, key, default) return Routing[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "Routing", "(", "key", ")", "if", "key", "not", "in", "Routing", ".", "_member_map_", ":", "extend_enum", "(", "Routi...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/ipv6/routing.py#L21-L27
JarryShaw/PyPCAPKit
src/protocols/link/link.py
Link._read_protos
def _read_protos(self, size): """Read next layer protocol type. Positional arguments: * size -- int, buffer size Returns: * str -- next layer's protocol name """ _byte = self._read_unpack(size) _prot = ETHERTYPE.get(_byte) return _prot
python
def _read_protos(self, size): """Read next layer protocol type. Positional arguments: * size -- int, buffer size Returns: * str -- next layer's protocol name """ _byte = self._read_unpack(size) _prot = ETHERTYPE.get(_byte) return _prot
[ "def", "_read_protos", "(", "self", ",", "size", ")", ":", "_byte", "=", "self", ".", "_read_unpack", "(", "size", ")", "_prot", "=", "ETHERTYPE", ".", "get", "(", "_byte", ")", "return", "_prot" ]
Read next layer protocol type. Positional arguments: * size -- int, buffer size Returns: * str -- next layer's protocol name
[ "Read", "next", "layer", "protocol", "type", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/link/link.py#L65-L77
JarryShaw/PyPCAPKit
src/protocols/link/link.py
Link._import_next_layer
def _import_next_layer(self, proto, length): """Import next layer extractor. Positional arguments: * proto -- str, next layer protocol name * length -- int, valid (not padding) length Returns: * bool -- flag if extraction of next layer succeeded ...
python
def _import_next_layer(self, proto, length): """Import next layer extractor. Positional arguments: * proto -- str, next layer protocol name * length -- int, valid (not padding) length Returns: * bool -- flag if extraction of next layer succeeded ...
[ "def", "_import_next_layer", "(", "self", ",", "proto", ",", "length", ")", ":", "if", "length", "==", "0", ":", "from", "pcapkit", ".", "protocols", ".", "null", "import", "NoPayload", "as", "Protocol", "elif", "self", ".", "_sigterm", ":", "from", "pca...
Import next layer extractor. Positional arguments: * proto -- str, next layer protocol name * length -- int, valid (not padding) length Returns: * bool -- flag if extraction of next layer succeeded * Info -- info of next layer * ProtoChain --...
[ "Import", "next", "layer", "extractor", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/link/link.py#L79-L121
JarryShaw/PyPCAPKit
src/const/hip/hit_suite.py
HIT_Suite.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return HIT_Suite(key) if key not in HIT_Suite._member_map_: extend_enum(HIT_Suite, key, default) return HIT_Suite[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return HIT_Suite(key) if key not in HIT_Suite._member_map_: extend_enum(HIT_Suite, key, default) return HIT_Suite[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "HIT_Suite", "(", "key", ")", "if", "key", "not", "in", "HIT_Suite", ".", "_member_map_", ":", "extend_enum", "(", "H...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/hip/hit_suite.py#L18-L24
JarryShaw/PyPCAPKit
src/const/ospf/authentication.py
Authentication.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Authentication(key) if key not in Authentication._member_map_: extend_enum(Authentication, key, default) return Authentication[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Authentication(key) if key not in Authentication._member_map_: extend_enum(Authentication, key, default) return Authentication[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "Authentication", "(", "key", ")", "if", "key", "not", "in", "Authentication", ".", "_member_map_", ":", "extend_enum", ...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/ospf/authentication.py#L18-L24
JarryShaw/PyPCAPKit
src/foundation/traceflow.py
TraceFlow.make_fout
def make_fout(fout='./tmp', fmt='pcap'): """Make root path for output. Positional arguments: * fout -- str, root path for output * fmt -- str, output format Returns: * output -- dumper of specified format """ if fmt == 'pcap': # output...
python
def make_fout(fout='./tmp', fmt='pcap'): """Make root path for output. Positional arguments: * fout -- str, root path for output * fmt -- str, output format Returns: * output -- dumper of specified format """ if fmt == 'pcap': # output...
[ "def", "make_fout", "(", "fout", "=", "'./tmp'", ",", "fmt", "=", "'pcap'", ")", ":", "if", "fmt", "==", "'pcap'", ":", "# output PCAP file", "from", "pcapkit", ".", "dumpkit", "import", "PCAP", "as", "output", "elif", "fmt", "==", "'plist'", ":", "# out...
Make root path for output. Positional arguments: * fout -- str, root path for output * fmt -- str, output format Returns: * output -- dumper of specified format
[ "Make", "root", "path", "for", "output", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/traceflow.py#L55-L95
JarryShaw/PyPCAPKit
src/foundation/traceflow.py
TraceFlow.dump
def dump(self, packet): """Dump frame to output files. Positional arguments: * packet -- dict, a flow packet |-- (str) protocol -- data link type from global header |-- (int) index -- frame number |-- (Info) frame -- extracted frame info ...
python
def dump(self, packet): """Dump frame to output files. Positional arguments: * packet -- dict, a flow packet |-- (str) protocol -- data link type from global header |-- (int) index -- frame number |-- (Info) frame -- extracted frame info ...
[ "def", "dump", "(", "self", ",", "packet", ")", ":", "# fetch flow label", "output", "=", "self", ".", "trace", "(", "packet", ",", "_check", "=", "False", ",", "_output", "=", "True", ")", "# dump files", "output", "(", "packet", "[", "'frame'", "]", ...
Dump frame to output files. Positional arguments: * packet -- dict, a flow packet |-- (str) protocol -- data link type from global header |-- (int) index -- frame number |-- (Info) frame -- extracted frame info |-- (bool) syn -- TCP sy...
[ "Dump", "frame", "to", "output", "files", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/traceflow.py#L97-L119
JarryShaw/PyPCAPKit
src/foundation/traceflow.py
TraceFlow.trace
def trace(self, packet, *, _check=True, _output=False): """Trace packets. Positional arguments: * packet -- dict, a flow packet Keyword arguments: * _check -- bool, flag if run validations * _output -- bool, flag if has formatted dumper """ ...
python
def trace(self, packet, *, _check=True, _output=False): """Trace packets. Positional arguments: * packet -- dict, a flow packet Keyword arguments: * _check -- bool, flag if run validations * _output -- bool, flag if has formatted dumper """ ...
[ "def", "trace", "(", "self", ",", "packet", ",", "*", ",", "_check", "=", "True", ",", "_output", "=", "False", ")", ":", "self", ".", "_newflg", "=", "True", "if", "_check", ":", "pkt_check", "(", "packet", ")", "info", "=", "Info", "(", "packet",...
Trace packets. Positional arguments: * packet -- dict, a flow packet Keyword arguments: * _check -- bool, flag if run validations * _output -- bool, flag if has formatted dumper
[ "Trace", "packets", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/traceflow.py#L121-L178
JarryShaw/PyPCAPKit
src/foundation/traceflow.py
TraceFlow.submit
def submit(self): """Submit traced TCP flows.""" self._newflg = False ret = list() for buf in self._buffer.values(): buf = copy.deepcopy(buf) if self._fdpext: buf['fpout'] = f"{self._fproot}/{buf['label']}.{self._fdpext}" else: ...
python
def submit(self): """Submit traced TCP flows.""" self._newflg = False ret = list() for buf in self._buffer.values(): buf = copy.deepcopy(buf) if self._fdpext: buf['fpout'] = f"{self._fproot}/{buf['label']}.{self._fdpext}" else: ...
[ "def", "submit", "(", "self", ")", ":", "self", ".", "_newflg", "=", "False", "ret", "=", "list", "(", ")", "for", "buf", "in", "self", ".", "_buffer", ".", "values", "(", ")", ":", "buf", "=", "copy", ".", "deepcopy", "(", "buf", ")", "if", "s...
Submit traced TCP flows.
[ "Submit", "traced", "TCP", "flows", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/foundation/traceflow.py#L180-L193
JarryShaw/PyPCAPKit
src/protocols/internet/ah.py
AH.read_ah
def read_ah(self, length, version, extension): """Read Authentication Header. Structure of AH header [RFC 4302]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-...
python
def read_ah(self, length, version, extension): """Read Authentication Header. Structure of AH header [RFC 4302]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-...
[ "def", "read_ah", "(", "self", ",", "length", ",", "version", ",", "extension", ")", ":", "if", "length", "is", "None", ":", "length", "=", "len", "(", "self", ")", "_next", "=", "self", ".", "_read_protos", "(", "1", ")", "_plen", "=", "self", "."...
Read Authentication Header. Structure of AH header [RFC 4302]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next...
[ "Read", "Authentication", "Header", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/ah.py#L91-L158
JarryShaw/PyPCAPKit
src/protocols/link/ethernet.py
Ethernet.read_ethernet
def read_ethernet(self, length): """Read Ethernet Protocol. Structure of Ethernet Protocol header [RFC 7042]: Octets Bits Name Description 0 0 eth.dst Destination MAC Address 1 8 eth.src ...
python
def read_ethernet(self, length): """Read Ethernet Protocol. Structure of Ethernet Protocol header [RFC 7042]: Octets Bits Name Description 0 0 eth.dst Destination MAC Address 1 8 eth.src ...
[ "def", "read_ethernet", "(", "self", ",", "length", ")", ":", "if", "length", "is", "None", ":", "length", "=", "len", "(", "self", ")", "_dstm", "=", "self", ".", "_read_mac_addr", "(", ")", "_srcm", "=", "self", ".", "_read_mac_addr", "(", ")", "_t...
Read Ethernet Protocol. Structure of Ethernet Protocol header [RFC 7042]: Octets Bits Name Description 0 0 eth.dst Destination MAC Address 1 8 eth.src Source MAC Address ...
[ "Read", "Ethernet", "Protocol", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/link/ethernet.py#L92-L118
JarryShaw/PyPCAPKit
src/protocols/link/ethernet.py
Ethernet._read_mac_addr
def _read_mac_addr(self): """Read MAC address.""" _byte = self._read_fileng(6) _addr = '-'.join(textwrap.wrap(_byte.hex(), 2)) return _addr
python
def _read_mac_addr(self): """Read MAC address.""" _byte = self._read_fileng(6) _addr = '-'.join(textwrap.wrap(_byte.hex(), 2)) return _addr
[ "def", "_read_mac_addr", "(", "self", ")", ":", "_byte", "=", "self", ".", "_read_fileng", "(", "6", ")", "_addr", "=", "'-'", ".", "join", "(", "textwrap", ".", "wrap", "(", "_byte", ".", "hex", "(", ")", ",", "2", ")", ")", "return", "_addr" ]
Read MAC address.
[ "Read", "MAC", "address", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/link/ethernet.py#L135-L139
JarryShaw/PyPCAPKit
src/const/hip/suite.py
Suite.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Suite(key) if key not in Suite._member_map_: extend_enum(Suite, key, default) return Suite[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Suite(key) if key not in Suite._member_map_: extend_enum(Suite, key, default) return Suite[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "Suite", "(", "key", ")", "if", "key", "not", "in", "Suite", ".", "_member_map_", ":", "extend_enum", "(", "Suite", ...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/hip/suite.py#L21-L27
JarryShaw/PyPCAPKit
src/const/hip/ecdsa_curve.py
ECDSA_Curve.get
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return ECDSA_Curve(key) if key not in ECDSA_Curve._member_map_: extend_enum(ECDSA_Curve, key, default) return ECDSA_Curve[key]
python
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return ECDSA_Curve(key) if key not in ECDSA_Curve._member_map_: extend_enum(ECDSA_Curve, key, default) return ECDSA_Curve[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "ECDSA_Curve", "(", "key", ")", "if", "key", "not", "in", "ECDSA_Curve", ".", "_member_map_", ":", "extend_enum", "(", ...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/hip/ecdsa_curve.py#L17-L23
JarryShaw/PyPCAPKit
src/toolkit/pyshark.py
packet2dict
def packet2dict(packet): """Convert PyShark packet into dict.""" dict_ = dict() frame = packet.frame_info for field in frame.field_names: dict_[field] = getattr(frame, field) tempdict = dict_ for layer in packet.layers: tempdict[layer.layer_name.upper()] = dict() tempdic...
python
def packet2dict(packet): """Convert PyShark packet into dict.""" dict_ = dict() frame = packet.frame_info for field in frame.field_names: dict_[field] = getattr(frame, field) tempdict = dict_ for layer in packet.layers: tempdict[layer.layer_name.upper()] = dict() tempdic...
[ "def", "packet2dict", "(", "packet", ")", ":", "dict_", "=", "dict", "(", ")", "frame", "=", "packet", ".", "frame_info", "for", "field", "in", "frame", ".", "field_names", ":", "dict_", "[", "field", "]", "=", "getattr", "(", "frame", ",", "field", ...
Convert PyShark packet into dict.
[ "Convert", "PyShark", "packet", "into", "dict", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/pyshark.py#L17-L31
JarryShaw/PyPCAPKit
src/toolkit/pyshark.py
tcp_traceflow
def tcp_traceflow(packet): """Trace packet flow for TCP.""" if 'TCP' in packet: ip = packet.ip if 'IP' in packet else packet.ipv6 tcp = packet.tcp data = dict( protocol=LINKTYPE.get(packet.layers[0].layer_name.upper()), # data link type from global header inde...
python
def tcp_traceflow(packet): """Trace packet flow for TCP.""" if 'TCP' in packet: ip = packet.ip if 'IP' in packet else packet.ipv6 tcp = packet.tcp data = dict( protocol=LINKTYPE.get(packet.layers[0].layer_name.upper()), # data link type from global header inde...
[ "def", "tcp_traceflow", "(", "packet", ")", ":", "if", "'TCP'", "in", "packet", ":", "ip", "=", "packet", ".", "ip", "if", "'IP'", "in", "packet", "else", "packet", ".", "ipv6", "tcp", "=", "packet", ".", "tcp", "data", "=", "dict", "(", "protocol", ...
Trace packet flow for TCP.
[ "Trace", "packet", "flow", "for", "TCP", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/pyshark.py#L34-L52
JarryShaw/PyPCAPKit
src/reassembly/tcp.py
TCP_Reassembly.reassembly
def reassembly(self, info): """Reassembly procedure. Positional arguments: * info -- Info, info dict of packets to be reassembled """ BUFID = info.bufid # Buffer Identifier DSN = info.dsn # Data Sequence Number ACK = info.ack # Acknowledgement Num...
python
def reassembly(self, info): """Reassembly procedure. Positional arguments: * info -- Info, info dict of packets to be reassembled """ BUFID = info.bufid # Buffer Identifier DSN = info.dsn # Data Sequence Number ACK = info.ack # Acknowledgement Num...
[ "def", "reassembly", "(", "self", ",", "info", ")", ":", "BUFID", "=", "info", ".", "bufid", "# Buffer Identifier", "DSN", "=", "info", ".", "dsn", "# Data Sequence Number", "ACK", "=", "info", ".", "ack", "# Acknowledgement Number", "FIN", "=", "info", ".",...
Reassembly procedure. Positional arguments: * info -- Info, info dict of packets to be reassembled
[ "Reassembly", "procedure", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/reassembly/tcp.py#L228-L319
JarryShaw/PyPCAPKit
src/reassembly/tcp.py
TCP_Reassembly.submit
def submit(self, buf, *, bufid): """Submit reassembled payload. Positional arguments: * buf -- dict, buffer dict of reassembled packets Keyword arguments: * bufid -- tuple, buffer identifier Returns: * list -- reassembled packets """ ...
python
def submit(self, buf, *, bufid): """Submit reassembled payload. Positional arguments: * buf -- dict, buffer dict of reassembled packets Keyword arguments: * bufid -- tuple, buffer identifier Returns: * list -- reassembled packets """ ...
[ "def", "submit", "(", "self", ",", "buf", ",", "*", ",", "bufid", ")", ":", "datagram", "=", "[", "]", "# reassembled datagram", "HDL", "=", "buf", ".", "pop", "(", "'hdl'", ")", "# hole descriptor list (remove from dict)", "# check through every buffer with ACK",...
Submit reassembled payload. Positional arguments: * buf -- dict, buffer dict of reassembled packets Keyword arguments: * bufid -- tuple, buffer identifier Returns: * list -- reassembled packets
[ "Submit", "reassembled", "payload", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/reassembly/tcp.py#L321-L383
JarryShaw/PyPCAPKit
src/toolkit/scapy.py
packet2chain
def packet2chain(packet): """Fetch Scapy packet protocol chain.""" if scapy_all is None: raise ModuleNotFound("No module named 'scapy'", name='scapy') chain = [packet.name] payload = packet.payload while not isinstance(payload, scapy_all.packet.NoPayload): chain.append(payload.name) ...
python
def packet2chain(packet): """Fetch Scapy packet protocol chain.""" if scapy_all is None: raise ModuleNotFound("No module named 'scapy'", name='scapy') chain = [packet.name] payload = packet.payload while not isinstance(payload, scapy_all.packet.NoPayload): chain.append(payload.name) ...
[ "def", "packet2chain", "(", "packet", ")", ":", "if", "scapy_all", "is", "None", ":", "raise", "ModuleNotFound", "(", "\"No module named 'scapy'\"", ",", "name", "=", "'scapy'", ")", "chain", "=", "[", "packet", ".", "name", "]", "payload", "=", "packet", ...
Fetch Scapy packet protocol chain.
[ "Fetch", "Scapy", "packet", "protocol", "chain", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/scapy.py#L36-L45
JarryShaw/PyPCAPKit
src/toolkit/scapy.py
packet2dict
def packet2dict(packet, *, count=NotImplemented): """Convert Scapy packet into dict.""" if scapy_all is None: raise ModuleNotFound("No module named 'scapy'", name='scapy') def wrapper(packet): dict_ = packet.fields payload = packet.payload if not isinstance(payload, scapy_al...
python
def packet2dict(packet, *, count=NotImplemented): """Convert Scapy packet into dict.""" if scapy_all is None: raise ModuleNotFound("No module named 'scapy'", name='scapy') def wrapper(packet): dict_ = packet.fields payload = packet.payload if not isinstance(payload, scapy_al...
[ "def", "packet2dict", "(", "packet", ",", "*", ",", "count", "=", "NotImplemented", ")", ":", "if", "scapy_all", "is", "None", ":", "raise", "ModuleNotFound", "(", "\"No module named 'scapy'\"", ",", "name", "=", "'scapy'", ")", "def", "wrapper", "(", "packe...
Convert Scapy packet into dict.
[ "Convert", "Scapy", "packet", "into", "dict", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/scapy.py#L48-L63
JarryShaw/PyPCAPKit
src/toolkit/scapy.py
ipv4_reassembly
def ipv4_reassembly(packet, *, count=NotImplemented): """Make data for IPv4 reassembly.""" if 'IP' in packet: ipv4 = packet['IP'] if ipv4.flags.DF: # dismiss not fragmented packet return False, None data = dict( bufid=( ipaddress.ip_address(i...
python
def ipv4_reassembly(packet, *, count=NotImplemented): """Make data for IPv4 reassembly.""" if 'IP' in packet: ipv4 = packet['IP'] if ipv4.flags.DF: # dismiss not fragmented packet return False, None data = dict( bufid=( ipaddress.ip_address(i...
[ "def", "ipv4_reassembly", "(", "packet", ",", "*", ",", "count", "=", "NotImplemented", ")", ":", "if", "'IP'", "in", "packet", ":", "ipv4", "=", "packet", "[", "'IP'", "]", "if", "ipv4", ".", "flags", ".", "DF", ":", "# dismiss not fragmented packet", "...
Make data for IPv4 reassembly.
[ "Make", "data", "for", "IPv4", "reassembly", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/scapy.py#L66-L88
JarryShaw/PyPCAPKit
src/toolkit/scapy.py
ipv6_reassembly
def ipv6_reassembly(packet, *, count=NotImplemented): """Make data for IPv6 reassembly.""" if scapy_all is None: raise ModuleNotFound("No module named 'scapy'", name='scapy') if 'IPv6' in packet: ipv6 = packet['IPv6'] if scapy_all.IPv6ExtHdrFragment not in ipv6: # pylint: disable=E1...
python
def ipv6_reassembly(packet, *, count=NotImplemented): """Make data for IPv6 reassembly.""" if scapy_all is None: raise ModuleNotFound("No module named 'scapy'", name='scapy') if 'IPv6' in packet: ipv6 = packet['IPv6'] if scapy_all.IPv6ExtHdrFragment not in ipv6: # pylint: disable=E1...
[ "def", "ipv6_reassembly", "(", "packet", ",", "*", ",", "count", "=", "NotImplemented", ")", ":", "if", "scapy_all", "is", "None", ":", "raise", "ModuleNotFound", "(", "\"No module named 'scapy'\"", ",", "name", "=", "'scapy'", ")", "if", "'IPv6'", "in", "pa...
Make data for IPv6 reassembly.
[ "Make", "data", "for", "IPv6", "reassembly", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/scapy.py#L91-L116
JarryShaw/PyPCAPKit
src/toolkit/scapy.py
tcp_reassembly
def tcp_reassembly(packet, *, count=NotImplemented): """Store data for TCP reassembly.""" if 'TCP' in packet: ip = packet['IP'] if 'IP' in packet else packet['IPv6'] tcp = packet['TCP'] data = dict( bufid=( ipaddress.ip_address(ip.src), # source IP addre...
python
def tcp_reassembly(packet, *, count=NotImplemented): """Store data for TCP reassembly.""" if 'TCP' in packet: ip = packet['IP'] if 'IP' in packet else packet['IPv6'] tcp = packet['TCP'] data = dict( bufid=( ipaddress.ip_address(ip.src), # source IP addre...
[ "def", "tcp_reassembly", "(", "packet", ",", "*", ",", "count", "=", "NotImplemented", ")", ":", "if", "'TCP'", "in", "packet", ":", "ip", "=", "packet", "[", "'IP'", "]", "if", "'IP'", "in", "packet", "else", "packet", "[", "'IPv6'", "]", "tcp", "="...
Store data for TCP reassembly.
[ "Store", "data", "for", "TCP", "reassembly", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/scapy.py#L119-L144
JarryShaw/PyPCAPKit
src/toolkit/scapy.py
tcp_traceflow
def tcp_traceflow(packet, *, count=NotImplemented): """Trace packet flow for TCP.""" if 'TCP' in packet: ip = packet['IP'] if 'IP' in packet else packet['IPv6'] tcp = packet['TCP'] data = dict( protocol=LINKTYPE.get(packet.name.upper()), # data link type from global heade...
python
def tcp_traceflow(packet, *, count=NotImplemented): """Trace packet flow for TCP.""" if 'TCP' in packet: ip = packet['IP'] if 'IP' in packet else packet['IPv6'] tcp = packet['TCP'] data = dict( protocol=LINKTYPE.get(packet.name.upper()), # data link type from global heade...
[ "def", "tcp_traceflow", "(", "packet", ",", "*", ",", "count", "=", "NotImplemented", ")", ":", "if", "'TCP'", "in", "packet", ":", "ip", "=", "packet", "[", "'IP'", "]", "if", "'IP'", "in", "packet", "else", "packet", "[", "'IPv6'", "]", "tcp", "=",...
Trace packet flow for TCP.
[ "Trace", "packet", "flow", "for", "TCP", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/toolkit/scapy.py#L147-L165
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT.read_hopopt
def read_hopopt(self, length, extension): """Read IPv6 Hop-by-Hop Options. Structure of HOPOPT header [RFC 8200]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | | +-+-+-+-+-+-+-+-+-+-+...
python
def read_hopopt(self, length, extension): """Read IPv6 Hop-by-Hop Options. Structure of HOPOPT header [RFC 8200]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | | +-+-+-+-+-+-+-+-+-+-+...
[ "def", "read_hopopt", "(", "self", ",", "length", ",", "extension", ")", ":", "if", "length", "is", "None", ":", "length", "=", "len", "(", "self", ")", "_next", "=", "self", ".", "_read_protos", "(", "1", ")", "_hlen", "=", "self", ".", "_read_unpac...
Read IPv6 Hop-by-Hop Options. Structure of HOPOPT header [RFC 8200]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + ...
[ "Read", "IPv6", "Hop", "-", "by", "-", "Hop", "Options", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L147-L189
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_hopopt_options
def _read_hopopt_options(self, length): """Read HOPOPT options. Positional arguments: * length -- int, length of options Returns: * dict -- extracted HOPOPT options """ counter = 0 # length of read options optkind = list() # option ty...
python
def _read_hopopt_options(self, length): """Read HOPOPT options. Positional arguments: * length -- int, length of options Returns: * dict -- extracted HOPOPT options """ counter = 0 # length of read options optkind = list() # option ty...
[ "def", "_read_hopopt_options", "(", "self", ",", "length", ")", ":", "counter", "=", "0", "# length of read options", "optkind", "=", "list", "(", ")", "# option type list", "options", "=", "dict", "(", ")", "# dict of option data", "while", "counter", "<", "len...
Read HOPOPT options. Positional arguments: * length -- int, length of options Returns: * dict -- extracted HOPOPT options
[ "Read", "HOPOPT", "options", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L234-L274
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_pad
def _read_opt_pad(self, code, *, desc): """Read HOPOPT padding options. Structure of HOPOPT padding options [RFC 8200]: * Pad1 Option: +-+-+-+-+-+-+-+-+ | 0 | +-+-+-+-+-+-+-+-+ Octets Bits Name ...
python
def _read_opt_pad(self, code, *, desc): """Read HOPOPT padding options. Structure of HOPOPT padding options [RFC 8200]: * Pad1 Option: +-+-+-+-+-+-+-+-+ | 0 | +-+-+-+-+-+-+-+-+ Octets Bits Name ...
[ "def", "_read_opt_pad", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "if", "code", "==", "0", ":", "opt", "=", "dict", "(", "desc", "=", "desc", ",", "type", "=", "_type...
Read HOPOPT padding options. Structure of HOPOPT padding options [RFC 8200]: * Pad1 Option: +-+-+-+-+-+-+-+-+ | 0 | +-+-+-+-+-+-+-+-+ Octets Bits Name Description 0 ...
[ "Read", "HOPOPT", "padding", "options", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L306-L356
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_tun
def _read_opt_tun(self, code, *, desc): """Read HOPOPT Tunnel Encapsulation Limit option. Structure of HOPOPT Tunnel Encapsulation Limit option [RFC 2473]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header |Hdr Ext Len = 0| Opt Type = 4 |Opt Data...
python
def _read_opt_tun(self, code, *, desc): """Read HOPOPT Tunnel Encapsulation Limit option. Structure of HOPOPT Tunnel Encapsulation Limit option [RFC 2473]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header |Hdr Ext Len = 0| Opt Type = 4 |Opt Data...
[ "def", "_read_opt_tun", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "_size", "=", "self", ".", "_read_unpack", "(", "1", ")", "if", "_size", "!=", "1", ":", "raise", "Pro...
Read HOPOPT Tunnel Encapsulation Limit option. Structure of HOPOPT Tunnel Encapsulation Limit option [RFC 2473]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header |Hdr Ext Len = 0| Opt Type = 4 |Opt Data Len=1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...
[ "Read", "HOPOPT", "Tunnel", "Encapsulation", "Limit", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L358-L390
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_ra
def _read_opt_ra(self, code, *, desc): """Read HOPOPT Router Alert option. Structure of HOPOPT Router Alert option [RFC 2711]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0 0 0|0 0 1 0 1|0 0 0 0 0 0 1 0| Value (2 octets) | +-+-+-+-...
python
def _read_opt_ra(self, code, *, desc): """Read HOPOPT Router Alert option. Structure of HOPOPT Router Alert option [RFC 2711]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0 0 0|0 0 1 0 1|0 0 0 0 0 0 1 0| Value (2 octets) | +-+-+-+-...
[ "def", "_read_opt_ra", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "_size", "=", "self", ".", "_read_unpack", "(", "1", ")", "if", "_size", "!=", "2", ":", "raise", "Prot...
Read HOPOPT Router Alert option. Structure of HOPOPT Router Alert option [RFC 2711]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0 0 0|0 0 1 0 1|0 0 0 0 0 0 1 0| Value (2 octets) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...
[ "Read", "HOPOPT", "Router", "Alert", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L392-L432
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_calipso
def _read_opt_calipso(self, code, *, desc): """Read HOPOPT CALIPSO option. Structure of HOPOPT CALIPSO option [RFC 5570]: ------------------------------------------------------------ | Next Header | Hdr Ext Len | Option Type | Option Length| +-------------+--------...
python
def _read_opt_calipso(self, code, *, desc): """Read HOPOPT CALIPSO option. Structure of HOPOPT CALIPSO option [RFC 5570]: ------------------------------------------------------------ | Next Header | Hdr Ext Len | Option Type | Option Length| +-------------+--------...
[ "def", "_read_opt_calipso", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "_size", "=", "self", ".", "_read_unpack", "(", "1", ")", "if", "_size", "<", "8", "and", "_size", ...
Read HOPOPT CALIPSO option. Structure of HOPOPT CALIPSO option [RFC 5570]: ------------------------------------------------------------ | Next Header | Hdr Ext Len | Option Type | Option Length| +-------------+---------------+-------------+--------------+ | ...
[ "Read", "HOPOPT", "CALIPSO", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L434-L492
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_smf_dpd
def _read_opt_smf_dpd(self, code, *, desc): """Read HOPOPT SMF_DPD option. Structure of HOPOPT SMF_DPD option [RFC 5570]: * IPv6 SMF_DPD Option Header in I-DPD mode 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 ...
python
def _read_opt_smf_dpd(self, code, *, desc): """Read HOPOPT SMF_DPD option. Structure of HOPOPT SMF_DPD option [RFC 5570]: * IPv6 SMF_DPD Option Header in I-DPD mode 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 ...
[ "def", "_read_opt_smf_dpd", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "_size", "=", "self", ".", "_read_unpack", "(", "1", ")", "_tidd", "=", "self", ".", "_read_binary", ...
Read HOPOPT SMF_DPD option. Structure of HOPOPT SMF_DPD option [RFC 5570]: * IPv6 SMF_DPD Option Header in I-DPD mode 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+...
[ "Read", "HOPOPT", "SMF_DPD", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L494-L622
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_pdm
def _read_opt_pdm(self, code, *, desc): """Read HOPOPT PDM option. Structure of HOPOPT PDM option [RFC 8250]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+...
python
def _read_opt_pdm(self, code, *, desc): """Read HOPOPT PDM option. Structure of HOPOPT PDM option [RFC 8250]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+...
[ "def", "_read_opt_pdm", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "_size", "=", "self", ".", "_read_unpack", "(", "1", ")", "if", "_size", "!=", "10", ":", "raise", "Pr...
Read HOPOPT PDM option. Structure of HOPOPT PDM option [RFC 8250]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ...
[ "Read", "HOPOPT", "PDM", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L624-L675
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_qs
def _read_opt_qs(self, code, *, desc): """Read HOPOPT Quick Start option. Structure of HOPOPT Quick-Start option [RFC 4782]: * A Quick-Start Request. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2...
python
def _read_opt_qs(self, code, *, desc): """Read HOPOPT Quick Start option. Structure of HOPOPT Quick-Start option [RFC 4782]: * A Quick-Start Request. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2...
[ "def", "_read_opt_qs", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "_size", "=", "self", ".", "_read_unpack", "(", "1", ")", "if", "_size", "!=", "6", ":", "raise", "Prot...
Read HOPOPT Quick Start option. Structure of HOPOPT Quick-Start option [RFC 4782]: * A Quick-Start Request. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+...
[ "Read", "HOPOPT", "Quick", "Start", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L677-L737
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_rpl
def _read_opt_rpl(self, code, *, desc): """Read HOPOPT RPL option. Structure of HOPOPT RPL option [RFC 6553]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ...
python
def _read_opt_rpl(self, code, *, desc): """Read HOPOPT RPL option. Structure of HOPOPT RPL option [RFC 6553]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ...
[ "def", "_read_opt_rpl", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "_size", "=", "self", ".", "_read_unpack", "(", "1", ")", "if", "_size", "<", "4", ":", "raise", "Prot...
Read HOPOPT RPL option. Structure of HOPOPT RPL option [RFC 6553]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ...
[ "Read", "HOPOPT", "RPL", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L739-L792
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_ilnp
def _read_opt_ilnp(self, code, *, desc): """Read HOPOPT ILNP Nonce option. Structure of HOPOPT ILNP Nonce option [RFC 6744]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-...
python
def _read_opt_ilnp(self, code, *, desc): """Read HOPOPT ILNP Nonce option. Structure of HOPOPT ILNP Nonce option [RFC 6744]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-...
[ "def", "_read_opt_ilnp", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "_size", "=", "self", ".", "_read_unpack", "(", "1", ")", "_nval", "=", "self", ".", "_read_fileng", "(...
Read HOPOPT ILNP Nonce option. Structure of HOPOPT ILNP Nonce option [RFC 6744]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ...
[ "Read", "HOPOPT", "ILNP", "Nonce", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L865-L897
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_lio
def _read_opt_lio(self, code, *, desc): """Read HOPOPT Line-Identification option. Structure of HOPOPT Line-Identification option [RFC 6788]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ...
python
def _read_opt_lio(self, code, *, desc): """Read HOPOPT Line-Identification option. Structure of HOPOPT Line-Identification option [RFC 6788]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ...
[ "def", "_read_opt_lio", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "_size", "=", "self", ".", "_read_unpack", "(", "1", ")", "_llen", "=", "self", ".", "_read_unpack", "("...
Read HOPOPT Line-Identification option. Structure of HOPOPT Line-Identification option [RFC 6788]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-...
[ "Read", "HOPOPT", "Line", "-", "Identification", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L899-L938
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_jumbo
def _read_opt_jumbo(self, code, *, desc): """Read HOPOPT Jumbo Payload option. Structure of HOPOPT Jumbo Payload option [RFC 2675]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+...
python
def _read_opt_jumbo(self, code, *, desc): """Read HOPOPT Jumbo Payload option. Structure of HOPOPT Jumbo Payload option [RFC 2675]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+...
[ "def", "_read_opt_jumbo", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "_size", "=", "self", ".", "_read_unpack", "(", "1", ")", "if", "_size", "!=", "4", ":", "raise", "P...
Read HOPOPT Jumbo Payload option. Structure of HOPOPT Jumbo Payload option [RFC 2675]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Option Type | Opt Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...
[ "Read", "HOPOPT", "Jumbo", "Payload", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L940-L972
JarryShaw/PyPCAPKit
src/protocols/internet/hopopt.py
HOPOPT._read_opt_home
def _read_opt_home(self, code, *, desc): """Read HOPOPT Home Address option. Structure of HOPOPT Home Address option [RFC 6275]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ...
python
def _read_opt_home(self, code, *, desc): """Read HOPOPT Home Address option. Structure of HOPOPT Home Address option [RFC 6275]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ...
[ "def", "_read_opt_home", "(", "self", ",", "code", ",", "*", ",", "desc", ")", ":", "_type", "=", "self", ".", "_read_opt_type", "(", "code", ")", "_size", "=", "self", ".", "_read_unpack", "(", "1", ")", "if", "_size", "!=", "16", ":", "raise", "P...
Read HOPOPT Home Address option. Structure of HOPOPT Home Address option [RFC 6275]: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...
[ "Read", "HOPOPT", "Home", "Address", "option", "." ]
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/hopopt.py#L974-L1014