_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q1200 | HIP._read_para_reg_from | train | def _read_para_reg_from(self, code, cbit, clen, *, desc, length, version):
"""Read HIP REG_FROM parameter.
Structure of HIP REG_FROM parameter [RFC 5770]:
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 ... | python | {
"resource": ""
} |
q1201 | HIP._read_para_echo_response_signed | train | def _read_para_echo_response_signed(self, code, cbit, clen, *, desc, length, version):
"""Read HIP ECHO_RESPONSE_SIGNED parameter.
Structure of HIP ECHO_RESPONSE_SIGNED parameter [RFC 7401]:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 ... | python | {
"resource": ""
} |
q1202 | HIP._read_para_transport_format_list | train | def _read_para_transport_format_list(self, code, cbit, clen, *, desc, length, version):
"""Read HIP TRANSPORT_FORMAT_LIST parameter.
Structure of HIP TRANSPORT_FORMAT_LIST parameter [RFC 7401]:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0... | python | {
"resource": ""
} |
q1203 | HIP._read_para_esp_transform | train | def _read_para_esp_transform(self, code, cbit, clen, *, desc, length, version):
"""Read HIP ESP_TRANSFORM parameter.
Structure of HIP ESP_TRANSFORM parameter [RFC 7402]:
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 | {
"resource": ""
} |
q1204 | HIP._read_para_seq_data | train | def _read_para_seq_data(self, code, cbit, clen, *, desc, length, version):
"""Read HIP SEQ_DATA parameter.
Structure of HIP SEQ_DATA parameter [RFC 6078]:
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 ... | python | {
"resource": ""
} |
q1205 | HIP._read_para_route_dst | train | def _read_para_route_dst(self, code, cbit, clen, *, desc, length, version):
"""Read HIP ROUTE_DST parameter.
Structure of HIP ROUTE_DST parameter [RFC 6028]:
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... | python | {
"resource": ""
} |
q1206 | HIP._read_para_hip_transport_mode | train | def _read_para_hip_transport_mode(self, code, cbit, clen, *, desc, length, version):
"""Read HIP HIP_TRANSPORT_MODE parameter.
Structure of HIP HIP_TRANSPORT_MODE parameter [RFC 6261]:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 ... | python | {
"resource": ""
} |
q1207 | HIP._read_para_hip_mac | train | def _read_para_hip_mac(self, code, cbit, clen, *, desc, length, version):
"""Read HIP HIP_MAC parameter.
Structure of HIP HIP_MAC parameter [RFC 7401]:
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 | {
"resource": ""
} |
q1208 | HIP._read_para_hip_mac_2 | train | def _read_para_hip_mac_2(self, code, cbit, clen, *, desc, length, version):
"""Read HIP HIP_MAC_2 parameter.
Structure of HIP HIP_MAC_2 parameter [RFC 7401]:
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... | python | {
"resource": ""
} |
q1209 | HIP._read_para_hip_signature_2 | train | def _read_para_hip_signature_2(self, code, cbit, clen, *, desc, length, version):
"""Read HIP HIP_SIGNATURE_2 parameter.
Structure of HIP HIP_SIGNATURE_2 parameter [RFC 7401]:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9... | python | {
"resource": ""
} |
q1210 | HIP._read_para_echo_request_unsigned | train | def _read_para_echo_request_unsigned(self, code, cbit, clen, *, desc, length, version):
"""Read HIP ECHO_REQUEST_UNSIGNED parameter.
Structure of HIP ECHO_REQUEST_UNSIGNED parameter [RFC 7401]:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0... | python | {
"resource": ""
} |
q1211 | HIP._read_para_echo_response_unsigned | train | def _read_para_echo_response_unsigned(self, code, cbit, clen, *, desc, length, version):
"""Read HIP ECHO_RESPONSE_UNSIGNED parameter.
Structure of HIP ECHO_RESPONSE_UNSIGNED parameter [RFC 7401]:
0 1 2 3
0 1 2 3 4 5 6 7 8 ... | python | {
"resource": ""
} |
q1212 | HIP._read_para_overlay_ttl | train | def _read_para_overlay_ttl(self, code, cbit, clen, *, desc, length, version):
"""Read HIP OVERLAY_TTL parameter.
Structure of HIP OVERLAY_TTL parameter [RFC 6078]:
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... | python | {
"resource": ""
} |
q1213 | HIP._read_para_from | train | def _read_para_from(self, code, cbit, clen, *, desc, length, version):
"""Read HIP FROM parameter.
Structure of HIP FROM parameter [RFC 8004]:
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 | {
"resource": ""
} |
q1214 | HIP._read_para_rvs_hmac | train | def _read_para_rvs_hmac(self, code, cbit, clen, *, desc, length, version):
"""Read HIP RVS_HMAC parameter.
Structure of HIP RVS_HMAC parameter [RFC 8004]:
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 ... | python | {
"resource": ""
} |
q1215 | HIP._read_para_via_rvs | train | def _read_para_via_rvs(self, code, cbit, clen, *, desc, length, version):
"""Read HIP VIA_RVS parameter.
Structure of HIP VIA_RVS parameter [RFC 6028]:
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 | {
"resource": ""
} |
q1216 | HIP._read_para_relay_hmac | train | def _read_para_relay_hmac(self, code, cbit, clen, *, desc, length, version):
"""Read HIP RELAY_HMAC parameter.
Structure of HIP RELAY_HMAC parameter [RFC 5770]:
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 ... | python | {
"resource": ""
} |
q1217 | stacklevel | train | def stacklevel():
"""Fetch current stack level."""
pcapkit = f'{os.path.sep}pcapkit{os.path.sep}'
tb = traceback.extract_stack()
for index, tbitem in enumerate(tb):
if pcapkit in tbitem[0]:
break
else:
index = len(tb)
return (index-1) | python | {
"resource": ""
} |
q1218 | seekset_ng | train | def seekset_ng(func):
"""Read file from start then set back to original."""
@functools.wraps(func)
def seekcur(file, *args, seekset=os.SEEK_SET, **kw):
# seek_cur = file.tell()
file.seek(seekset, os.SEEK_SET)
return_ = func(file, *args, seekset=seekset, **kw)
# file.seek(seek... | python | {
"resource": ""
} |
q1219 | beholder_ng | train | def beholder_ng(func):
"""Behold analysis procedure."""
@functools.wraps(func)
def behold(file, length, *args, **kwargs):
seek_cur = file.tell()
try:
return func(file, length, *args, **kwargs)
except Exception:
# from pcapkit.foundation.analysis import analyse... | python | {
"resource": ""
} |
q1220 | L2TP.read_l2tp | train | def read_l2tp(self, length):
"""Read Layer Two Tunnelling Protocol.
Structure of L2TP header [RFC 2661]:
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 | {
"resource": ""
} |
q1221 | VLAN.read_vlan | train | def read_vlan(self, length):
"""Read 802.1Q Customer VLAN Tag Type.
Structure of 802.1Q Customer VLAN Tag Type [RFC 7042]:
Octets Bits Name Description
1 0 vlan.tci Tag Control Information
1 0 ... | python | {
"resource": ""
} |
q1222 | TCP._read_tcp_options | train | def _read_tcp_options(self, size):
"""Read TCP option list.
Positional arguments:
* size -- int, length of option list
Returns:
* tuple -- TCP option list
* dict -- extracted TCP option
"""
counter = 0 # length of read option list
... | python | {
"resource": ""
} |
q1223 | TCP._read_mode_tsopt | train | def _read_mode_tsopt(self, size, kind):
"""Read Timestamps option.
Positional arguments:
* size - int, length of option
* kind - int, 8 (Timestamps)
Returns:
* dict -- extracted Timestamps (TS) option
Structure of TCP TSopt [RFC 7323]:
+... | python | {
"resource": ""
} |
q1224 | TCP._read_mode_pocsp | train | def _read_mode_pocsp(self, size, kind):
"""Read Partial Order Connection Service Profile option.
Positional arguments:
* size - int, length of option
* kind - int, 10 (POC-Serv Profile)
Returns:
* dict -- extracted Partial Order Connection Service Profile (P... | python | {
"resource": ""
} |
q1225 | TCP._read_mode_acopt | train | def _read_mode_acopt(self, size, kind):
"""Read Alternate Checksum Request option.
Positional arguments:
size - int, length of option
kind - int, 14 (Alt-Chksum Request)
Returns:
* dict -- extracted Alternate Checksum Request (CHKSUM-REQ) option
Str... | python | {
"resource": ""
} |
q1226 | TCP._read_mode_qsopt | train | def _read_mode_qsopt(self, size, kind):
"""Read Quick-Start Response option.
Positional arguments:
* size - int, length of option
* kind - int, 27 (Quick-Start Response)
Returns:
* dict -- extracted Quick-Start Response (QS) option
Structure of TCP ... | python | {
"resource": ""
} |
q1227 | TCP._read_mode_utopt | train | def _read_mode_utopt(self, size, kind):
"""Read User Timeout option.
Positional arguments:
* size - int, length of option
* kind - int, 28 (User Timeout Option)
Returns:
* dict -- extracted User Timeout (TIMEOUT) option
Structure of TCP TIMEOUT [RFC... | python | {
"resource": ""
} |
q1228 | TCP._read_mode_tcpao | train | def _read_mode_tcpao(self, size, kind):
"""Read Authentication option.
Positional arguments:
* size - int, length of option
* kind - int, 29 (TCP Authentication Option)
Returns:
* dict -- extracted Authentication (AO) option
Structure of TCP AOopt [... | python | {
"resource": ""
} |
q1229 | TCP._read_mode_mptcp | train | def _read_mode_mptcp(self, size, kind):
"""Read Multipath TCP option.
Positional arguments:
* size - int, length of option
* kind - int, 30 (Multipath TCP)
Returns:
* dict -- extracted Multipath TCP (MP-TCP) option
Structure of MP-TCP [RFC 6824]:
... | python | {
"resource": ""
} |
q1230 | TCP._read_mptcp_capable | train | def _read_mptcp_capable(self, bits, size, kind):
"""Read Multipath Capable option.
Positional arguments:
* bits - str, 4-bit data
* size - int, length of option
* kind - int, 30 (Multipath TCP)
Returns:
* dict -- extracted Multipath Capable (MP_C... | python | {
"resource": ""
} |
q1231 | TCP._read_mptcp_join | train | def _read_mptcp_join(self, bits, size, kind):
"""Read Join Connection option.
Positional arguments:
* bits - str, 4-bit data
* size - int, length of option
* kind - int, 30 (Multipath TCP)
Returns:
* dict -- extracted Join Connection (MP_JOIN) op... | python | {
"resource": ""
} |
q1232 | TCP._read_join_syn | train | def _read_join_syn(self, bits, size, kind):
"""Read Join Connection option for Initial SYN.
Positional arguments:
* bits - str, 4-bit data
* size - int, length of option
* kind - int, 30 (Multipath TCP)
Returns:
* dict -- extracted Join Connectio... | python | {
"resource": ""
} |
q1233 | TCP._read_join_ack | train | def _read_join_ack(self, bits, size, kind):
"""Read Join Connection option for Third ACK.
Positional arguments:
* bits - str, 4-bit data
* size - int, length of option
* kind - int, 30 (Multipath TCP)
Returns:
* dict -- extracted Join Connection ... | python | {
"resource": ""
} |
q1234 | TCP._read_mptcp_add | train | def _read_mptcp_add(self, bits, size, kind):
"""Read Add Address option.
Positional arguments:
* bits - str, 4-bit data
* size - int, length of option
* kind - int, 30 (Multipath TCP)
Returns:
* dict -- extracted Add Address (ADD_ADDR) option
... | python | {
"resource": ""
} |
q1235 | TCP._read_mptcp_remove | train | def _read_mptcp_remove(self, bits, size):
"""Read Remove Address option.
Positional arguments:
* bits - str, 4-bit data
* size - int, length of option
Returns:
* dict -- extracted Remove Address (REMOVE_ADDR) option
Structure of REMOVE_ADDR [RFC 682... | python | {
"resource": ""
} |
q1236 | TCP._read_mptcp_prio | train | def _read_mptcp_prio(self, bits, size):
"""Read Change Subflow Priority option.
Positional arguments:
* bits - str, 4-bit data
* size - int, length of option
Returns:
* dict -- extracted Change Subflow Priority (MP_PRIO) option
Structure of MP_PRIO ... | python | {
"resource": ""
} |
q1237 | extract | train | def extract(fin=None, fout=None, format=None, # basic settings
auto=True, extension=True, store=True, # internal settings
files=False, nofile=False, verbose=False, # output settings
engine=None, layer=None, protocol=Non... | python | {
"resource": ""
} |
q1238 | reassemble | train | def reassemble(protocol, strict=False):
"""Reassemble fragmented datagrams.
Keyword arguments:
* protocol -- str, protocol to be reassembled
* strict -- bool, if return all datagrams (including those not implemented) when submit (default is False)
<keyword> True / False
... | python | {
"resource": ""
} |
q1239 | trace | train | def trace(fout=None, format=None, byteorder=sys.byteorder, nanosecond=False):
"""Trace TCP flows.
Keyword arguments:
* fout -- str, output path
* format -- str, output format
* byteorder -- str, output file byte order
* nanosecond -- bool, output nanosecond-resolution file flag
... | python | {
"resource": ""
} |
q1240 | IPv6_Frag.read_ipv6_frag | train | def read_ipv6_frag(self, length, extension):
"""Read Fragment Header for IPv6.
Structure of IPv6-Frag header [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Reserved | Fragment Offset |Res|M|
+-+-+-+-+-+-+-... | python | {
"resource": ""
} |
q1241 | IPv4._read_ipv4_options | train | def _read_ipv4_options(self, size=None):
"""Read IPv4 option list.
Positional arguments:
* size -- int, buffer size
Returns:
* tuple -- IPv4 option list
* dict -- extracted IPv4 option
"""
counter = 0 # length of read option list
... | python | {
"resource": ""
} |
q1242 | IPv4._read_mode_route | train | 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 | {
"resource": ""
} |
q1243 | IPv4._read_mode_qs | train | 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 | {
"resource": ""
} |
q1244 | IPv4._read_mode_ts | train | 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 | {
"resource": ""
} |
q1245 | IPv4._read_mode_tr | train | 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 | {
"resource": ""
} |
q1246 | IPv4._read_mode_sec | train | 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 | {
"resource": ""
} |
q1247 | IPv4._read_mode_rsralt | train | 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 | {
"resource": ""
} |
q1248 | Header.read_header | train | 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 | {
"resource": ""
} |
q1249 | Frame.read_frame | train | 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 | {
"resource": ""
} |
q1250 | Frame._decode_next_layer | train | 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 | {
"resource": ""
} |
q1251 | Raw.read_raw | train | 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 | {
"resource": ""
} |
q1252 | ipv6_hdr_len | train | 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 | {
"resource": ""
} |
q1253 | packet2chain | train | 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 | {
"resource": ""
} |
q1254 | packet2dict | train | 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 | {
"resource": ""
} |
q1255 | HTTPv2._read_http_none | train | 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 | {
"resource": ""
} |
q1256 | Extractor.run | train | 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 | {
"resource": ""
} |
q1257 | Extractor.record_header | train | 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 | {
"resource": ""
} |
q1258 | Extractor._cleanup | train | def _cleanup(self):
"""Cleanup after extraction & analysis."""
self._expkg = None
self._extmp = None
self._flag_e = True
self._ifile.close() | python | {
"resource": ""
} |
q1259 | Extractor._aftermathmp | train | 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 | {
"resource": ""
} |
q1260 | Extractor._update_eof | train | def _update_eof(self):
"""Update EOF flag."""
self._aftermathmp()
self._ifile.close()
self._flag_e = True | python | {
"resource": ""
} |
q1261 | Extractor._read_frame | train | 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 | {
"resource": ""
} |
q1262 | Extractor._default_read_frame | train | 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 | {
"resource": ""
} |
q1263 | Extractor._run_scapy | train | 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 | {
"resource": ""
} |
q1264 | Extractor._scapy_read_frame | train | 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 | {
"resource": ""
} |
q1265 | Extractor._run_dpkt | train | 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 | {
"resource": ""
} |
q1266 | Extractor._run_pyshark | train | 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 | {
"resource": ""
} |
q1267 | Extractor._run_pipeline | train | 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 | {
"resource": ""
} |
q1268 | Extractor._run_server | train | 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 | {
"resource": ""
} |
q1269 | Extractor._server_analyse_frame | train | 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 | {
"resource": ""
} |
q1270 | HTTPv2.read_http | train | def read_http(self, length):
"""Read Hypertext Transfer Protocol version 2.
Structure of HTTP/2 packet [RFC 7230]:
+-----------------------------------------------+
| Length (24) |
+---------------+---------------+---------------+
... | python | {
"resource": ""
} |
q1271 | TraceFlow.make_fout | train | 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 | {
"resource": ""
} |
q1272 | TraceFlow.dump | train | 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 | {
"resource": ""
} |
q1273 | TraceFlow.trace | train | 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 | {
"resource": ""
} |
q1274 | TraceFlow.submit | train | 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 | {
"resource": ""
} |
q1275 | AH.read_ah | train | 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 | {
"resource": ""
} |
q1276 | Ethernet.read_ethernet | train | 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 | {
"resource": ""
} |
q1277 | Ethernet._read_mac_addr | train | def _read_mac_addr(self):
"""Read MAC address."""
_byte = self._read_fileng(6)
_addr = '-'.join(textwrap.wrap(_byte.hex(), 2))
return _addr | python | {
"resource": ""
} |
q1278 | packet2dict | train | 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 | {
"resource": ""
} |
q1279 | packet2chain | train | 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 | {
"resource": ""
} |
q1280 | packet2dict | train | 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 | {
"resource": ""
} |
q1281 | tcp_reassembly | train | 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 | {
"resource": ""
} |
q1282 | HOPOPT.read_hopopt | train | def read_hopopt(self, length, extension):
"""Read IPv6 Hop-by-Hop Options.
Structure of HOPOPT header [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | |
+-+-+-+-+-+-+-+-+-+-+... | python | {
"resource": ""
} |
q1283 | HOPOPT._read_hopopt_options | train | 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 | {
"resource": ""
} |
q1284 | HOPOPT._read_opt_pad | train | 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 | {
"resource": ""
} |
q1285 | HOPOPT._read_opt_tun | train | 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 | {
"resource": ""
} |
q1286 | HOPOPT._read_opt_ra | train | 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 | {
"resource": ""
} |
q1287 | HOPOPT._read_opt_calipso | train | 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 | {
"resource": ""
} |
q1288 | HOPOPT._read_opt_smf_dpd | train | 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 | {
"resource": ""
} |
q1289 | HOPOPT._read_opt_pdm | train | 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 | {
"resource": ""
} |
q1290 | HOPOPT._read_opt_qs | train | 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 | {
"resource": ""
} |
q1291 | HOPOPT._read_opt_rpl | train | 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 | {
"resource": ""
} |
q1292 | HOPOPT._read_opt_ilnp | train | 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 | {
"resource": ""
} |
q1293 | HOPOPT._read_opt_lio | train | 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 | {
"resource": ""
} |
q1294 | HOPOPT._read_opt_jumbo | train | 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 | {
"resource": ""
} |
q1295 | HOPOPT._read_opt_home | train | 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 | {
"resource": ""
} |
q1296 | HOPOPT._read_opt_ip_dff | train | def _read_opt_ip_dff(self, code, *, desc):
"""Read HOPOPT IP_DFF option.
Structure of HOPOPT IP_DFF option [RFC 6971]:
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 | {
"resource": ""
} |
q1297 | IPv6_Opts.read_ipv6_opts | train | def read_ipv6_opts(self, length, extension):
"""Read Destination Options for IPv6.
Structure of IPv6-Opts header [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | |
+-+-+-+-+-... | python | {
"resource": ""
} |
q1298 | IPv6_Opts._read_ipv6_opts_options | train | def _read_ipv6_opts_options(self, length):
"""Read IPv6_Opts options.
Positional arguments:
* length -- int, length of options
Returns:
* dict -- extracted IPv6_Opts options
"""
counter = 0 # length of read options
optkind = list() # ... | python | {
"resource": ""
} |
q1299 | IPv6_Opts._read_opt_none | train | def _read_opt_none(self, code, *, desc):
"""Read IPv6_Opts unassigned options.
Structure of IPv6_Opts unassigned options [RFC 8200]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - -
| Option Type | Opt Data Len | Option Data
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- -... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.