repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
secdev/scapy | scapy/layers/tls/keyexchange.py | _TLSSignature._verify_sig | def _verify_sig(self, m, cert):
"""
Verify that our own 'sig_val' carries the signature of 'm' by the
key associated to the Cert 'cert'.
"""
if self.sig_val:
if self.sig_alg:
h, sig = _tls_hash_sig[self.sig_alg].split('+')
if sig.endswi... | python | def _verify_sig(self, m, cert):
"""
Verify that our own 'sig_val' carries the signature of 'm' by the
key associated to the Cert 'cert'.
"""
if self.sig_val:
if self.sig_alg:
h, sig = _tls_hash_sig[self.sig_alg].split('+')
if sig.endswi... | [
"def",
"_verify_sig",
"(",
"self",
",",
"m",
",",
"cert",
")",
":",
"if",
"self",
".",
"sig_val",
":",
"if",
"self",
".",
"sig_alg",
":",
"h",
",",
"sig",
"=",
"_tls_hash_sig",
"[",
"self",
".",
"sig_alg",
"]",
".",
"split",
"(",
"'+'",
")",
"if"... | Verify that our own 'sig_val' carries the signature of 'm' by the
key associated to the Cert 'cert'. | [
"Verify",
"that",
"our",
"own",
"sig_val",
"carries",
"the",
"signature",
"of",
"m",
"by",
"the",
"key",
"associated",
"to",
"the",
"Cert",
"cert",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L190-L208 | train | Verify that the signature of m is valid for the Cert cert. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/keyexchange.py | ServerDHParams.fill_missing | def fill_missing(self):
"""
We do not want TLSServerKeyExchange.build() to overload and recompute
things every time it is called. This method can be called specifically
to have things filled in a smart fashion.
Note that we do not expect default_params.g to be more than 0xff.
... | python | def fill_missing(self):
"""
We do not want TLSServerKeyExchange.build() to overload and recompute
things every time it is called. This method can be called specifically
to have things filled in a smart fashion.
Note that we do not expect default_params.g to be more than 0xff.
... | [
"def",
"fill_missing",
"(",
"self",
")",
":",
"s",
"=",
"self",
".",
"tls_session",
"default_params",
"=",
"_ffdh_groups",
"[",
"'modp2048'",
"]",
"[",
"0",
"]",
".",
"parameter_numbers",
"(",
")",
"default_mLen",
"=",
"_ffdh_groups",
"[",
"'modp2048'",
"]",... | We do not want TLSServerKeyExchange.build() to overload and recompute
things every time it is called. This method can be called specifically
to have things filled in a smart fashion.
Note that we do not expect default_params.g to be more than 0xff. | [
"We",
"do",
"not",
"want",
"TLSServerKeyExchange",
".",
"build",
"()",
"to",
"overload",
"and",
"recompute",
"things",
"every",
"time",
"it",
"is",
"called",
".",
"This",
"method",
"can",
"be",
"called",
"specifically",
"to",
"have",
"things",
"filled",
"in"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L311-L348 | train | This method is called by the TLSServerKeyExchange. build method to populate the missing fields of the internal state of the object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/keyexchange.py | ServerDHParams.register_pubkey | def register_pubkey(self):
"""
XXX Check that the pubkey received is in the group.
"""
p = pkcs_os2ip(self.dh_p)
g = pkcs_os2ip(self.dh_g)
pn = dh.DHParameterNumbers(p, g)
y = pkcs_os2ip(self.dh_Ys)
public_numbers = dh.DHPublicNumbers(y, pn)
s = ... | python | def register_pubkey(self):
"""
XXX Check that the pubkey received is in the group.
"""
p = pkcs_os2ip(self.dh_p)
g = pkcs_os2ip(self.dh_g)
pn = dh.DHParameterNumbers(p, g)
y = pkcs_os2ip(self.dh_Ys)
public_numbers = dh.DHPublicNumbers(y, pn)
s = ... | [
"def",
"register_pubkey",
"(",
"self",
")",
":",
"p",
"=",
"pkcs_os2ip",
"(",
"self",
".",
"dh_p",
")",
"g",
"=",
"pkcs_os2ip",
"(",
"self",
".",
"dh_g",
")",
"pn",
"=",
"dh",
".",
"DHParameterNumbers",
"(",
"p",
",",
"g",
")",
"y",
"=",
"pkcs_os2i... | XXX Check that the pubkey received is in the group. | [
"XXX",
"Check",
"that",
"the",
"pubkey",
"received",
"is",
"in",
"the",
"group",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L351-L366 | train | XXX Check that the pubkey received is in the group. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/keyexchange.py | ServerECDHNamedCurveParams.fill_missing | def fill_missing(self):
"""
We do not want TLSServerKeyExchange.build() to overload and recompute
things every time it is called. This method can be called specifically
to have things filled in a smart fashion.
XXX We should account for the point_format (before 'point' filling).... | python | def fill_missing(self):
"""
We do not want TLSServerKeyExchange.build() to overload and recompute
things every time it is called. This method can be called specifically
to have things filled in a smart fashion.
XXX We should account for the point_format (before 'point' filling).... | [
"def",
"fill_missing",
"(",
"self",
")",
":",
"s",
"=",
"self",
".",
"tls_session",
"if",
"self",
".",
"curve_type",
"is",
"None",
":",
"self",
".",
"curve_type",
"=",
"_tls_ec_curve_types",
"[",
"\"named_curve\"",
"]",
"if",
"self",
".",
"named_curve",
"i... | We do not want TLSServerKeyExchange.build() to overload and recompute
things every time it is called. This method can be called specifically
to have things filled in a smart fashion.
XXX We should account for the point_format (before 'point' filling). | [
"We",
"do",
"not",
"want",
"TLSServerKeyExchange",
".",
"build",
"()",
"to",
"overload",
"and",
"recompute",
"things",
"every",
"time",
"it",
"is",
"called",
".",
"This",
"method",
"can",
"be",
"called",
"specifically",
"to",
"have",
"things",
"filled",
"in"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L553-L603 | train | This method is called by the server key exchange module to fill missing values. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/keyexchange.py | ServerECDHNamedCurveParams.register_pubkey | def register_pubkey(self):
"""
XXX Support compressed point format.
XXX Check that the pubkey received is on the curve.
"""
# point_format = 0
# if self.point[0] in [b'\x02', b'\x03']:
# point_format = 1
curve_name = _tls_named_curves[self.named_curve]... | python | def register_pubkey(self):
"""
XXX Support compressed point format.
XXX Check that the pubkey received is on the curve.
"""
# point_format = 0
# if self.point[0] in [b'\x02', b'\x03']:
# point_format = 1
curve_name = _tls_named_curves[self.named_curve]... | [
"def",
"register_pubkey",
"(",
"self",
")",
":",
"# point_format = 0",
"# if self.point[0] in [b'\\x02', b'\\x03']:",
"# point_format = 1",
"curve_name",
"=",
"_tls_named_curves",
"[",
"self",
".",
"named_curve",
"]",
"curve",
"=",
"ec",
".",
"_CURVE_TYPES",
"[",
"cu... | XXX Support compressed point format.
XXX Check that the pubkey received is on the curve. | [
"XXX",
"Support",
"compressed",
"point",
"format",
".",
"XXX",
"Check",
"that",
"the",
"pubkey",
"received",
"is",
"on",
"the",
"curve",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L606-L623 | train | Register the public key in the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/keyexchange.py | ClientDiffieHellmanPublic.post_dissection | def post_dissection(self, m):
"""
First we update the client DHParams. Then, we try to update the server
DHParams generated during Server*DHParams building, with the shared
secret. Finally, we derive the session keys and update the context.
"""
s = self.tls_session
... | python | def post_dissection(self, m):
"""
First we update the client DHParams. Then, we try to update the server
DHParams generated during Server*DHParams building, with the shared
secret. Finally, we derive the session keys and update the context.
"""
s = self.tls_session
... | [
"def",
"post_dissection",
"(",
"self",
",",
"m",
")",
":",
"s",
"=",
"self",
".",
"tls_session",
"# if there are kx params and keys, we assume the crypto library is ok",
"if",
"s",
".",
"client_kx_ffdh_params",
":",
"y",
"=",
"pkcs_os2ip",
"(",
"self",
".",
"dh_Yc",... | First we update the client DHParams. Then, we try to update the server
DHParams generated during Server*DHParams building, with the shared
secret. Finally, we derive the session keys and update the context. | [
"First",
"we",
"update",
"the",
"client",
"DHParams",
".",
"Then",
"we",
"try",
"to",
"update",
"the",
"server",
"DHParams",
"generated",
"during",
"Server",
"*",
"DHParams",
"building",
"with",
"the",
"shared",
"secret",
".",
"Finally",
"we",
"derive",
"the... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L769-L787 | train | This method is called when the user has done some additional dissection of the certificate. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/keyexchange.py | EncryptedPreMasterSecret.post_build | def post_build(self, pkt, pay):
"""
We encrypt the premaster secret (the 48 bytes) with either the server
certificate or the temporary RSA key provided in a server key exchange
message. After that step, we add the 2 bytes to provide the length, as
described in implementation note... | python | def post_build(self, pkt, pay):
"""
We encrypt the premaster secret (the 48 bytes) with either the server
certificate or the temporary RSA key provided in a server key exchange
message. After that step, we add the 2 bytes to provide the length, as
described in implementation note... | [
"def",
"post_build",
"(",
"self",
",",
"pkt",
",",
"pay",
")",
":",
"enc",
"=",
"pkt",
"s",
"=",
"self",
".",
"tls_session",
"s",
".",
"pre_master_secret",
"=",
"enc",
"s",
".",
"compute_ms_and_derive_keys",
"(",
")",
"if",
"s",
".",
"server_tmp_rsa_key"... | We encrypt the premaster secret (the 48 bytes) with either the server
certificate or the temporary RSA key provided in a server key exchange
message. After that step, we add the 2 bytes to provide the length, as
described in implementation notes at the end of section 7.4.7.1. | [
"We",
"encrypt",
"the",
"premaster",
"secret",
"(",
"the",
"48",
"bytes",
")",
"with",
"either",
"the",
"server",
"certificate",
"or",
"the",
"temporary",
"RSA",
"key",
"provided",
"in",
"a",
"server",
"key",
"exchange",
"message",
".",
"After",
"that",
"s... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L907-L930 | train | This method is called after the message is sent to the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/compat.py | lambda_tuple_converter | def lambda_tuple_converter(func):
"""
Converts a Python 2 function as
lambda (x,y): x + y
In the Python 3 format:
lambda x,y : x + y
"""
if func is not None and func.__code__.co_argcount == 1:
return lambda *args: func(args[0] if len(args) == 1 else args)
else:
return... | python | def lambda_tuple_converter(func):
"""
Converts a Python 2 function as
lambda (x,y): x + y
In the Python 3 format:
lambda x,y : x + y
"""
if func is not None and func.__code__.co_argcount == 1:
return lambda *args: func(args[0] if len(args) == 1 else args)
else:
return... | [
"def",
"lambda_tuple_converter",
"(",
"func",
")",
":",
"if",
"func",
"is",
"not",
"None",
"and",
"func",
".",
"__code__",
".",
"co_argcount",
"==",
"1",
":",
"return",
"lambda",
"*",
"args",
":",
"func",
"(",
"args",
"[",
"0",
"]",
"if",
"len",
"(",... | Converts a Python 2 function as
lambda (x,y): x + y
In the Python 3 format:
lambda x,y : x + y | [
"Converts",
"a",
"Python",
"2",
"function",
"as",
"lambda",
"(",
"x",
"y",
")",
":",
"x",
"+",
"y",
"In",
"the",
"Python",
"3",
"format",
":",
"lambda",
"x",
"y",
":",
"x",
"+",
"y"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/compat.py#L23-L33 | train | A function that converts a Python 2 function to a Python 3 function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/compat.py | base64_bytes | def base64_bytes(x):
"""Turn base64 into bytes"""
if six.PY2:
return base64.decodestring(x)
return base64.decodebytes(bytes_encode(x)) | python | def base64_bytes(x):
"""Turn base64 into bytes"""
if six.PY2:
return base64.decodestring(x)
return base64.decodebytes(bytes_encode(x)) | [
"def",
"base64_bytes",
"(",
"x",
")",
":",
"if",
"six",
".",
"PY2",
":",
"return",
"base64",
".",
"decodestring",
"(",
"x",
")",
"return",
"base64",
".",
"decodebytes",
"(",
"bytes_encode",
"(",
"x",
")",
")"
] | Turn base64 into bytes | [
"Turn",
"base64",
"into",
"bytes"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/compat.py#L88-L92 | train | Turn base64 into bytes | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/compat.py | bytes_base64 | def bytes_base64(x):
"""Turn bytes into base64"""
if six.PY2:
return base64.encodestring(x).replace('\n', '')
return base64.encodebytes(bytes_encode(x)).replace(b'\n', b'') | python | def bytes_base64(x):
"""Turn bytes into base64"""
if six.PY2:
return base64.encodestring(x).replace('\n', '')
return base64.encodebytes(bytes_encode(x)).replace(b'\n', b'') | [
"def",
"bytes_base64",
"(",
"x",
")",
":",
"if",
"six",
".",
"PY2",
":",
"return",
"base64",
".",
"encodestring",
"(",
"x",
")",
".",
"replace",
"(",
"'\\n'",
",",
"''",
")",
"return",
"base64",
".",
"encodebytes",
"(",
"bytes_encode",
"(",
"x",
")",... | Turn bytes into base64 | [
"Turn",
"bytes",
"into",
"base64"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/compat.py#L95-L99 | train | Turn bytes into base64 | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | _TLSMsgListField.m2i | def m2i(self, pkt, m):
"""
Try to parse one of the TLS subprotocols (ccs, alert, handshake or
application_data). This is used inside a loop managed by .getfield().
"""
cls = Raw
if pkt.type == 22:
if len(m) >= 1:
msgtype = orb(m[0])
... | python | def m2i(self, pkt, m):
"""
Try to parse one of the TLS subprotocols (ccs, alert, handshake or
application_data). This is used inside a loop managed by .getfield().
"""
cls = Raw
if pkt.type == 22:
if len(m) >= 1:
msgtype = orb(m[0])
... | [
"def",
"m2i",
"(",
"self",
",",
"pkt",
",",
"m",
")",
":",
"cls",
"=",
"Raw",
"if",
"pkt",
".",
"type",
"==",
"22",
":",
"if",
"len",
"(",
"m",
")",
">=",
"1",
":",
"msgtype",
"=",
"orb",
"(",
"m",
"[",
"0",
"]",
")",
"cls",
"=",
"_tls_ha... | Try to parse one of the TLS subprotocols (ccs, alert, handshake or
application_data). This is used inside a loop managed by .getfield(). | [
"Try",
"to",
"parse",
"one",
"of",
"the",
"TLS",
"subprotocols",
"(",
"ccs",
"alert",
"handshake",
"or",
"application_data",
")",
".",
"This",
"is",
"used",
"inside",
"a",
"loop",
"managed",
"by",
".",
"getfield",
"()",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L83-L108 | train | Parses a message into an internal object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | _TLSMsgListField.getfield | def getfield(self, pkt, s):
"""
If the decryption of the content did not fail with a CipherError,
we begin a loop on the clear content in order to get as much messages
as possible, of the type advertised in the record header. This is
notably important for several TLS handshake im... | python | def getfield(self, pkt, s):
"""
If the decryption of the content did not fail with a CipherError,
we begin a loop on the clear content in order to get as much messages
as possible, of the type advertised in the record header. This is
notably important for several TLS handshake im... | [
"def",
"getfield",
"(",
"self",
",",
"pkt",
",",
"s",
")",
":",
"tmp_len",
"=",
"self",
".",
"length_from",
"(",
"pkt",
")",
"lst",
"=",
"[",
"]",
"ret",
"=",
"b\"\"",
"remain",
"=",
"s",
"if",
"tmp_len",
"is",
"not",
"None",
":",
"remain",
",",
... | If the decryption of the content did not fail with a CipherError,
we begin a loop on the clear content in order to get as much messages
as possible, of the type advertised in the record header. This is
notably important for several TLS handshake implementations, which
may for instance pa... | [
"If",
"the",
"decryption",
"of",
"the",
"content",
"did",
"not",
"fail",
"with",
"a",
"CipherError",
"we",
"begin",
"a",
"loop",
"on",
"the",
"clear",
"content",
"in",
"order",
"to",
"get",
"as",
"much",
"messages",
"as",
"possible",
"of",
"the",
"type",... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L110-L159 | train | This method is used to get the message header fields from the message header. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | _TLSMsgListField.i2m | def i2m(self, pkt, p):
"""
Update the context with information from the built packet.
If no type was given at the record layer, we try to infer it.
"""
cur = b""
if isinstance(p, _GenericTLSSessionInheritance):
if pkt.type is None:
if isinstanc... | python | def i2m(self, pkt, p):
"""
Update the context with information from the built packet.
If no type was given at the record layer, we try to infer it.
"""
cur = b""
if isinstance(p, _GenericTLSSessionInheritance):
if pkt.type is None:
if isinstanc... | [
"def",
"i2m",
"(",
"self",
",",
"pkt",
",",
"p",
")",
":",
"cur",
"=",
"b\"\"",
"if",
"isinstance",
"(",
"p",
",",
"_GenericTLSSessionInheritance",
")",
":",
"if",
"pkt",
".",
"type",
"is",
"None",
":",
"if",
"isinstance",
"(",
"p",
",",
"TLSChangeCi... | Update the context with information from the built packet.
If no type was given at the record layer, we try to infer it. | [
"Update",
"the",
"context",
"with",
"information",
"from",
"the",
"built",
"packet",
".",
"If",
"no",
"type",
"was",
"given",
"at",
"the",
"record",
"layer",
"we",
"try",
"to",
"infer",
"it",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L161-L186 | train | Update the context with information from the built packet. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | _TLSMsgListField.addfield | def addfield(self, pkt, s, val):
"""
Reconstruct the header because the TLS type may have been updated.
Then, append the content.
"""
res = b""
for p in val:
res += self.i2m(pkt, p)
if (isinstance(pkt, _GenericTLSSessionInheritance) and
_tl... | python | def addfield(self, pkt, s, val):
"""
Reconstruct the header because the TLS type may have been updated.
Then, append the content.
"""
res = b""
for p in val:
res += self.i2m(pkt, p)
if (isinstance(pkt, _GenericTLSSessionInheritance) and
_tl... | [
"def",
"addfield",
"(",
"self",
",",
"pkt",
",",
"s",
",",
"val",
")",
":",
"res",
"=",
"b\"\"",
"for",
"p",
"in",
"val",
":",
"res",
"+=",
"self",
".",
"i2m",
"(",
"pkt",
",",
"p",
")",
"if",
"(",
"isinstance",
"(",
"pkt",
",",
"_GenericTLSSes... | Reconstruct the header because the TLS type may have been updated.
Then, append the content. | [
"Reconstruct",
"the",
"header",
"because",
"the",
"TLS",
"type",
"may",
"have",
"been",
"updated",
".",
"Then",
"append",
"the",
"content",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L188-L203 | train | Add the fields to the header. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | TLS.dispatch_hook | def dispatch_hook(cls, _pkt=None, *args, **kargs):
"""
If the TLS class was called on raw SSLv2 data, we want to return an
SSLv2 record instance. We acknowledge the risk of SSLv2 packets with a
msglen of 0x1403, 0x1503, 0x1603 or 0x1703 which will never be casted
as SSLv2 records... | python | def dispatch_hook(cls, _pkt=None, *args, **kargs):
"""
If the TLS class was called on raw SSLv2 data, we want to return an
SSLv2 record instance. We acknowledge the risk of SSLv2 packets with a
msglen of 0x1403, 0x1503, 0x1603 or 0x1703 which will never be casted
as SSLv2 records... | [
"def",
"dispatch_hook",
"(",
"cls",
",",
"_pkt",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"if",
"_pkt",
"and",
"len",
"(",
"_pkt",
")",
">=",
"2",
":",
"byte0",
"=",
"orb",
"(",
"_pkt",
"[",
"0",
"]",
")",
"byte1",
"="... | If the TLS class was called on raw SSLv2 data, we want to return an
SSLv2 record instance. We acknowledge the risk of SSLv2 packets with a
msglen of 0x1403, 0x1503, 0x1603 or 0x1703 which will never be casted
as SSLv2 records but TLS ones instead, but hey, we can't be held
responsible fo... | [
"If",
"the",
"TLS",
"class",
"was",
"called",
"on",
"raw",
"SSLv2",
"data",
"we",
"want",
"to",
"return",
"an",
"SSLv2",
"record",
"instance",
".",
"We",
"acknowledge",
"the",
"risk",
"of",
"SSLv2",
"packets",
"with",
"a",
"msglen",
"of",
"0x1403",
"0x15... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L276-L301 | train | This method is called by the protocol layer when it is called. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | TLS._tls_hmac_verify | def _tls_hmac_verify(self, hdr, msg, mac):
"""
Provided with the record header, the TLSCompressed.fragment and the
HMAC, return True if the HMAC is correct. If we could not compute the
HMAC because the key was missing, there is no sense in verifying
anything, thus we also return ... | python | def _tls_hmac_verify(self, hdr, msg, mac):
"""
Provided with the record header, the TLSCompressed.fragment and the
HMAC, return True if the HMAC is correct. If we could not compute the
HMAC because the key was missing, there is no sense in verifying
anything, thus we also return ... | [
"def",
"_tls_hmac_verify",
"(",
"self",
",",
"hdr",
",",
"msg",
",",
"mac",
")",
":",
"read_seq_num",
"=",
"struct",
".",
"pack",
"(",
"\"!Q\"",
",",
"self",
".",
"tls_session",
".",
"rcs",
".",
"seq_num",
")",
"self",
".",
"tls_session",
".",
"rcs",
... | Provided with the record header, the TLSCompressed.fragment and the
HMAC, return True if the HMAC is correct. If we could not compute the
HMAC because the key was missing, there is no sense in verifying
anything, thus we also return True.
Meant to be used with a block cipher or a stream... | [
"Provided",
"with",
"the",
"record",
"header",
"the",
"TLSCompressed",
".",
"fragment",
"and",
"the",
"HMAC",
"return",
"True",
"if",
"the",
"HMAC",
"is",
"correct",
".",
"If",
"we",
"could",
"not",
"compute",
"the",
"HMAC",
"because",
"the",
"key",
"was",... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L339-L370 | train | Verify the HMAC of the record header and the message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | TLS._tls_decompress | def _tls_decompress(self, s):
"""
Provided with the TLSCompressed.fragment,
return the TLSPlaintext.fragment.
"""
alg = self.tls_session.rcs.compression
return alg.decompress(s) | python | def _tls_decompress(self, s):
"""
Provided with the TLSCompressed.fragment,
return the TLSPlaintext.fragment.
"""
alg = self.tls_session.rcs.compression
return alg.decompress(s) | [
"def",
"_tls_decompress",
"(",
"self",
",",
"s",
")",
":",
"alg",
"=",
"self",
".",
"tls_session",
".",
"rcs",
".",
"compression",
"return",
"alg",
".",
"decompress",
"(",
"s",
")"
] | Provided with the TLSCompressed.fragment,
return the TLSPlaintext.fragment. | [
"Provided",
"with",
"the",
"TLSCompressed",
".",
"fragment",
"return",
"the",
"TLSPlaintext",
".",
"fragment",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L372-L378 | train | Decompress the given string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | TLS.pre_dissect | def pre_dissect(self, s):
"""
Decrypt, verify and decompress the message,
i.e. apply the previous methods according to the reading cipher type.
If the decryption was successful, 'len' will be the length of the
TLSPlaintext.fragment. Else, it should be the length of the
_T... | python | def pre_dissect(self, s):
"""
Decrypt, verify and decompress the message,
i.e. apply the previous methods according to the reading cipher type.
If the decryption was successful, 'len' will be the length of the
TLSPlaintext.fragment. Else, it should be the length of the
_T... | [
"def",
"pre_dissect",
"(",
"self",
",",
"s",
")",
":",
"if",
"len",
"(",
"s",
")",
"<",
"5",
":",
"raise",
"Exception",
"(",
"\"Invalid record: header is too short.\"",
")",
"msglen",
"=",
"struct",
".",
"unpack",
"(",
"'!H'",
",",
"s",
"[",
"3",
":",
... | Decrypt, verify and decompress the message,
i.e. apply the previous methods according to the reading cipher type.
If the decryption was successful, 'len' will be the length of the
TLSPlaintext.fragment. Else, it should be the length of the
_TLSEncryptedContent. | [
"Decrypt",
"verify",
"and",
"decompress",
"the",
"message",
"i",
".",
"e",
".",
"apply",
"the",
"previous",
"methods",
"according",
"to",
"the",
"reading",
"cipher",
"type",
".",
"If",
"the",
"decryption",
"was",
"successful",
"len",
"will",
"be",
"the",
"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L380-L496 | train | Decrypt verify and decompress the message s and return the _TLSEncryptedContent. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | TLS.post_dissect | def post_dissect(self, s):
"""
Commit the pending r/w state if it has been triggered (e.g. by an
underlying TLSChangeCipherSpec or a SSLv2ClientMasterKey). We update
nothing if the prcs was not set, as this probably means that we're
working out-of-context (and we need to keep the... | python | def post_dissect(self, s):
"""
Commit the pending r/w state if it has been triggered (e.g. by an
underlying TLSChangeCipherSpec or a SSLv2ClientMasterKey). We update
nothing if the prcs was not set, as this probably means that we're
working out-of-context (and we need to keep the... | [
"def",
"post_dissect",
"(",
"self",
",",
"s",
")",
":",
"if",
"self",
".",
"tls_session",
".",
"triggered_prcs_commit",
":",
"if",
"self",
".",
"tls_session",
".",
"prcs",
"is",
"not",
"None",
":",
"self",
".",
"tls_session",
".",
"rcs",
"=",
"self",
"... | Commit the pending r/w state if it has been triggered (e.g. by an
underlying TLSChangeCipherSpec or a SSLv2ClientMasterKey). We update
nothing if the prcs was not set, as this probably means that we're
working out-of-context (and we need to keep the default rcs). | [
"Commit",
"the",
"pending",
"r",
"/",
"w",
"state",
"if",
"it",
"has",
"been",
"triggered",
"(",
"e",
".",
"g",
".",
"by",
"an",
"underlying",
"TLSChangeCipherSpec",
"or",
"a",
"SSLv2ClientMasterKey",
")",
".",
"We",
"update",
"nothing",
"if",
"the",
"pr... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L498-L515 | train | Commit the pending r/w state if it has been triggered. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | TLS._tls_compress | def _tls_compress(self, s):
"""
Provided with the TLSPlaintext.fragment,
return the TLSCompressed.fragment.
"""
alg = self.tls_session.wcs.compression
return alg.compress(s) | python | def _tls_compress(self, s):
"""
Provided with the TLSPlaintext.fragment,
return the TLSCompressed.fragment.
"""
alg = self.tls_session.wcs.compression
return alg.compress(s) | [
"def",
"_tls_compress",
"(",
"self",
",",
"s",
")",
":",
"alg",
"=",
"self",
".",
"tls_session",
".",
"wcs",
".",
"compression",
"return",
"alg",
".",
"compress",
"(",
"s",
")"
] | Provided with the TLSPlaintext.fragment,
return the TLSCompressed.fragment. | [
"Provided",
"with",
"the",
"TLSPlaintext",
".",
"fragment",
"return",
"the",
"TLSCompressed",
".",
"fragment",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L535-L541 | train | Compress the given string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | TLS._tls_auth_encrypt | def _tls_auth_encrypt(self, s):
"""
Return the TLSCiphertext.fragment for AEAD ciphers, i.e. the whole
GenericAEADCipher. Also, the additional data is computed right here.
"""
write_seq_num = struct.pack("!Q", self.tls_session.wcs.seq_num)
self.tls_session.wcs.seq_num += ... | python | def _tls_auth_encrypt(self, s):
"""
Return the TLSCiphertext.fragment for AEAD ciphers, i.e. the whole
GenericAEADCipher. Also, the additional data is computed right here.
"""
write_seq_num = struct.pack("!Q", self.tls_session.wcs.seq_num)
self.tls_session.wcs.seq_num += ... | [
"def",
"_tls_auth_encrypt",
"(",
"self",
",",
"s",
")",
":",
"write_seq_num",
"=",
"struct",
".",
"pack",
"(",
"\"!Q\"",
",",
"self",
".",
"tls_session",
".",
"wcs",
".",
"seq_num",
")",
"self",
".",
"tls_session",
".",
"wcs",
".",
"seq_num",
"+=",
"1"... | Return the TLSCiphertext.fragment for AEAD ciphers, i.e. the whole
GenericAEADCipher. Also, the additional data is computed right here. | [
"Return",
"the",
"TLSCiphertext",
".",
"fragment",
"for",
"AEAD",
"ciphers",
"i",
".",
"e",
".",
"the",
"whole",
"GenericAEADCipher",
".",
"Also",
"the",
"additional",
"data",
"is",
"computed",
"right",
"here",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L543-L555 | train | This method is used to encrypt the data with the AEAD cipher. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | TLS._tls_hmac_add | def _tls_hmac_add(self, hdr, msg):
"""
Provided with the record header (concatenation of the TLSCompressed
type, version and length fields) and the TLSCompressed.fragment,
return the concatenation of the TLSCompressed.fragment and the HMAC.
Meant to be used with a block cipher o... | python | def _tls_hmac_add(self, hdr, msg):
"""
Provided with the record header (concatenation of the TLSCompressed
type, version and length fields) and the TLSCompressed.fragment,
return the concatenation of the TLSCompressed.fragment and the HMAC.
Meant to be used with a block cipher o... | [
"def",
"_tls_hmac_add",
"(",
"self",
",",
"hdr",
",",
"msg",
")",
":",
"write_seq_num",
"=",
"struct",
".",
"pack",
"(",
"\"!Q\"",
",",
"self",
".",
"tls_session",
".",
"wcs",
".",
"seq_num",
")",
"self",
".",
"tls_session",
".",
"wcs",
".",
"seq_num",... | Provided with the record header (concatenation of the TLSCompressed
type, version and length fields) and the TLSCompressed.fragment,
return the concatenation of the TLSCompressed.fragment and the HMAC.
Meant to be used with a block cipher or a stream cipher.
It would fail with an AEAD c... | [
"Provided",
"with",
"the",
"record",
"header",
"(",
"concatenation",
"of",
"the",
"TLSCompressed",
"type",
"version",
"and",
"length",
"fields",
")",
"and",
"the",
"TLSCompressed",
".",
"fragment",
"return",
"the",
"concatenation",
"of",
"the",
"TLSCompressed",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L557-L578 | train | Add the message to the HMAC. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | TLS._tls_pad | def _tls_pad(self, s):
"""
Provided with the concatenation of the TLSCompressed.fragment and the
HMAC, append the right padding and return it as a whole.
This is the TLS-style padding: while SSL allowed for random padding,
TLS (misguidedly) specifies the repetition of the same by... | python | def _tls_pad(self, s):
"""
Provided with the concatenation of the TLSCompressed.fragment and the
HMAC, append the right padding and return it as a whole.
This is the TLS-style padding: while SSL allowed for random padding,
TLS (misguidedly) specifies the repetition of the same by... | [
"def",
"_tls_pad",
"(",
"self",
",",
"s",
")",
":",
"padding",
"=",
"b\"\"",
"block_size",
"=",
"self",
".",
"tls_session",
".",
"wcs",
".",
"cipher",
".",
"block_size",
"padlen",
"=",
"block_size",
"-",
"(",
"(",
"len",
"(",
"s",
")",
"+",
"1",
")... | Provided with the concatenation of the TLSCompressed.fragment and the
HMAC, append the right padding and return it as a whole.
This is the TLS-style padding: while SSL allowed for random padding,
TLS (misguidedly) specifies the repetition of the same byte all over,
and this byte must be ... | [
"Provided",
"with",
"the",
"concatenation",
"of",
"the",
"TLSCompressed",
".",
"fragment",
"and",
"the",
"HMAC",
"append",
"the",
"right",
"padding",
"and",
"return",
"it",
"as",
"a",
"whole",
".",
"This",
"is",
"the",
"TLS",
"-",
"style",
"padding",
":",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L580-L597 | train | Pads the given string with the right padding. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/record.py | TLS.post_build | def post_build(self, pkt, pay):
"""
Apply the previous methods according to the writing cipher type.
"""
# Compute the length of TLSPlaintext fragment
hdr, frag = pkt[:5], pkt[5:]
tmp_len = len(frag)
hdr = hdr[:3] + struct.pack("!H", tmp_len)
# Compressio... | python | def post_build(self, pkt, pay):
"""
Apply the previous methods according to the writing cipher type.
"""
# Compute the length of TLSPlaintext fragment
hdr, frag = pkt[:5], pkt[5:]
tmp_len = len(frag)
hdr = hdr[:3] + struct.pack("!H", tmp_len)
# Compressio... | [
"def",
"post_build",
"(",
"self",
",",
"pkt",
",",
"pay",
")",
":",
"# Compute the length of TLSPlaintext fragment",
"hdr",
",",
"frag",
"=",
"pkt",
"[",
":",
"5",
"]",
",",
"pkt",
"[",
"5",
":",
"]",
"tmp_len",
"=",
"len",
"(",
"frag",
")",
"hdr",
"... | Apply the previous methods according to the writing cipher type. | [
"Apply",
"the",
"previous",
"methods",
"according",
"to",
"the",
"writing",
"cipher",
"type",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/record.py#L607-L676 | train | Apply the previous methods according to the writing cipher type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/supersocket.py | SuperSocket.select | def select(sockets, remain=conf.recv_poll_rate):
"""This function is called during sendrecv() routine to select
the available sockets.
params:
- sockets: an array of sockets that need to be selected
returns:
- an array of sockets that were selected
- the funct... | python | def select(sockets, remain=conf.recv_poll_rate):
"""This function is called during sendrecv() routine to select
the available sockets.
params:
- sockets: an array of sockets that need to be selected
returns:
- an array of sockets that were selected
- the funct... | [
"def",
"select",
"(",
"sockets",
",",
"remain",
"=",
"conf",
".",
"recv_poll_rate",
")",
":",
"try",
":",
"inp",
",",
"_",
",",
"_",
"=",
"select",
"(",
"sockets",
",",
"[",
"]",
",",
"[",
"]",
",",
"remain",
")",
"except",
"(",
"IOError",
",",
... | This function is called during sendrecv() routine to select
the available sockets.
params:
- sockets: an array of sockets that need to be selected
returns:
- an array of sockets that were selected
- the function to be called next to get the packets (i.g. recv) | [
"This",
"function",
"is",
"called",
"during",
"sendrecv",
"()",
"routine",
"to",
"select",
"the",
"available",
"sockets",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/supersocket.py#L109-L125 | train | This function is called during sendrecv to select the available sockets. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/supersocket.py | TunTapInterface.open | def open(self):
"""Open the TUN or TAP device."""
if not self.closed:
return
self.outs = self.ins = open(
"/dev/net/tun" if LINUX else ("/dev/%s" % self.iface), "r+b",
buffering=0
)
if LINUX:
from fcntl import ioctl
# TU... | python | def open(self):
"""Open the TUN or TAP device."""
if not self.closed:
return
self.outs = self.ins = open(
"/dev/net/tun" if LINUX else ("/dev/%s" % self.iface), "r+b",
buffering=0
)
if LINUX:
from fcntl import ioctl
# TU... | [
"def",
"open",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"closed",
":",
"return",
"self",
".",
"outs",
"=",
"self",
".",
"ins",
"=",
"open",
"(",
"\"/dev/net/tun\"",
"if",
"LINUX",
"else",
"(",
"\"/dev/%s\"",
"%",
"self",
".",
"iface",
")",
... | Open the TUN or TAP device. | [
"Open",
"the",
"TUN",
"or",
"TAP",
"device",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/supersocket.py#L309-L327 | train | Open the TUN or TAP device. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/zigbee.py | util_mic_len | def util_mic_len(pkt):
''' Calculate the length of the attribute value field '''
if (pkt.nwk_seclevel == 0): # no encryption, no mic
return 0
elif (pkt.nwk_seclevel == 1): # MIC-32
return 4
elif (pkt.nwk_seclevel == 2): # MIC-64
return 8
elif (pkt.nwk_seclevel == 3): # MI... | python | def util_mic_len(pkt):
''' Calculate the length of the attribute value field '''
if (pkt.nwk_seclevel == 0): # no encryption, no mic
return 0
elif (pkt.nwk_seclevel == 1): # MIC-32
return 4
elif (pkt.nwk_seclevel == 2): # MIC-64
return 8
elif (pkt.nwk_seclevel == 3): # MI... | [
"def",
"util_mic_len",
"(",
"pkt",
")",
":",
"if",
"(",
"pkt",
".",
"nwk_seclevel",
"==",
"0",
")",
":",
"# no encryption, no mic",
"return",
"0",
"elif",
"(",
"pkt",
".",
"nwk_seclevel",
"==",
"1",
")",
":",
"# MIC-32",
"return",
"4",
"elif",
"(",
"pk... | Calculate the length of the attribute value field | [
"Calculate",
"the",
"length",
"of",
"the",
"attribute",
"value",
"field"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/zigbee.py#L460-L479 | train | Calculate the length of the attribute value field in the MIC - 32 or MIC - 64 representation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/eddystone.py | Eddystone_Frame.build_eir | def build_eir(self):
"""Builds a list of EIR messages to wrap this frame."""
return LowEnergyBeaconHelper.base_eir + [
EIR_Hdr() / EIR_CompleteList16BitServiceUUIDs(svc_uuids=[
EDDYSTONE_UUID]),
EIR_Hdr() / EIR_ServiceData16BitUUID() / self
] | python | def build_eir(self):
"""Builds a list of EIR messages to wrap this frame."""
return LowEnergyBeaconHelper.base_eir + [
EIR_Hdr() / EIR_CompleteList16BitServiceUUIDs(svc_uuids=[
EDDYSTONE_UUID]),
EIR_Hdr() / EIR_ServiceData16BitUUID() / self
] | [
"def",
"build_eir",
"(",
"self",
")",
":",
"return",
"LowEnergyBeaconHelper",
".",
"base_eir",
"+",
"[",
"EIR_Hdr",
"(",
")",
"/",
"EIR_CompleteList16BitServiceUUIDs",
"(",
"svc_uuids",
"=",
"[",
"EDDYSTONE_UUID",
"]",
")",
",",
"EIR_Hdr",
"(",
")",
"/",
"EI... | Builds a list of EIR messages to wrap this frame. | [
"Builds",
"a",
"list",
"of",
"EIR",
"messages",
"to",
"wrap",
"this",
"frame",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/eddystone.py#L117-L124 | train | Builds a list of EIR messages to wrap this frame. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/eddystone.py | Eddystone_URL.from_url | def from_url(url):
"""Creates an Eddystone_Frame with a Eddystone_URL for a given URL."""
url = url.encode('ascii')
scheme = None
for k, v in EDDYSTONE_URL_SCHEMES.items():
if url.startswith(v):
scheme = k
url = url[len(v):]
bre... | python | def from_url(url):
"""Creates an Eddystone_Frame with a Eddystone_URL for a given URL."""
url = url.encode('ascii')
scheme = None
for k, v in EDDYSTONE_URL_SCHEMES.items():
if url.startswith(v):
scheme = k
url = url[len(v):]
bre... | [
"def",
"from_url",
"(",
"url",
")",
":",
"url",
"=",
"url",
".",
"encode",
"(",
"'ascii'",
")",
"scheme",
"=",
"None",
"for",
"k",
",",
"v",
"in",
"EDDYSTONE_URL_SCHEMES",
".",
"items",
"(",
")",
":",
"if",
"url",
".",
"startswith",
"(",
"v",
")",
... | Creates an Eddystone_Frame with a Eddystone_URL for a given URL. | [
"Creates",
"an",
"Eddystone_Frame",
"with",
"a",
"Eddystone_URL",
"for",
"a",
"given",
"URL",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/eddystone.py#L159-L173 | train | Creates an Eddystone_Frame with a Eddystone_URL for a given URL. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/route6.py | Route6.add | def add(self, *args, **kargs):
"""Ex:
add(dst="2001:db8:cafe:f000::/56")
add(dst="2001:db8:cafe:f000::/56", gw="2001:db8:cafe::1")
add(dst="2001:db8:cafe:f000::/64", gw="2001:db8:cafe::1", dev="eth0")
"""
self.invalidate_cache()
self.routes.append(self.make_route(... | python | def add(self, *args, **kargs):
"""Ex:
add(dst="2001:db8:cafe:f000::/56")
add(dst="2001:db8:cafe:f000::/56", gw="2001:db8:cafe::1")
add(dst="2001:db8:cafe:f000::/64", gw="2001:db8:cafe::1", dev="eth0")
"""
self.invalidate_cache()
self.routes.append(self.make_route(... | [
"def",
"add",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"self",
".",
"invalidate_cache",
"(",
")",
"self",
".",
"routes",
".",
"append",
"(",
"self",
".",
"make_route",
"(",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
")"
] | Ex:
add(dst="2001:db8:cafe:f000::/56")
add(dst="2001:db8:cafe:f000::/56", gw="2001:db8:cafe::1")
add(dst="2001:db8:cafe:f000::/64", gw="2001:db8:cafe::1", dev="eth0") | [
"Ex",
":",
"add",
"(",
"dst",
"=",
"2001",
":",
"db8",
":",
"cafe",
":",
"f000",
"::",
"/",
"56",
")",
"add",
"(",
"dst",
"=",
"2001",
":",
"db8",
":",
"cafe",
":",
"f000",
"::",
"/",
"56",
"gw",
"=",
"2001",
":",
"db8",
":",
"cafe",
"::",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/route6.py#L91-L98 | train | Add a new entry to the cache. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/route6.py | Route6.ifdel | def ifdel(self, iff):
""" removes all route entries that uses 'iff' interface. """
new_routes = []
for rt in self.routes:
if rt[3] != iff:
new_routes.append(rt)
self.invalidate_cache()
self.routes = new_routes | python | def ifdel(self, iff):
""" removes all route entries that uses 'iff' interface. """
new_routes = []
for rt in self.routes:
if rt[3] != iff:
new_routes.append(rt)
self.invalidate_cache()
self.routes = new_routes | [
"def",
"ifdel",
"(",
"self",
",",
"iff",
")",
":",
"new_routes",
"=",
"[",
"]",
"for",
"rt",
"in",
"self",
".",
"routes",
":",
"if",
"rt",
"[",
"3",
"]",
"!=",
"iff",
":",
"new_routes",
".",
"append",
"(",
"rt",
")",
"self",
".",
"invalidate_cach... | removes all route entries that uses 'iff' interface. | [
"removes",
"all",
"route",
"entries",
"that",
"uses",
"iff",
"interface",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/route6.py#L143-L150 | train | Removes all route entries that uses iff interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/route6.py | Route6.ifadd | def ifadd(self, iff, addr):
"""
Add an interface 'iff' with provided address into routing table.
Ex: ifadd('eth0', '2001:bd8:cafe:1::1/64') will add following entry into # noqa: E501
Scapy6 internal routing table:
Destination Next Hop iface Def src @ ... | python | def ifadd(self, iff, addr):
"""
Add an interface 'iff' with provided address into routing table.
Ex: ifadd('eth0', '2001:bd8:cafe:1::1/64') will add following entry into # noqa: E501
Scapy6 internal routing table:
Destination Next Hop iface Def src @ ... | [
"def",
"ifadd",
"(",
"self",
",",
"iff",
",",
"addr",
")",
":",
"addr",
",",
"plen",
"=",
"(",
"addr",
".",
"split",
"(",
"\"/\"",
")",
"+",
"[",
"\"128\"",
"]",
")",
"[",
":",
"2",
"]",
"addr",
"=",
"in6_ptop",
"(",
"addr",
")",
"plen",
"=",... | Add an interface 'iff' with provided address into routing table.
Ex: ifadd('eth0', '2001:bd8:cafe:1::1/64') will add following entry into # noqa: E501
Scapy6 internal routing table:
Destination Next Hop iface Def src @ Metric
2001:bd8:cafe:1::/64 :: ... | [
"Add",
"an",
"interface",
"iff",
"with",
"provided",
"address",
"into",
"routing",
"table",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/route6.py#L152-L172 | train | Add an interface iff with provided address into routing table. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/route6.py | Route6.route | def route(self, dst=None, dev=None, verbose=conf.verb):
"""
Provide best route to IPv6 destination address, based on Scapy
internal routing table content.
When a set of address is passed (e.g. 2001:db8:cafe:*::1-5) an address
of the set is used. Be aware of that behavior when us... | python | def route(self, dst=None, dev=None, verbose=conf.verb):
"""
Provide best route to IPv6 destination address, based on Scapy
internal routing table content.
When a set of address is passed (e.g. 2001:db8:cafe:*::1-5) an address
of the set is used. Be aware of that behavior when us... | [
"def",
"route",
"(",
"self",
",",
"dst",
"=",
"None",
",",
"dev",
"=",
"None",
",",
"verbose",
"=",
"conf",
".",
"verb",
")",
":",
"dst",
"=",
"dst",
"or",
"\"::/0\"",
"# Enable route(None) to return default route",
"# Transform \"2001:db8:cafe:*::1-5:0/120\" to o... | Provide best route to IPv6 destination address, based on Scapy
internal routing table content.
When a set of address is passed (e.g. 2001:db8:cafe:*::1-5) an address
of the set is used. Be aware of that behavior when using wildcards in
upper parts of addresses !
If 'dst' parame... | [
"Provide",
"best",
"route",
"to",
"IPv6",
"destination",
"address",
"based",
"on",
"Scapy",
"internal",
"routing",
"table",
"content",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/route6.py#L174-L282 | train | Return a dict of cache entries for a given destination address. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/tools.py | _tls_compress | def _tls_compress(alg, p):
"""
Compress p (a TLSPlaintext instance) using compression algorithm instance
alg and return a TLSCompressed instance.
"""
c = TLSCompressed()
c.type = p.type
c.version = p.version
c.data = alg.compress(p.data)
c.len = len(c.data)
return c | python | def _tls_compress(alg, p):
"""
Compress p (a TLSPlaintext instance) using compression algorithm instance
alg and return a TLSCompressed instance.
"""
c = TLSCompressed()
c.type = p.type
c.version = p.version
c.data = alg.compress(p.data)
c.len = len(c.data)
return c | [
"def",
"_tls_compress",
"(",
"alg",
",",
"p",
")",
":",
"c",
"=",
"TLSCompressed",
"(",
")",
"c",
".",
"type",
"=",
"p",
".",
"type",
"c",
".",
"version",
"=",
"p",
".",
"version",
"c",
".",
"data",
"=",
"alg",
".",
"compress",
"(",
"p",
".",
... | Compress p (a TLSPlaintext instance) using compression algorithm instance
alg and return a TLSCompressed instance. | [
"Compress",
"p",
"(",
"a",
"TLSPlaintext",
"instance",
")",
"using",
"compression",
"algorithm",
"instance",
"alg",
"and",
"return",
"a",
"TLSCompressed",
"instance",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/tools.py#L39-L49 | train | Compress a TLSPlaintext instance using a compression algorithm instance
alg and return a TLSCompressed instance. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/tools.py | _tls_decompress | def _tls_decompress(alg, c):
"""
Decompress c (a TLSCompressed instance) using compression algorithm
instance alg and return a TLSPlaintext instance.
"""
p = TLSPlaintext()
p.type = c.type
p.version = c.version
p.data = alg.decompress(c.data)
p.len = len(p.data)
return p | python | def _tls_decompress(alg, c):
"""
Decompress c (a TLSCompressed instance) using compression algorithm
instance alg and return a TLSPlaintext instance.
"""
p = TLSPlaintext()
p.type = c.type
p.version = c.version
p.data = alg.decompress(c.data)
p.len = len(p.data)
return p | [
"def",
"_tls_decompress",
"(",
"alg",
",",
"c",
")",
":",
"p",
"=",
"TLSPlaintext",
"(",
")",
"p",
".",
"type",
"=",
"c",
".",
"type",
"p",
".",
"version",
"=",
"c",
".",
"version",
"p",
".",
"data",
"=",
"alg",
".",
"decompress",
"(",
"c",
"."... | Decompress c (a TLSCompressed instance) using compression algorithm
instance alg and return a TLSPlaintext instance. | [
"Decompress",
"c",
"(",
"a",
"TLSCompressed",
"instance",
")",
"using",
"compression",
"algorithm",
"instance",
"alg",
"and",
"return",
"a",
"TLSPlaintext",
"instance",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/tools.py#L52-L62 | train | Decompress a TLSCompressed instance using the compression algorithm and return a TLSPlaintext instance. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/tools.py | _tls_mac_add | def _tls_mac_add(alg, c, write_seq_num):
"""
Compute the MAC using provided MAC alg instance over TLSCiphertext c using
current write sequence number write_seq_num. Computed MAC is then appended
to c.data and c.len is updated to reflect that change. It is the
caller responsibility to increment the s... | python | def _tls_mac_add(alg, c, write_seq_num):
"""
Compute the MAC using provided MAC alg instance over TLSCiphertext c using
current write sequence number write_seq_num. Computed MAC is then appended
to c.data and c.len is updated to reflect that change. It is the
caller responsibility to increment the s... | [
"def",
"_tls_mac_add",
"(",
"alg",
",",
"c",
",",
"write_seq_num",
")",
":",
"write_seq_num",
"=",
"struct",
".",
"pack",
"(",
"\"!Q\"",
",",
"write_seq_num",
")",
"h",
"=",
"alg",
".",
"digest",
"(",
"write_seq_num",
"+",
"bytes",
"(",
"c",
")",
")",
... | Compute the MAC using provided MAC alg instance over TLSCiphertext c using
current write sequence number write_seq_num. Computed MAC is then appended
to c.data and c.len is updated to reflect that change. It is the
caller responsibility to increment the sequence number after the operation.
The function ... | [
"Compute",
"the",
"MAC",
"using",
"provided",
"MAC",
"alg",
"instance",
"over",
"TLSCiphertext",
"c",
"using",
"current",
"write",
"sequence",
"number",
"write_seq_num",
".",
"Computed",
"MAC",
"is",
"then",
"appended",
"to",
"c",
".",
"data",
"and",
"c",
".... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/tools.py#L65-L76 | train | Compute the MAC using the provided MAC alg instance over TLSCiphertext c using
current write sequence number write_seq_num. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/tools.py | _tls_mac_verify | def _tls_mac_verify(alg, p, read_seq_num):
"""
Verify if the MAC in provided message (message resulting from decryption
and padding removal) is valid. Current read sequence number is used in
the verification process.
If the MAC is valid:
- The function returns True
- The packet p is updat... | python | def _tls_mac_verify(alg, p, read_seq_num):
"""
Verify if the MAC in provided message (message resulting from decryption
and padding removal) is valid. Current read sequence number is used in
the verification process.
If the MAC is valid:
- The function returns True
- The packet p is updat... | [
"def",
"_tls_mac_verify",
"(",
"alg",
",",
"p",
",",
"read_seq_num",
")",
":",
"h_size",
"=",
"alg",
".",
"hash_len",
"if",
"p",
".",
"len",
"<",
"h_size",
":",
"return",
"False",
"received_h",
"=",
"p",
".",
"data",
"[",
"-",
"h_size",
":",
"]",
"... | Verify if the MAC in provided message (message resulting from decryption
and padding removal) is valid. Current read sequence number is used in
the verification process.
If the MAC is valid:
- The function returns True
- The packet p is updated in the following way: trailing MAC value is
r... | [
"Verify",
"if",
"the",
"MAC",
"in",
"provided",
"message",
"(",
"message",
"resulting",
"from",
"decryption",
"and",
"padding",
"removal",
")",
"is",
"valid",
".",
"Current",
"read",
"sequence",
"number",
"is",
"used",
"in",
"the",
"verification",
"process",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/tools.py#L79-L104 | train | Verify that the MAC in the provided message is valid. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/tools.py | _tls_add_pad | def _tls_add_pad(p, block_size):
"""
Provided with cipher block size parameter and current TLSCompressed packet
p (after MAC addition), the function adds required, deterministic padding
to p.data before encryption step, as it is defined for TLS (i.e. not
SSL and its allowed random padding). The func... | python | def _tls_add_pad(p, block_size):
"""
Provided with cipher block size parameter and current TLSCompressed packet
p (after MAC addition), the function adds required, deterministic padding
to p.data before encryption step, as it is defined for TLS (i.e. not
SSL and its allowed random padding). The func... | [
"def",
"_tls_add_pad",
"(",
"p",
",",
"block_size",
")",
":",
"padlen",
"=",
"-",
"p",
".",
"len",
"%",
"block_size",
"padding",
"=",
"chb",
"(",
"padlen",
")",
"*",
"(",
"padlen",
"+",
"1",
")",
"p",
".",
"len",
"+=",
"len",
"(",
"padding",
")",... | Provided with cipher block size parameter and current TLSCompressed packet
p (after MAC addition), the function adds required, deterministic padding
to p.data before encryption step, as it is defined for TLS (i.e. not
SSL and its allowed random padding). The function has no return value. | [
"Provided",
"with",
"cipher",
"block",
"size",
"parameter",
"and",
"current",
"TLSCompressed",
"packet",
"p",
"(",
"after",
"MAC",
"addition",
")",
"the",
"function",
"adds",
"required",
"deterministic",
"padding",
"to",
"p",
".",
"data",
"before",
"encryption",... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/tools.py#L107-L117 | train | This function adds a deterministic padding to the packet p. data after encryption step. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/tools.py | _tls_del_pad | def _tls_del_pad(p):
"""
Provided with a just decrypted TLSCiphertext (now a TLSPlaintext instance)
p, the function removes the trailing padding found in p.data. It also
performs some sanity checks on the padding (length, content, ...). False
is returned if one of the check fails. Otherwise, True is... | python | def _tls_del_pad(p):
"""
Provided with a just decrypted TLSCiphertext (now a TLSPlaintext instance)
p, the function removes the trailing padding found in p.data. It also
performs some sanity checks on the padding (length, content, ...). False
is returned if one of the check fails. Otherwise, True is... | [
"def",
"_tls_del_pad",
"(",
"p",
")",
":",
"if",
"p",
".",
"len",
"<",
"1",
":",
"warning",
"(",
"\"Message format is invalid (padding)\"",
")",
"return",
"False",
"padlen",
"=",
"orb",
"(",
"p",
".",
"data",
"[",
"-",
"1",
"]",
")",
"padsize",
"=",
... | Provided with a just decrypted TLSCiphertext (now a TLSPlaintext instance)
p, the function removes the trailing padding found in p.data. It also
performs some sanity checks on the padding (length, content, ...). False
is returned if one of the check fails. Otherwise, True is returned,
indicating that p.... | [
"Provided",
"with",
"a",
"just",
"decrypted",
"TLSCiphertext",
"(",
"now",
"a",
"TLSPlaintext",
"instance",
")",
"p",
"the",
"function",
"removes",
"the",
"trailing",
"padding",
"found",
"in",
"p",
".",
"data",
".",
"It",
"also",
"performs",
"some",
"sanity"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/tools.py#L120-L147 | train | This function is used to remove the trailing padding found in p. data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/tools.py | _tls_encrypt | def _tls_encrypt(alg, p):
"""
Provided with an already MACed TLSCompressed packet, and a stream or block
cipher alg, the function converts it into a TLSCiphertext (i.e. encrypts it
and updates length). The function returns a newly created TLSCiphertext
instance.
"""
c = TLSCiphertext()
c... | python | def _tls_encrypt(alg, p):
"""
Provided with an already MACed TLSCompressed packet, and a stream or block
cipher alg, the function converts it into a TLSCiphertext (i.e. encrypts it
and updates length). The function returns a newly created TLSCiphertext
instance.
"""
c = TLSCiphertext()
c... | [
"def",
"_tls_encrypt",
"(",
"alg",
",",
"p",
")",
":",
"c",
"=",
"TLSCiphertext",
"(",
")",
"c",
".",
"type",
"=",
"p",
".",
"type",
"c",
".",
"version",
"=",
"p",
".",
"version",
"c",
".",
"data",
"=",
"alg",
".",
"encrypt",
"(",
"p",
".",
"... | Provided with an already MACed TLSCompressed packet, and a stream or block
cipher alg, the function converts it into a TLSCiphertext (i.e. encrypts it
and updates length). The function returns a newly created TLSCiphertext
instance. | [
"Provided",
"with",
"an",
"already",
"MACed",
"TLSCompressed",
"packet",
"and",
"a",
"stream",
"or",
"block",
"cipher",
"alg",
"the",
"function",
"converts",
"it",
"into",
"a",
"TLSCiphertext",
"(",
"i",
".",
"e",
".",
"encrypts",
"it",
"and",
"updates",
"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/tools.py#L150-L162 | train | This function encrypts a TLSCompressed packet and returns a TLSCiphertext object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/tools.py | _tls_decrypt | def _tls_decrypt(alg, c):
"""
Provided with a TLSCiphertext instance c, and a stream or block cipher alg,
the function decrypts c.data and returns a newly created TLSPlaintext.
"""
p = TLSPlaintext()
p.type = c.type
p.version = c.version
p.data = alg.decrypt(c.data)
p.len = len(p.dat... | python | def _tls_decrypt(alg, c):
"""
Provided with a TLSCiphertext instance c, and a stream or block cipher alg,
the function decrypts c.data and returns a newly created TLSPlaintext.
"""
p = TLSPlaintext()
p.type = c.type
p.version = c.version
p.data = alg.decrypt(c.data)
p.len = len(p.dat... | [
"def",
"_tls_decrypt",
"(",
"alg",
",",
"c",
")",
":",
"p",
"=",
"TLSPlaintext",
"(",
")",
"p",
".",
"type",
"=",
"c",
".",
"type",
"p",
".",
"version",
"=",
"c",
".",
"version",
"p",
".",
"data",
"=",
"alg",
".",
"decrypt",
"(",
"c",
".",
"d... | Provided with a TLSCiphertext instance c, and a stream or block cipher alg,
the function decrypts c.data and returns a newly created TLSPlaintext. | [
"Provided",
"with",
"a",
"TLSCiphertext",
"instance",
"c",
"and",
"a",
"stream",
"or",
"block",
"cipher",
"alg",
"the",
"function",
"decrypts",
"c",
".",
"data",
"and",
"returns",
"a",
"newly",
"created",
"TLSPlaintext",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/tools.py#L165-L175 | train | This function decrypts a TLSCiphertext instance c and returns a TLSPlaintext instance that is then returned. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/tools.py | _tls_aead_auth_encrypt | def _tls_aead_auth_encrypt(alg, p, write_seq_num):
"""
Provided with a TLSCompressed instance p, the function applies AEAD
cipher alg to p.data and builds a new TLSCiphertext instance. Unlike
for block and stream ciphers, for which the authentication step is done
separately, AEAD alg does it simulta... | python | def _tls_aead_auth_encrypt(alg, p, write_seq_num):
"""
Provided with a TLSCompressed instance p, the function applies AEAD
cipher alg to p.data and builds a new TLSCiphertext instance. Unlike
for block and stream ciphers, for which the authentication step is done
separately, AEAD alg does it simulta... | [
"def",
"_tls_aead_auth_encrypt",
"(",
"alg",
",",
"p",
",",
"write_seq_num",
")",
":",
"P",
"=",
"bytes",
"(",
"p",
")",
"write_seq_num",
"=",
"struct",
".",
"pack",
"(",
"\"!Q\"",
",",
"write_seq_num",
")",
"A",
"=",
"write_seq_num",
"+",
"P",
"[",
":... | Provided with a TLSCompressed instance p, the function applies AEAD
cipher alg to p.data and builds a new TLSCiphertext instance. Unlike
for block and stream ciphers, for which the authentication step is done
separately, AEAD alg does it simultaneously: this is the reason why
write_seq_num is passed to ... | [
"Provided",
"with",
"a",
"TLSCompressed",
"instance",
"p",
"the",
"function",
"applies",
"AEAD",
"cipher",
"alg",
"to",
"p",
".",
"data",
"and",
"builds",
"a",
"new",
"TLSCiphertext",
"instance",
".",
"Unlike",
"for",
"block",
"and",
"stream",
"ciphers",
"fo... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/tools.py#L178-L197 | train | This function applies an AEAD cipher to p. data and returns a TLSCiphertext instance with the encrypted data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/usb.py | _extcap_call | def _extcap_call(prog, args, keyword, values):
"""Function used to call a program using the extcap format,
then parse the results"""
p = subprocess.Popen(
[prog] + args,
stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
data, err = p.communicate()
if p.returncode != 0:
rai... | python | def _extcap_call(prog, args, keyword, values):
"""Function used to call a program using the extcap format,
then parse the results"""
p = subprocess.Popen(
[prog] + args,
stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
data, err = p.communicate()
if p.returncode != 0:
rai... | [
"def",
"_extcap_call",
"(",
"prog",
",",
"args",
",",
"keyword",
",",
"values",
")",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"prog",
"]",
"+",
"args",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
... | Function used to call a program using the extcap format,
then parse the results | [
"Function",
"used",
"to",
"call",
"a",
"program",
"using",
"the",
"extcap",
"format",
"then",
"parse",
"the",
"results"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/usb.py#L156-L176 | train | Function used to call a program using the extcap format and parse the results | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/ppi_geotag.py | _hcsi_null_range | def _hcsi_null_range(*args, **kwargs):
"""Builds a list of _HCSINullField with numbered "Reserved" names.
Takes the same arguments as the ``range`` built-in.
:returns: list[HCSINullField]
"""
return [
HCSINullField('Reserved{:02d}'.format(x))
for x in range(*args, **kwargs)
] | python | def _hcsi_null_range(*args, **kwargs):
"""Builds a list of _HCSINullField with numbered "Reserved" names.
Takes the same arguments as the ``range`` built-in.
:returns: list[HCSINullField]
"""
return [
HCSINullField('Reserved{:02d}'.format(x))
for x in range(*args, **kwargs)
] | [
"def",
"_hcsi_null_range",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"[",
"HCSINullField",
"(",
"'Reserved{:02d}'",
".",
"format",
"(",
"x",
")",
")",
"for",
"x",
"in",
"range",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"... | Builds a list of _HCSINullField with numbered "Reserved" names.
Takes the same arguments as the ``range`` built-in.
:returns: list[HCSINullField] | [
"Builds",
"a",
"list",
"of",
"_HCSINullField",
"with",
"numbered",
"Reserved",
"names",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/ppi_geotag.py#L243-L253 | train | Builds a list of _HCSINullField with numbered "Reserved" names. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/ppi_geotag.py | _RMMLEIntField.i2m | def i2m(self, pkt, x):
"""Convert internal value to machine value"""
if x is None:
# Try to return zero if undefined
x = self.h2i(pkt, 0)
return x | python | def i2m(self, pkt, x):
"""Convert internal value to machine value"""
if x is None:
# Try to return zero if undefined
x = self.h2i(pkt, 0)
return x | [
"def",
"i2m",
"(",
"self",
",",
"pkt",
",",
"x",
")",
":",
"if",
"x",
"is",
"None",
":",
"# Try to return zero if undefined",
"x",
"=",
"self",
".",
"h2i",
"(",
"pkt",
",",
"0",
")",
"return",
"x"
] | Convert internal value to machine value | [
"Convert",
"internal",
"value",
"to",
"machine",
"value"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/ppi_geotag.py#L86-L91 | train | Convert internal value to machine value | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/__init__.py | get_if_addr6 | def get_if_addr6(iff):
"""
Returns the main global unicast address associated with provided
interface, in human readable form. If no global address is found,
None is returned.
"""
return next((x[0] for x in in6_getifaddr()
if x[2] == iff and x[1] == IPV6_ADDR_GLOBAL), None) | python | def get_if_addr6(iff):
"""
Returns the main global unicast address associated with provided
interface, in human readable form. If no global address is found,
None is returned.
"""
return next((x[0] for x in in6_getifaddr()
if x[2] == iff and x[1] == IPV6_ADDR_GLOBAL), None) | [
"def",
"get_if_addr6",
"(",
"iff",
")",
":",
"return",
"next",
"(",
"(",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"in6_getifaddr",
"(",
")",
"if",
"x",
"[",
"2",
"]",
"==",
"iff",
"and",
"x",
"[",
"1",
"]",
"==",
"IPV6_ADDR_GLOBAL",
")",
",",
"Non... | Returns the main global unicast address associated with provided
interface, in human readable form. If no global address is found,
None is returned. | [
"Returns",
"the",
"main",
"global",
"unicast",
"address",
"associated",
"with",
"provided",
"interface",
"in",
"human",
"readable",
"form",
".",
"If",
"no",
"global",
"address",
"is",
"found",
"None",
"is",
"returned",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/__init__.py#L76-L83 | train | Returns the main unicast address associated with provided
interface in human readable form. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/__init__.py | get_if_raw_addr6 | def get_if_raw_addr6(iff):
"""
Returns the main global unicast address associated with provided
interface, in network format. If no global address is found, None
is returned.
"""
ip6 = get_if_addr6(iff)
if ip6 is not None:
return inet_pton(socket.AF_INET6, ip6)
return None | python | def get_if_raw_addr6(iff):
"""
Returns the main global unicast address associated with provided
interface, in network format. If no global address is found, None
is returned.
"""
ip6 = get_if_addr6(iff)
if ip6 is not None:
return inet_pton(socket.AF_INET6, ip6)
return None | [
"def",
"get_if_raw_addr6",
"(",
"iff",
")",
":",
"ip6",
"=",
"get_if_addr6",
"(",
"iff",
")",
"if",
"ip6",
"is",
"not",
"None",
":",
"return",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"ip6",
")",
"return",
"None"
] | Returns the main global unicast address associated with provided
interface, in network format. If no global address is found, None
is returned. | [
"Returns",
"the",
"main",
"global",
"unicast",
"address",
"associated",
"with",
"provided",
"interface",
"in",
"network",
"format",
".",
"If",
"no",
"global",
"address",
"is",
"found",
"None",
"is",
"returned",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/__init__.py#L86-L96 | train | Returns the main unicast address associated with provided
interface in network format. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/pnio.py | i2s_frameid | def i2s_frameid(x):
""" Get representation name of a pnio frame ID
:param x: a key of the PNIO_FRAME_IDS dictionary
:returns: str
"""
try:
return PNIO_FRAME_IDS[x]
except KeyError:
pass
if 0x0100 <= x < 0x1000:
return "RT_CLASS_3 (%4x)" % x
if 0x8000 <= x < 0xC00... | python | def i2s_frameid(x):
""" Get representation name of a pnio frame ID
:param x: a key of the PNIO_FRAME_IDS dictionary
:returns: str
"""
try:
return PNIO_FRAME_IDS[x]
except KeyError:
pass
if 0x0100 <= x < 0x1000:
return "RT_CLASS_3 (%4x)" % x
if 0x8000 <= x < 0xC00... | [
"def",
"i2s_frameid",
"(",
"x",
")",
":",
"try",
":",
"return",
"PNIO_FRAME_IDS",
"[",
"x",
"]",
"except",
"KeyError",
":",
"pass",
"if",
"0x0100",
"<=",
"x",
"<",
"0x1000",
":",
"return",
"\"RT_CLASS_3 (%4x)\"",
"%",
"x",
"if",
"0x8000",
"<=",
"x",
"<... | Get representation name of a pnio frame ID
:param x: a key of the PNIO_FRAME_IDS dictionary
:returns: str | [
"Get",
"representation",
"name",
"of",
"a",
"pnio",
"frame",
"ID"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/pnio.py#L53-L71 | train | Get representation name of a pnio frame ID. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/pnio.py | s2i_frameid | def s2i_frameid(x):
""" Get pnio frame ID from a representation name
Performs a reverse look-up in PNIO_FRAME_IDS dictionary
:param x: a value of PNIO_FRAME_IDS dict
:returns: integer
"""
try:
return {
"RT_CLASS_3": 0x0100,
"RT_CLASS_1": 0x8000,
"RT_... | python | def s2i_frameid(x):
""" Get pnio frame ID from a representation name
Performs a reverse look-up in PNIO_FRAME_IDS dictionary
:param x: a value of PNIO_FRAME_IDS dict
:returns: integer
"""
try:
return {
"RT_CLASS_3": 0x0100,
"RT_CLASS_1": 0x8000,
"RT_... | [
"def",
"s2i_frameid",
"(",
"x",
")",
":",
"try",
":",
"return",
"{",
"\"RT_CLASS_3\"",
":",
"0x0100",
",",
"\"RT_CLASS_1\"",
":",
"0x8000",
",",
"\"RT_CLASS_UDP\"",
":",
"0xC000",
",",
"\"FragmentationFrameID\"",
":",
"0xFF80",
",",
"}",
"[",
"x",
"]",
"ex... | Get pnio frame ID from a representation name
Performs a reverse look-up in PNIO_FRAME_IDS dictionary
:param x: a value of PNIO_FRAME_IDS dict
:returns: integer | [
"Get",
"pnio",
"frame",
"ID",
"from",
"a",
"representation",
"name"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/pnio.py#L74-L96 | train | Get pnio frame ID from a representation name | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/rtr.py | RTR.dispatch_hook | def dispatch_hook(cls, _pkt=None, *args, **kargs):
'''
Attribution of correct type depending on version and pdu_type
'''
if _pkt and len(_pkt) >= 2:
version = orb(_pkt[0])
pdu_type = orb(_pkt[1])
if version == 0:
return PDU_CLASS_VERS... | python | def dispatch_hook(cls, _pkt=None, *args, **kargs):
'''
Attribution of correct type depending on version and pdu_type
'''
if _pkt and len(_pkt) >= 2:
version = orb(_pkt[0])
pdu_type = orb(_pkt[1])
if version == 0:
return PDU_CLASS_VERS... | [
"def",
"dispatch_hook",
"(",
"cls",
",",
"_pkt",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"if",
"_pkt",
"and",
"len",
"(",
"_pkt",
")",
">=",
"2",
":",
"version",
"=",
"orb",
"(",
"_pkt",
"[",
"0",
"]",
")",
"pdu_type",
... | Attribution of correct type depending on version and pdu_type | [
"Attribution",
"of",
"correct",
"type",
"depending",
"on",
"version",
"and",
"pdu_type"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/rtr.py#L322-L333 | train | This method is used to dispatch the event from the backend to the appropriate handler. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/as_resolvers.py | AS_resolver_cymru.parse | def parse(self, data):
"""Parse bulk cymru data"""
ASNlist = []
for line in data.splitlines()[1:]:
line = plain_str(line)
if "|" not in line:
continue
asn, ip, desc = [elt.strip() for elt in line.split('|')]
if asn == "NA":
... | python | def parse(self, data):
"""Parse bulk cymru data"""
ASNlist = []
for line in data.splitlines()[1:]:
line = plain_str(line)
if "|" not in line:
continue
asn, ip, desc = [elt.strip() for elt in line.split('|')]
if asn == "NA":
... | [
"def",
"parse",
"(",
"self",
",",
"data",
")",
":",
"ASNlist",
"=",
"[",
"]",
"for",
"line",
"in",
"data",
".",
"splitlines",
"(",
")",
"[",
"1",
":",
"]",
":",
"line",
"=",
"plain_str",
"(",
"line",
")",
"if",
"\"|\"",
"not",
"in",
"line",
":"... | Parse bulk cymru data | [
"Parse",
"bulk",
"cymru",
"data"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/as_resolvers.py#L102-L115 | train | Parse bulk cymru data | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/igmpv3.py | IGMPv3.encode_maxrespcode | def encode_maxrespcode(self):
"""Encode and replace the mrcode value to its IGMPv3 encoded time value if needed, # noqa: E501
as specified in rfc3376#section-4.1.1.
If value < 128, return the value specified. If >= 128, encode as a floating # noqa: E501
point value. Value can be 0 - 3... | python | def encode_maxrespcode(self):
"""Encode and replace the mrcode value to its IGMPv3 encoded time value if needed, # noqa: E501
as specified in rfc3376#section-4.1.1.
If value < 128, return the value specified. If >= 128, encode as a floating # noqa: E501
point value. Value can be 0 - 3... | [
"def",
"encode_maxrespcode",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"mrcode",
"if",
"value",
"<",
"128",
":",
"code",
"=",
"value",
"elif",
"value",
">",
"31743",
":",
"code",
"=",
"255",
"else",
":",
"exp",
"=",
"0",
"value",
">>=",
"3"... | Encode and replace the mrcode value to its IGMPv3 encoded time value if needed, # noqa: E501
as specified in rfc3376#section-4.1.1.
If value < 128, return the value specified. If >= 128, encode as a floating # noqa: E501
point value. Value can be 0 - 31744. | [
"Encode",
"and",
"replace",
"the",
"mrcode",
"value",
"to",
"its",
"IGMPv3",
"encoded",
"time",
"value",
"if",
"needed",
"#",
"noqa",
":",
"E501",
"as",
"specified",
"in",
"rfc3376#section",
"-",
"4",
".",
"1",
".",
"1",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/igmpv3.py#L74-L94 | train | Encode the mrcode value to its IGMPv3 encoded time value if needed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/lltd.py | _register_lltd_specific_class | def _register_lltd_specific_class(*attr_types):
"""This can be used as a class decorator; if we want to support Python
2.5, we have to replace
@_register_lltd_specific_class(x[, y[, ...]])
class LLTDAttributeSpecific(LLTDAttribute):
[...]
by
class LLTDAttributeSpecific(LLTDAttribute):
[...]
LLTDAttributeSpec... | python | def _register_lltd_specific_class(*attr_types):
"""This can be used as a class decorator; if we want to support Python
2.5, we have to replace
@_register_lltd_specific_class(x[, y[, ...]])
class LLTDAttributeSpecific(LLTDAttribute):
[...]
by
class LLTDAttributeSpecific(LLTDAttribute):
[...]
LLTDAttributeSpec... | [
"def",
"_register_lltd_specific_class",
"(",
"*",
"attr_types",
")",
":",
"def",
"_register",
"(",
"cls",
")",
":",
"for",
"attr_type",
"in",
"attr_types",
":",
"SPECIFIC_CLASSES",
"[",
"attr_type",
"]",
"=",
"cls",
"type_fld",
"=",
"LLTDAttribute",
".",
"fiel... | This can be used as a class decorator; if we want to support Python
2.5, we have to replace
@_register_lltd_specific_class(x[, y[, ...]])
class LLTDAttributeSpecific(LLTDAttribute):
[...]
by
class LLTDAttributeSpecific(LLTDAttribute):
[...]
LLTDAttributeSpecific = _register_lltd_specific_class(x[, y[, ...]])(
... | [
"This",
"can",
"be",
"used",
"as",
"a",
"class",
"decorator",
";",
"if",
"we",
"want",
"to",
"support",
"Python",
"2",
".",
"5",
"we",
"have",
"to",
"replace"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/lltd.py#L312-L336 | train | This is a class decorator that registers LLTDAttributeSpecific with the given list of attr_types. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/lltd.py | LargeTlvBuilder.parse | def parse(self, plist):
"""Update the builder using the provided `plist`. `plist` can
be either a Packet() or a PacketList().
"""
if not isinstance(plist, PacketList):
plist = PacketList(plist)
for pkt in plist[LLTD]:
if LLTDQueryLargeTlv in pkt:
... | python | def parse(self, plist):
"""Update the builder using the provided `plist`. `plist` can
be either a Packet() or a PacketList().
"""
if not isinstance(plist, PacketList):
plist = PacketList(plist)
for pkt in plist[LLTD]:
if LLTDQueryLargeTlv in pkt:
... | [
"def",
"parse",
"(",
"self",
",",
"plist",
")",
":",
"if",
"not",
"isinstance",
"(",
"plist",
",",
"PacketList",
")",
":",
"plist",
"=",
"PacketList",
"(",
"plist",
")",
"for",
"pkt",
"in",
"plist",
"[",
"LLTD",
"]",
":",
"if",
"LLTDQueryLargeTlv",
"... | Update the builder using the provided `plist`. `plist` can
be either a Packet() or a PacketList(). | [
"Update",
"the",
"builder",
"using",
"the",
"provided",
"plist",
".",
"plist",
"can",
"be",
"either",
"a",
"Packet",
"()",
"or",
"a",
"PacketList",
"()",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/lltd.py#L809-L836 | train | Update the builder using the provided plist. plist can be either a Packet or PacketList. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/lltd.py | LargeTlvBuilder.get_data | def get_data(self):
"""Returns a dictionary object, keys are strings "source >
destincation [content type]", and values are the content
fetched, also as a string.
"""
return {key: "".join(chr(byte) for byte in data)
for key, data in six.iteritems(self.data)} | python | def get_data(self):
"""Returns a dictionary object, keys are strings "source >
destincation [content type]", and values are the content
fetched, also as a string.
"""
return {key: "".join(chr(byte) for byte in data)
for key, data in six.iteritems(self.data)} | [
"def",
"get_data",
"(",
"self",
")",
":",
"return",
"{",
"key",
":",
"\"\"",
".",
"join",
"(",
"chr",
"(",
"byte",
")",
"for",
"byte",
"in",
"data",
")",
"for",
"key",
",",
"data",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"data",
")",
"... | Returns a dictionary object, keys are strings "source >
destincation [content type]", and values are the content
fetched, also as a string. | [
"Returns",
"a",
"dictionary",
"object",
"keys",
"are",
"strings",
"source",
">",
"destincation",
"[",
"content",
"type",
"]",
"and",
"values",
"are",
"the",
"content",
"fetched",
"also",
"as",
"a",
"string",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/lltd.py#L838-L845 | train | Returns a dictionary object containing the content type and the content type of the content. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/pton_ntop.py | _inet6_pton | def _inet6_pton(addr):
"""Convert an IPv6 address from text representation into binary form,
used when socket.inet_pton is not available.
"""
joker_pos = None
result = b""
addr = plain_str(addr)
if addr == '::':
return b'\x00' * 16
if addr.startswith('::'):
addr = addr[1:]
... | python | def _inet6_pton(addr):
"""Convert an IPv6 address from text representation into binary form,
used when socket.inet_pton is not available.
"""
joker_pos = None
result = b""
addr = plain_str(addr)
if addr == '::':
return b'\x00' * 16
if addr.startswith('::'):
addr = addr[1:]
... | [
"def",
"_inet6_pton",
"(",
"addr",
")",
":",
"joker_pos",
"=",
"None",
"result",
"=",
"b\"\"",
"addr",
"=",
"plain_str",
"(",
"addr",
")",
"if",
"addr",
"==",
"'::'",
":",
"return",
"b'\\x00'",
"*",
"16",
"if",
"addr",
".",
"startswith",
"(",
"'::'",
... | Convert an IPv6 address from text representation into binary form,
used when socket.inet_pton is not available. | [
"Convert",
"an",
"IPv6",
"address",
"from",
"text",
"representation",
"into",
"binary",
"form",
"used",
"when",
"socket",
".",
"inet_pton",
"is",
"not",
"available",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/pton_ntop.py#L24-L72 | train | Convert an IPv6 address from text representation into binary form. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/pton_ntop.py | inet_pton | def inet_pton(af, addr):
"""Convert an IP address from text representation into binary form."""
# Will replace Net/Net6 objects
addr = plain_str(addr)
# Use inet_pton if available
try:
return socket.inet_pton(af, addr)
except AttributeError:
try:
return _INET_PTON[af]... | python | def inet_pton(af, addr):
"""Convert an IP address from text representation into binary form."""
# Will replace Net/Net6 objects
addr = plain_str(addr)
# Use inet_pton if available
try:
return socket.inet_pton(af, addr)
except AttributeError:
try:
return _INET_PTON[af]... | [
"def",
"inet_pton",
"(",
"af",
",",
"addr",
")",
":",
"# Will replace Net/Net6 objects",
"addr",
"=",
"plain_str",
"(",
"addr",
")",
"# Use inet_pton if available",
"try",
":",
"return",
"socket",
".",
"inet_pton",
"(",
"af",
",",
"addr",
")",
"except",
"Attri... | Convert an IP address from text representation into binary form. | [
"Convert",
"an",
"IP",
"address",
"from",
"text",
"representation",
"into",
"binary",
"form",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/pton_ntop.py#L81-L92 | train | Convert an IP address from text representation into binary form. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/pton_ntop.py | _inet6_ntop | def _inet6_ntop(addr):
"""Convert an IPv6 address from binary form into text representation,
used when socket.inet_pton is not available.
"""
# IPv6 addresses have 128bits (16 bytes)
if len(addr) != 16:
raise ValueError("invalid length of packed IP address string")
# Decode to hex represen... | python | def _inet6_ntop(addr):
"""Convert an IPv6 address from binary form into text representation,
used when socket.inet_pton is not available.
"""
# IPv6 addresses have 128bits (16 bytes)
if len(addr) != 16:
raise ValueError("invalid length of packed IP address string")
# Decode to hex represen... | [
"def",
"_inet6_ntop",
"(",
"addr",
")",
":",
"# IPv6 addresses have 128bits (16 bytes)",
"if",
"len",
"(",
"addr",
")",
"!=",
"16",
":",
"raise",
"ValueError",
"(",
"\"invalid length of packed IP address string\"",
")",
"# Decode to hex representation",
"address",
"=",
... | Convert an IPv6 address from binary form into text representation,
used when socket.inet_pton is not available. | [
"Convert",
"an",
"IPv6",
"address",
"from",
"binary",
"form",
"into",
"text",
"representation",
"used",
"when",
"socket",
".",
"inet_pton",
"is",
"not",
"available",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/pton_ntop.py#L95-L118 | train | Convert an IPv6 address from binary form into text representation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/pton_ntop.py | inet_ntop | def inet_ntop(af, addr):
"""Convert an IP address from binary form into text representation."""
# Use inet_ntop if available
addr = bytes_encode(addr)
try:
return socket.inet_ntop(af, addr)
except AttributeError:
try:
return _INET_NTOP[af](addr)
except KeyError:
... | python | def inet_ntop(af, addr):
"""Convert an IP address from binary form into text representation."""
# Use inet_ntop if available
addr = bytes_encode(addr)
try:
return socket.inet_ntop(af, addr)
except AttributeError:
try:
return _INET_NTOP[af](addr)
except KeyError:
... | [
"def",
"inet_ntop",
"(",
"af",
",",
"addr",
")",
":",
"# Use inet_ntop if available",
"addr",
"=",
"bytes_encode",
"(",
"addr",
")",
"try",
":",
"return",
"socket",
".",
"inet_ntop",
"(",
"af",
",",
"addr",
")",
"except",
"AttributeError",
":",
"try",
":",... | Convert an IP address from binary form into text representation. | [
"Convert",
"an",
"IP",
"address",
"from",
"binary",
"form",
"into",
"text",
"representation",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/pton_ntop.py#L127-L137 | train | Convert an IP address from binary form into text representation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/pcapdnet.py | _L2pcapdnetSocket.recv_raw | def recv_raw(self, x=MTU):
"""Receives a packet, then returns a tuple containing (cls, pkt_data, time)""" # noqa: E501
ll = self.ins.datalink()
if ll in conf.l2types:
cls = conf.l2types[ll]
else:
cls = conf.default_l2
warning("Unable to guess datalink... | python | def recv_raw(self, x=MTU):
"""Receives a packet, then returns a tuple containing (cls, pkt_data, time)""" # noqa: E501
ll = self.ins.datalink()
if ll in conf.l2types:
cls = conf.l2types[ll]
else:
cls = conf.default_l2
warning("Unable to guess datalink... | [
"def",
"recv_raw",
"(",
"self",
",",
"x",
"=",
"MTU",
")",
":",
"# noqa: E501",
"ll",
"=",
"self",
".",
"ins",
".",
"datalink",
"(",
")",
"if",
"ll",
"in",
"conf",
".",
"l2types",
":",
"cls",
"=",
"conf",
".",
"l2types",
"[",
"ll",
"]",
"else",
... | Receives a packet, then returns a tuple containing (cls, pkt_data, time) | [
"Receives",
"a",
"packet",
"then",
"returns",
"a",
"tuple",
"containing",
"(",
"cls",
"pkt_data",
"time",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/pcapdnet.py#L46-L65 | train | Receives a packet then returns a tuple containing cls pkt_data time | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/pcapdnet.py | _L2pcapdnetSocket.nonblock_recv | def nonblock_recv(self):
"""Receives and dissect a packet in non-blocking mode.
Note: on Windows, this won't do anything."""
self.ins.setnonblock(1)
p = self.recv(MTU)
self.ins.setnonblock(0)
return p | python | def nonblock_recv(self):
"""Receives and dissect a packet in non-blocking mode.
Note: on Windows, this won't do anything."""
self.ins.setnonblock(1)
p = self.recv(MTU)
self.ins.setnonblock(0)
return p | [
"def",
"nonblock_recv",
"(",
"self",
")",
":",
"self",
".",
"ins",
".",
"setnonblock",
"(",
"1",
")",
"p",
"=",
"self",
".",
"recv",
"(",
"MTU",
")",
"self",
".",
"ins",
".",
"setnonblock",
"(",
"0",
")",
"return",
"p"
] | Receives and dissect a packet in non-blocking mode.
Note: on Windows, this won't do anything. | [
"Receives",
"and",
"dissect",
"a",
"packet",
"in",
"non",
"-",
"blocking",
"mode",
".",
"Note",
":",
"on",
"Windows",
"this",
"won",
"t",
"do",
"anything",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/pcapdnet.py#L67-L73 | train | Receives and dissects a packet in non - blocking mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/route.py | Route.delt | def delt(self, *args, **kargs):
"""delt(host|net, gw|dev)"""
self.invalidate_cache()
route = self.make_route(*args, **kargs)
try:
i = self.routes.index(route)
del(self.routes[i])
except ValueError:
warning("no matching route found") | python | def delt(self, *args, **kargs):
"""delt(host|net, gw|dev)"""
self.invalidate_cache()
route = self.make_route(*args, **kargs)
try:
i = self.routes.index(route)
del(self.routes[i])
except ValueError:
warning("no matching route found") | [
"def",
"delt",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"self",
".",
"invalidate_cache",
"(",
")",
"route",
"=",
"self",
".",
"make_route",
"(",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
"try",
":",
"i",
"=",
"self",
"."... | delt(host|net, gw|dev) | [
"delt",
"(",
"host|net",
"gw|dev",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/route.py#L78-L86 | train | delt - Delete a single entry from the cache | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/route.py | Route.route | def route(self, dst=None, verbose=conf.verb):
"""Returns the IPv4 routes to a host.
parameters:
- dst: the IPv4 of the destination host
returns: (iface, output_ip, gateway_ip)
- iface: the interface used to connect to the host
- output_ip: the outgoing IP that will be... | python | def route(self, dst=None, verbose=conf.verb):
"""Returns the IPv4 routes to a host.
parameters:
- dst: the IPv4 of the destination host
returns: (iface, output_ip, gateway_ip)
- iface: the interface used to connect to the host
- output_ip: the outgoing IP that will be... | [
"def",
"route",
"(",
"self",
",",
"dst",
"=",
"None",
",",
"verbose",
"=",
"conf",
".",
"verb",
")",
":",
"dst",
"=",
"dst",
"or",
"\"0.0.0.0\"",
"# Enable route(None) to return default route",
"if",
"isinstance",
"(",
"dst",
",",
"bytes",
")",
":",
"try",... | Returns the IPv4 routes to a host.
parameters:
- dst: the IPv4 of the destination host
returns: (iface, output_ip, gateway_ip)
- iface: the interface used to connect to the host
- output_ip: the outgoing IP that will be used
- gateway_ip: the gateway IP that will be ... | [
"Returns",
"the",
"IPv4",
"routes",
"to",
"a",
"host",
".",
"parameters",
":",
"-",
"dst",
":",
"the",
"IPv4",
"of",
"the",
"destination",
"host"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/route.py#L128-L178 | train | Returns the IPv4 routes to a destination host. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/native.py | open_icmp_firewall | def open_icmp_firewall(host):
"""Temporarily open the ICMP firewall. Tricks Windows into allowing
ICMP packets for a short period of time (~ 1 minute)"""
# We call ping with a timeout of 1ms: will return instantly
with open(os.devnull, 'wb') as DEVNULL:
return subprocess.Popen("ping -4 -w 1 -n 1... | python | def open_icmp_firewall(host):
"""Temporarily open the ICMP firewall. Tricks Windows into allowing
ICMP packets for a short period of time (~ 1 minute)"""
# We call ping with a timeout of 1ms: will return instantly
with open(os.devnull, 'wb') as DEVNULL:
return subprocess.Popen("ping -4 -w 1 -n 1... | [
"def",
"open_icmp_firewall",
"(",
"host",
")",
":",
"# We call ping with a timeout of 1ms: will return instantly",
"with",
"open",
"(",
"os",
".",
"devnull",
",",
"'wb'",
")",
"as",
"DEVNULL",
":",
"return",
"subprocess",
".",
"Popen",
"(",
"\"ping -4 -w 1 -n 1 %s\"",... | Temporarily open the ICMP firewall. Tricks Windows into allowing
ICMP packets for a short period of time (~ 1 minute) | [
"Temporarily",
"open",
"the",
"ICMP",
"firewall",
".",
"Tricks",
"Windows",
"into",
"allowing",
"ICMP",
"packets",
"for",
"a",
"short",
"period",
"of",
"time",
"(",
"~",
"1",
"minute",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/native.py#L203-L211 | train | Temporarily open the ICMP firewall. Tricks Windows into allowing the ICMP packets for a short period of time. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/handshake.py | TLSClientHello.tls_session_update | def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the client_random
along with the raw string representing this handshake message.
"""
super(TLSClientHello, self).tls_session_update(msg_str)
self.tls_session.advertised_tls_version = self... | python | def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the client_random
along with the raw string representing this handshake message.
"""
super(TLSClientHello, self).tls_session_update(msg_str)
self.tls_session.advertised_tls_version = self... | [
"def",
"tls_session_update",
"(",
"self",
",",
"msg_str",
")",
":",
"super",
"(",
"TLSClientHello",
",",
"self",
")",
".",
"tls_session_update",
"(",
"msg_str",
")",
"self",
".",
"tls_session",
".",
"advertised_tls_version",
"=",
"self",
".",
"version",
"self"... | Either for parsing or building, we store the client_random
along with the raw string representing this handshake message. | [
"Either",
"for",
"parsing",
"or",
"building",
"we",
"store",
"the",
"client_random",
"along",
"with",
"the",
"raw",
"string",
"representing",
"this",
"handshake",
"message",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/handshake.py#L280-L298 | train | Update the internal state of the TLS session. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/handshake.py | TLSServerHello.tls_session_update | def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the server_random
along with the raw string representing this handshake message.
We also store the session_id, the cipher suite (if recognized),
the compression method, and finally we instantiate ... | python | def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the server_random
along with the raw string representing this handshake message.
We also store the session_id, the cipher suite (if recognized),
the compression method, and finally we instantiate ... | [
"def",
"tls_session_update",
"(",
"self",
",",
"msg_str",
")",
":",
"super",
"(",
"TLSClientHello",
",",
"self",
")",
".",
"tls_session_update",
"(",
"msg_str",
")",
"self",
".",
"tls_session",
".",
"tls_version",
"=",
"self",
".",
"version",
"self",
".",
... | Either for parsing or building, we store the server_random
along with the raw string representing this handshake message.
We also store the session_id, the cipher suite (if recognized),
the compression method, and finally we instantiate the pending write
and read connection states. Usual... | [
"Either",
"for",
"parsing",
"or",
"building",
"we",
"store",
"the",
"server_random",
"along",
"with",
"the",
"raw",
"string",
"representing",
"this",
"handshake",
"message",
".",
"We",
"also",
"store",
"the",
"session_id",
"the",
"cipher",
"suite",
"(",
"if",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/handshake.py#L354-L399 | train | This method is called by the server side to update the TLS session state. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/handshake.py | TLS13ServerHello.tls_session_update | def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the server_random along with
the raw string representing this handshake message. We also store the
cipher suite (if recognized), and finally we instantiate the write and
read connection states.
... | python | def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the server_random along with
the raw string representing this handshake message. We also store the
cipher suite (if recognized), and finally we instantiate the write and
read connection states.
... | [
"def",
"tls_session_update",
"(",
"self",
",",
"msg_str",
")",
":",
"super",
"(",
"TLSClientHello",
",",
"self",
")",
".",
"tls_session_update",
"(",
"msg_str",
")",
"s",
"=",
"self",
".",
"tls_session",
"s",
".",
"tls_version",
"=",
"self",
".",
"version"... | Either for parsing or building, we store the server_random along with
the raw string representing this handshake message. We also store the
cipher suite (if recognized), and finally we instantiate the write and
read connection states. | [
"Either",
"for",
"parsing",
"or",
"building",
"we",
"store",
"the",
"server_random",
"along",
"with",
"the",
"raw",
"string",
"representing",
"this",
"handshake",
"message",
".",
"We",
"also",
"store",
"the",
"cipher",
"suite",
"(",
"if",
"recognized",
")",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/handshake.py#L415-L451 | train | Update the TLS session with the message string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/handshake.py | TLSServerKeyExchange.build | def build(self, *args, **kargs):
"""
We overload build() method in order to provide a valid default value
for params based on TLS session if not provided. This cannot be done by
overriding i2m() because the method is called on a copy of the packet.
The 'params' field is built ac... | python | def build(self, *args, **kargs):
"""
We overload build() method in order to provide a valid default value
for params based on TLS session if not provided. This cannot be done by
overriding i2m() because the method is called on a copy of the packet.
The 'params' field is built ac... | [
"def",
"build",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"fval",
"=",
"self",
".",
"getfieldval",
"(",
"\"params\"",
")",
"if",
"fval",
"is",
"None",
":",
"s",
"=",
"self",
".",
"tls_session",
"if",
"s",
".",
"pwcs",
":",
... | We overload build() method in order to provide a valid default value
for params based on TLS session if not provided. This cannot be done by
overriding i2m() because the method is called on a copy of the packet.
The 'params' field is built according to key_exchange.server_kx_msg_cls
whi... | [
"We",
"overload",
"build",
"()",
"method",
"in",
"order",
"to",
"provide",
"a",
"valid",
"default",
"value",
"for",
"params",
"based",
"on",
"TLS",
"session",
"if",
"not",
"provided",
".",
"This",
"cannot",
"be",
"done",
"by",
"overriding",
"i2m",
"()",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/handshake.py#L689-L746 | train | Build the message with the appropriate parameters. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/handshake.py | TLSServerKeyExchange.post_dissection | def post_dissection(self, pkt):
"""
While previously dissecting Server*DHParams, the session
server_kx_pubkey should have been updated.
XXX Add a 'fixed_dh' OR condition to the 'anonymous' test.
"""
s = self.tls_session
if s.prcs and s.prcs.key_exchange.no_ske:
... | python | def post_dissection(self, pkt):
"""
While previously dissecting Server*DHParams, the session
server_kx_pubkey should have been updated.
XXX Add a 'fixed_dh' OR condition to the 'anonymous' test.
"""
s = self.tls_session
if s.prcs and s.prcs.key_exchange.no_ske:
... | [
"def",
"post_dissection",
"(",
"self",
",",
"pkt",
")",
":",
"s",
"=",
"self",
".",
"tls_session",
"if",
"s",
".",
"prcs",
"and",
"s",
".",
"prcs",
".",
"key_exchange",
".",
"no_ske",
":",
"pkt_info",
"=",
"pkt",
".",
"firstlayer",
"(",
")",
".",
"... | While previously dissecting Server*DHParams, the session
server_kx_pubkey should have been updated.
XXX Add a 'fixed_dh' OR condition to the 'anonymous' test. | [
"While",
"previously",
"dissecting",
"Server",
"*",
"DHParams",
"the",
"session",
"server_kx_pubkey",
"should",
"have",
"been",
"updated",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/handshake.py#L748-L767 | train | Check if the server_kx_pubkey is valid and verify the server_kx_pubkey. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/handshake.py | _TLSCKExchKeysField.m2i | def m2i(self, pkt, m):
"""
The client_kx_msg may be either None, EncryptedPreMasterSecret
(for RSA encryption key exchange), ClientDiffieHellmanPublic,
or ClientECDiffieHellmanPublic. When either one of them gets
dissected, the session context is updated accordingly.
"""
... | python | def m2i(self, pkt, m):
"""
The client_kx_msg may be either None, EncryptedPreMasterSecret
(for RSA encryption key exchange), ClientDiffieHellmanPublic,
or ClientECDiffieHellmanPublic. When either one of them gets
dissected, the session context is updated accordingly.
"""
... | [
"def",
"m2i",
"(",
"self",
",",
"pkt",
",",
"m",
")",
":",
"tmp_len",
"=",
"self",
".",
"length_from",
"(",
"pkt",
")",
"tbd",
",",
"rem",
"=",
"m",
"[",
":",
"tmp_len",
"]",
",",
"m",
"[",
"tmp_len",
":",
"]",
"s",
"=",
"pkt",
".",
"tls_sess... | The client_kx_msg may be either None, EncryptedPreMasterSecret
(for RSA encryption key exchange), ClientDiffieHellmanPublic,
or ClientECDiffieHellmanPublic. When either one of them gets
dissected, the session context is updated accordingly. | [
"The",
"client_kx_msg",
"may",
"be",
"either",
"None",
"EncryptedPreMasterSecret",
"(",
"for",
"RSA",
"encryption",
"key",
"exchange",
")",
"ClientDiffieHellmanPublic",
"or",
"ClientECDiffieHellmanPublic",
".",
"When",
"either",
"one",
"of",
"them",
"gets",
"dissected... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/handshake.py#L923-L942 | train | Convert a client_kx_msg to an internal representation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/modules/nmap.py | nmap_fp | def nmap_fp(target, oport=80, cport=81):
"""nmap fingerprinting
nmap_fp(target, [oport=80,] [cport=81,]) -> list of best guesses with accuracy
"""
sigs = nmap_sig(target, oport, cport)
return nmap_search(sigs) | python | def nmap_fp(target, oport=80, cport=81):
"""nmap fingerprinting
nmap_fp(target, [oport=80,] [cport=81,]) -> list of best guesses with accuracy
"""
sigs = nmap_sig(target, oport, cport)
return nmap_search(sigs) | [
"def",
"nmap_fp",
"(",
"target",
",",
"oport",
"=",
"80",
",",
"cport",
"=",
"81",
")",
":",
"sigs",
"=",
"nmap_sig",
"(",
"target",
",",
"oport",
",",
"cport",
")",
"return",
"nmap_search",
"(",
"sigs",
")"
] | nmap fingerprinting
nmap_fp(target, [oport=80,] [cport=81,]) -> list of best guesses with accuracy | [
"nmap",
"fingerprinting",
"nmap_fp",
"(",
"target",
"[",
"oport",
"=",
"80",
"]",
"[",
"cport",
"=",
"81",
"]",
")",
"-",
">",
"list",
"of",
"best",
"guesses",
"with",
"accuracy"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/nmap.py#L198-L203 | train | nmap fingerprinting
nmap_fp - return a list of best guesses with accuracy
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | process_kwargs | def process_kwargs(obj, kwargs):
'''
Convenience wrapper around binwalk.core.module.Modules.kwargs.
@obj - The class object (an instance of a sub-class of binwalk.core.module.Module).
@kwargs - The kwargs provided to the object's __init__ method.
Returns None.
'''
with Modules() as m:
... | python | def process_kwargs(obj, kwargs):
'''
Convenience wrapper around binwalk.core.module.Modules.kwargs.
@obj - The class object (an instance of a sub-class of binwalk.core.module.Module).
@kwargs - The kwargs provided to the object's __init__ method.
Returns None.
'''
with Modules() as m:
... | [
"def",
"process_kwargs",
"(",
"obj",
",",
"kwargs",
")",
":",
"with",
"Modules",
"(",
")",
"as",
"m",
":",
"kwargs",
"=",
"m",
".",
"kwargs",
"(",
"obj",
",",
"kwargs",
")",
"return",
"kwargs"
] | Convenience wrapper around binwalk.core.module.Modules.kwargs.
@obj - The class object (an instance of a sub-class of binwalk.core.module.Module).
@kwargs - The kwargs provided to the object's __init__ method.
Returns None. | [
"Convenience",
"wrapper",
"around",
"binwalk",
".",
"core",
".",
"module",
".",
"Modules",
".",
"kwargs",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L996-L1007 | train | Wrapper around binwalk. core. module. Modules. kwargs.
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | show_help | def show_help(fd=sys.stdout):
'''
Convenience wrapper around binwalk.core.module.Modules.help.
@fd - An object with a write method (e.g., sys.stdout, sys.stderr, etc).
Returns None.
'''
with Modules() as m:
fd.write(m.help()) | python | def show_help(fd=sys.stdout):
'''
Convenience wrapper around binwalk.core.module.Modules.help.
@fd - An object with a write method (e.g., sys.stdout, sys.stderr, etc).
Returns None.
'''
with Modules() as m:
fd.write(m.help()) | [
"def",
"show_help",
"(",
"fd",
"=",
"sys",
".",
"stdout",
")",
":",
"with",
"Modules",
"(",
")",
"as",
"m",
":",
"fd",
".",
"write",
"(",
"m",
".",
"help",
"(",
")",
")"
] | Convenience wrapper around binwalk.core.module.Modules.help.
@fd - An object with a write method (e.g., sys.stdout, sys.stderr, etc).
Returns None. | [
"Convenience",
"wrapper",
"around",
"binwalk",
".",
"core",
".",
"module",
".",
"Modules",
".",
"help",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L1010-L1019 | train | A convenience wrapper around binwalk. core. module. Modules. help. show_help | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Module.next_file | def next_file(self, close_previous=True):
'''
Gets the next file to be scanned (including pending extracted files, if applicable).
Also re/initializes self.status.
All modules should access the target file list through this method.
'''
fp = None
# Ensure files ar... | python | def next_file(self, close_previous=True):
'''
Gets the next file to be scanned (including pending extracted files, if applicable).
Also re/initializes self.status.
All modules should access the target file list through this method.
'''
fp = None
# Ensure files ar... | [
"def",
"next_file",
"(",
"self",
",",
"close_previous",
"=",
"True",
")",
":",
"fp",
"=",
"None",
"# Ensure files are close to prevent IOError (too many open files)",
"if",
"close_previous",
":",
"try",
":",
"self",
".",
"previous_next_file_fp",
".",
"close",
"(",
"... | Gets the next file to be scanned (including pending extracted files, if applicable).
Also re/initializes self.status.
All modules should access the target file list through this method. | [
"Gets",
"the",
"next",
"file",
"to",
"be",
"scanned",
"(",
"including",
"pending",
"extracted",
"files",
"if",
"applicable",
")",
".",
"Also",
"re",
"/",
"initializes",
"self",
".",
"status",
".",
"All",
"modules",
"should",
"access",
"the",
"target",
"fil... | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L386-L447 | train | Gets the next file to be scanned. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Module.clear | def clear(self, results=True, errors=True):
'''
Clears results and errors lists.
'''
if results:
self.results = []
if errors:
self.errors = [] | python | def clear(self, results=True, errors=True):
'''
Clears results and errors lists.
'''
if results:
self.results = []
if errors:
self.errors = [] | [
"def",
"clear",
"(",
"self",
",",
"results",
"=",
"True",
",",
"errors",
"=",
"True",
")",
":",
"if",
"results",
":",
"self",
".",
"results",
"=",
"[",
"]",
"if",
"errors",
":",
"self",
".",
"errors",
"=",
"[",
"]"
] | Clears results and errors lists. | [
"Clears",
"results",
"and",
"errors",
"lists",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L449-L456 | train | Clears the results and errors lists. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Module.result | def result(self, r=None, **kwargs):
'''
Validates a result, stores it in self.results and prints it.
Accepts the same kwargs as the binwalk.core.module.Result class.
@r - An existing instance of binwalk.core.module.Result.
Returns an instance of binwalk.core.module.Result.
... | python | def result(self, r=None, **kwargs):
'''
Validates a result, stores it in self.results and prints it.
Accepts the same kwargs as the binwalk.core.module.Result class.
@r - An existing instance of binwalk.core.module.Result.
Returns an instance of binwalk.core.module.Result.
... | [
"def",
"result",
"(",
"self",
",",
"r",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"r",
"is",
"None",
":",
"r",
"=",
"Result",
"(",
"*",
"*",
"kwargs",
")",
"# Add the name of the current module to the result",
"r",
".",
"module",
"=",
"self... | Validates a result, stores it in self.results and prints it.
Accepts the same kwargs as the binwalk.core.module.Result class.
@r - An existing instance of binwalk.core.module.Result.
Returns an instance of binwalk.core.module.Result. | [
"Validates",
"a",
"result",
"stores",
"it",
"in",
"self",
".",
"results",
"and",
"prints",
"it",
".",
"Accepts",
"the",
"same",
"kwargs",
"as",
"the",
"binwalk",
".",
"core",
".",
"module",
".",
"Result",
"class",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L458-L503 | train | Validates a result stores it in self. results and prints it. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Module.error | def error(self, **kwargs):
'''
Stores the specified error in self.errors.
Accepts the same kwargs as the binwalk.core.module.Error class.
Returns None.
'''
exception_header_width = 100
e = Error(**kwargs)
e.module = self.__class__.__name__
self... | python | def error(self, **kwargs):
'''
Stores the specified error in self.errors.
Accepts the same kwargs as the binwalk.core.module.Error class.
Returns None.
'''
exception_header_width = 100
e = Error(**kwargs)
e.module = self.__class__.__name__
self... | [
"def",
"error",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"exception_header_width",
"=",
"100",
"e",
"=",
"Error",
"(",
"*",
"*",
"kwargs",
")",
"e",
".",
"module",
"=",
"self",
".",
"__class__",
".",
"__name__",
"self",
".",
"errors",
".",
"... | Stores the specified error in self.errors.
Accepts the same kwargs as the binwalk.core.module.Error class.
Returns None. | [
"Stores",
"the",
"specified",
"error",
"in",
"self",
".",
"errors",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L505-L526 | train | Stores the specified error in self. errors. A new error is created and the specified kwargs are passed to the Error class. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Module.header | def header(self):
'''
Displays the scan header, as defined by self.HEADER and self.HEADER_FORMAT.
Returns None.
'''
self.config.display.format_strings(self.HEADER_FORMAT, self.RESULT_FORMAT)
self.config.display.add_custom_header(self.VERBOSE_FORMAT, self.VERBOSE)
... | python | def header(self):
'''
Displays the scan header, as defined by self.HEADER and self.HEADER_FORMAT.
Returns None.
'''
self.config.display.format_strings(self.HEADER_FORMAT, self.RESULT_FORMAT)
self.config.display.add_custom_header(self.VERBOSE_FORMAT, self.VERBOSE)
... | [
"def",
"header",
"(",
"self",
")",
":",
"self",
".",
"config",
".",
"display",
".",
"format_strings",
"(",
"self",
".",
"HEADER_FORMAT",
",",
"self",
".",
"RESULT_FORMAT",
")",
"self",
".",
"config",
".",
"display",
".",
"add_custom_header",
"(",
"self",
... | Displays the scan header, as defined by self.HEADER and self.HEADER_FORMAT.
Returns None. | [
"Displays",
"the",
"scan",
"header",
"as",
"defined",
"by",
"self",
".",
"HEADER",
"and",
"self",
".",
"HEADER_FORMAT",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L528-L540 | train | Displays the scan header as defined by self. HEADER and self. HEADER_FORMAT.
Returns None. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Module.main | def main(self):
'''
Responsible for calling self.init, initializing self.config.display, and calling self.run.
Returns the value returned from self.run.
'''
self.status = self.parent.status
self.modules = self.parent.executed_modules
# A special exception for th... | python | def main(self):
'''
Responsible for calling self.init, initializing self.config.display, and calling self.run.
Returns the value returned from self.run.
'''
self.status = self.parent.status
self.modules = self.parent.executed_modules
# A special exception for th... | [
"def",
"main",
"(",
"self",
")",
":",
"self",
".",
"status",
"=",
"self",
".",
"parent",
".",
"status",
"self",
".",
"modules",
"=",
"self",
".",
"parent",
".",
"executed_modules",
"# A special exception for the extractor module, which should be allowed to",
"# over... | Responsible for calling self.init, initializing self.config.display, and calling self.run.
Returns the value returned from self.run. | [
"Responsible",
"for",
"calling",
"self",
".",
"init",
"initializing",
"self",
".",
"config",
".",
"display",
"and",
"calling",
"self",
".",
"run",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L556-L605 | train | Main entry point for the base class. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Modules.list | def list(self, attribute="run"):
'''
Finds all modules with the specified attribute.
@attribute - The desired module attribute.
Returns a list of modules that contain the specified attribute, in the order they should be executed.
'''
import binwalk.modules
modul... | python | def list(self, attribute="run"):
'''
Finds all modules with the specified attribute.
@attribute - The desired module attribute.
Returns a list of modules that contain the specified attribute, in the order they should be executed.
'''
import binwalk.modules
modul... | [
"def",
"list",
"(",
"self",
",",
"attribute",
"=",
"\"run\"",
")",
":",
"import",
"binwalk",
".",
"modules",
"modules",
"=",
"{",
"}",
"for",
"(",
"name",
",",
"module",
")",
"in",
"inspect",
".",
"getmembers",
"(",
"binwalk",
".",
"modules",
")",
":... | Finds all modules with the specified attribute.
@attribute - The desired module attribute.
Returns a list of modules that contain the specified attribute, in the order they should be executed. | [
"Finds",
"all",
"modules",
"with",
"the",
"specified",
"attribute",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L692-L725 | train | Returns a list of modules that contain the specified attribute. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Modules.help | def help(self):
'''
Generates formatted help output.
Returns the help string.
'''
modules = {}
help_string = "\n"
help_string += "Binwalk v%s\n" % binwalk.__version__
help_string += "Craig Heffner, ReFirmLabs\n"
help_string += "https://github.com/... | python | def help(self):
'''
Generates formatted help output.
Returns the help string.
'''
modules = {}
help_string = "\n"
help_string += "Binwalk v%s\n" % binwalk.__version__
help_string += "Craig Heffner, ReFirmLabs\n"
help_string += "https://github.com/... | [
"def",
"help",
"(",
"self",
")",
":",
"modules",
"=",
"{",
"}",
"help_string",
"=",
"\"\\n\"",
"help_string",
"+=",
"\"Binwalk v%s\\n\"",
"%",
"binwalk",
".",
"__version__",
"help_string",
"+=",
"\"Craig Heffner, ReFirmLabs\\n\"",
"help_string",
"+=",
"\"https://git... | Generates formatted help output.
Returns the help string. | [
"Generates",
"formatted",
"help",
"output",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L727-L768 | train | Generates formatted help output. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Modules.execute | def execute(self, *args, **kwargs):
'''
Executes all appropriate modules according to the options specified in args/kwargs.
Returns a list of executed module objects.
'''
run_modules = []
orig_arguments = self.arguments
if args or kwargs:
self._set_a... | python | def execute(self, *args, **kwargs):
'''
Executes all appropriate modules according to the options specified in args/kwargs.
Returns a list of executed module objects.
'''
run_modules = []
orig_arguments = self.arguments
if args or kwargs:
self._set_a... | [
"def",
"execute",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"run_modules",
"=",
"[",
"]",
"orig_arguments",
"=",
"self",
".",
"arguments",
"if",
"args",
"or",
"kwargs",
":",
"self",
".",
"_set_arguments",
"(",
"list",
"(",
"ar... | Executes all appropriate modules according to the options specified in args/kwargs.
Returns a list of executed module objects. | [
"Executes",
"all",
"appropriate",
"modules",
"according",
"to",
"the",
"options",
"specified",
"in",
"args",
"/",
"kwargs",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L770-L796 | train | Executes all appropriate modules according to the options specified in args or kwargs. Returns a list of module objects that were executed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Modules.run | def run(self, module, dependency=False, kwargs={}):
'''
Runs a specific module.
'''
try:
obj = self.load(module, kwargs)
if isinstance(obj, binwalk.core.module.Module) and obj.enabled:
obj.main()
self.status.clear()
# ... | python | def run(self, module, dependency=False, kwargs={}):
'''
Runs a specific module.
'''
try:
obj = self.load(module, kwargs)
if isinstance(obj, binwalk.core.module.Module) and obj.enabled:
obj.main()
self.status.clear()
# ... | [
"def",
"run",
"(",
"self",
",",
"module",
",",
"dependency",
"=",
"False",
",",
"kwargs",
"=",
"{",
"}",
")",
":",
"try",
":",
"obj",
"=",
"self",
".",
"load",
"(",
"module",
",",
"kwargs",
")",
"if",
"isinstance",
"(",
"obj",
",",
"binwalk",
"."... | Runs a specific module. | [
"Runs",
"a",
"specific",
"module",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L798-L829 | train | Runs a specific module. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Modules.argv | def argv(self, module, argv=sys.argv[1:]):
'''
Processes argv for any options specific to the specified module.
@module - The module to process argv for.
@argv - A list of command line arguments (excluding argv[0]).
Returns a dictionary of kwargs for the specified module.
... | python | def argv(self, module, argv=sys.argv[1:]):
'''
Processes argv for any options specific to the specified module.
@module - The module to process argv for.
@argv - A list of command line arguments (excluding argv[0]).
Returns a dictionary of kwargs for the specified module.
... | [
"def",
"argv",
"(",
"self",
",",
"module",
",",
"argv",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
")",
":",
"kwargs",
"=",
"{",
"'enabled'",
":",
"False",
"}",
"last_priority",
"=",
"{",
"}",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"("... | Processes argv for any options specific to the specified module.
@module - The module to process argv for.
@argv - A list of command line arguments (excluding argv[0]).
Returns a dictionary of kwargs for the specified module. | [
"Processes",
"argv",
"for",
"any",
"options",
"specific",
"to",
"the",
"specified",
"module",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L872-L953 | train | Process the command line arguments for any specific module. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Modules.kwargs | def kwargs(self, obj, kwargs):
'''
Processes a module's kwargs. All modules should use this for kwarg processing.
@obj - An instance of the module (e.g., self)
@kwargs - The kwargs passed to the module
Returns None.
'''
if hasattr(obj, "KWARGS"):
... | python | def kwargs(self, obj, kwargs):
'''
Processes a module's kwargs. All modules should use this for kwarg processing.
@obj - An instance of the module (e.g., self)
@kwargs - The kwargs passed to the module
Returns None.
'''
if hasattr(obj, "KWARGS"):
... | [
"def",
"kwargs",
"(",
"self",
",",
"obj",
",",
"kwargs",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"\"KWARGS\"",
")",
":",
"for",
"module_argument",
"in",
"obj",
".",
"KWARGS",
":",
"if",
"has_key",
"(",
"kwargs",
",",
"module_argument",
".",
"name",... | Processes a module's kwargs. All modules should use this for kwarg processing.
@obj - An instance of the module (e.g., self)
@kwargs - The kwargs passed to the module
Returns None. | [
"Processes",
"a",
"module",
"s",
"kwargs",
".",
"All",
"modules",
"should",
"use",
"this",
"for",
"kwarg",
"processing",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L955-L977 | train | Processes a module s kwargs. All modules should use this for kwarg processing. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/module.py | Modules.status_server | def status_server(self, port):
'''
Starts the progress bar TCP service on the specified port.
This service will only be started once per instance, regardless of the
number of times this method is invoked.
Failure to start the status service is considered non-critical; that is,
... | python | def status_server(self, port):
'''
Starts the progress bar TCP service on the specified port.
This service will only be started once per instance, regardless of the
number of times this method is invoked.
Failure to start the status service is considered non-critical; that is,
... | [
"def",
"status_server",
"(",
"self",
",",
"port",
")",
":",
"if",
"self",
".",
"status_server_started",
"==",
"False",
":",
"self",
".",
"status_server_started",
"=",
"True",
"try",
":",
"self",
".",
"status_service",
"=",
"binwalk",
".",
"core",
".",
"sta... | Starts the progress bar TCP service on the specified port.
This service will only be started once per instance, regardless of the
number of times this method is invoked.
Failure to start the status service is considered non-critical; that is,
a warning will be displayed to the user, but... | [
"Starts",
"the",
"progress",
"bar",
"TCP",
"service",
"on",
"the",
"specified",
"port",
".",
"This",
"service",
"will",
"only",
"be",
"started",
"once",
"per",
"instance",
"regardless",
"of",
"the",
"number",
"of",
"times",
"this",
"method",
"is",
"invoked",... | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/module.py#L979-L993 | train | Starts the status server on the specified port. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/plugins/unpfs.py | PFSCommon._make_short | def _make_short(self, data, endianness):
"""Returns a 2 byte integer."""
data = binwalk.core.compat.str2bytes(data)
return struct.unpack('%sH' % endianness, data)[0] | python | def _make_short(self, data, endianness):
"""Returns a 2 byte integer."""
data = binwalk.core.compat.str2bytes(data)
return struct.unpack('%sH' % endianness, data)[0] | [
"def",
"_make_short",
"(",
"self",
",",
"data",
",",
"endianness",
")",
":",
"data",
"=",
"binwalk",
".",
"core",
".",
"compat",
".",
"str2bytes",
"(",
"data",
")",
"return",
"struct",
".",
"unpack",
"(",
"'%sH'",
"%",
"endianness",
",",
"data",
")",
... | Returns a 2 byte integer. | [
"Returns",
"a",
"2",
"byte",
"integer",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/plugins/unpfs.py#L10-L13 | train | Returns a 2 byte integer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/plugins/unpfs.py | PFS._get_fname_len | def _get_fname_len(self, bufflen=128):
"""Returns the number of bytes designated for the filename."""
buff = self.meta.peek(bufflen)
strlen = buff.find('\0')
for i, b in enumerate(buff[strlen:]):
if b != '\0':
return strlen+i
return bufflen | python | def _get_fname_len(self, bufflen=128):
"""Returns the number of bytes designated for the filename."""
buff = self.meta.peek(bufflen)
strlen = buff.find('\0')
for i, b in enumerate(buff[strlen:]):
if b != '\0':
return strlen+i
return bufflen | [
"def",
"_get_fname_len",
"(",
"self",
",",
"bufflen",
"=",
"128",
")",
":",
"buff",
"=",
"self",
".",
"meta",
".",
"peek",
"(",
"bufflen",
")",
"strlen",
"=",
"buff",
".",
"find",
"(",
"'\\0'",
")",
"for",
"i",
",",
"b",
"in",
"enumerate",
"(",
"... | Returns the number of bytes designated for the filename. | [
"Returns",
"the",
"number",
"of",
"bytes",
"designated",
"for",
"the",
"filename",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/plugins/unpfs.py#L33-L40 | train | Returns the number of bytes designated for the filename. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/plugins/unpfs.py | PFS._get_node | def _get_node(self):
"""Reads a chunk of meta data from file and returns a PFSNode."""
data = self.meta.read(self.node_size)
return PFSNode(data, self.endianness) | python | def _get_node(self):
"""Reads a chunk of meta data from file and returns a PFSNode."""
data = self.meta.read(self.node_size)
return PFSNode(data, self.endianness) | [
"def",
"_get_node",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"meta",
".",
"read",
"(",
"self",
".",
"node_size",
")",
"return",
"PFSNode",
"(",
"data",
",",
"self",
".",
"endianness",
")"
] | Reads a chunk of meta data from file and returns a PFSNode. | [
"Reads",
"a",
"chunk",
"of",
"meta",
"data",
"from",
"file",
"and",
"returns",
"a",
"PFSNode",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/plugins/unpfs.py#L42-L45 | train | Reads a chunk of meta data from file and returns a PFSNode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/plugins/unpfs.py | PFS.entries | def entries(self):
"""Returns file meta-data entries one by one."""
self.meta.seek(self.file_list_start)
for i in range(0, self.num_files):
yield self._get_node() | python | def entries(self):
"""Returns file meta-data entries one by one."""
self.meta.seek(self.file_list_start)
for i in range(0, self.num_files):
yield self._get_node() | [
"def",
"entries",
"(",
"self",
")",
":",
"self",
".",
"meta",
".",
"seek",
"(",
"self",
".",
"file_list_start",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"self",
".",
"num_files",
")",
":",
"yield",
"self",
".",
"_get_node",
"(",
")"
] | Returns file meta-data entries one by one. | [
"Returns",
"file",
"meta",
"-",
"data",
"entries",
"one",
"by",
"one",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/plugins/unpfs.py#L51-L55 | train | Returns an iterator over the file meta - data entries one by one. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/plugins/unpfs.py | PFSNode._decode_fname | def _decode_fname(self):
"""Extracts the actual string from the available bytes."""
self.fname = self.fname[:self.fname.find('\0')]
self.fname = self.fname.replace('\\', '/') | python | def _decode_fname(self):
"""Extracts the actual string from the available bytes."""
self.fname = self.fname[:self.fname.find('\0')]
self.fname = self.fname.replace('\\', '/') | [
"def",
"_decode_fname",
"(",
"self",
")",
":",
"self",
".",
"fname",
"=",
"self",
".",
"fname",
"[",
":",
"self",
".",
"fname",
".",
"find",
"(",
"'\\0'",
")",
"]",
"self",
".",
"fname",
"=",
"self",
".",
"fname",
".",
"replace",
"(",
"'\\\\'",
"... | Extracts the actual string from the available bytes. | [
"Extracts",
"the",
"actual",
"string",
"from",
"the",
"available",
"bytes",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/plugins/unpfs.py#L73-L76 | train | Extracts the actual string from the available bytes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/magic.py | Signature._generate_regex | def _generate_regex(self, line):
'''
Generates a regular expression from the magic bytes of a signature.
The regex is used by Magic._analyze.
@line - The first SignatureLine object of the signature.
Returns a compile regular expression.
'''
restr = ""
#... | python | def _generate_regex(self, line):
'''
Generates a regular expression from the magic bytes of a signature.
The regex is used by Magic._analyze.
@line - The first SignatureLine object of the signature.
Returns a compile regular expression.
'''
restr = ""
#... | [
"def",
"_generate_regex",
"(",
"self",
",",
"line",
")",
":",
"restr",
"=",
"\"\"",
"# Strings and single byte signatures are taken at face value;",
"# multi-byte integer values are turned into regex strings based",
"# on their data type size and endianness.",
"if",
"line",
".",
"t... | Generates a regular expression from the magic bytes of a signature.
The regex is used by Magic._analyze.
@line - The first SignatureLine object of the signature.
Returns a compile regular expression. | [
"Generates",
"a",
"regular",
"expression",
"from",
"the",
"magic",
"bytes",
"of",
"a",
"signature",
".",
"The",
"regex",
"is",
"used",
"by",
"Magic",
".",
"_analyze",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/magic.py#L302-L375 | train | Generates a regular expression from the magic bytes of a signature. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/magic.py | Magic._filtered | def _filtered(self, text):
'''
Tests if a string should be filtered out or not.
@text - The string to check against filter rules.
Returns True if the string should be filtered out, i.e., not displayed.
Returns False if the string should be displayed.
'''
filtere... | python | def _filtered(self, text):
'''
Tests if a string should be filtered out or not.
@text - The string to check against filter rules.
Returns True if the string should be filtered out, i.e., not displayed.
Returns False if the string should be displayed.
'''
filtere... | [
"def",
"_filtered",
"(",
"self",
",",
"text",
")",
":",
"filtered",
"=",
"None",
"# Text is converted to lower case first, partially for historical",
"# purposes, but also because it simplifies writing filter rules",
"# (e.g., don't have to worry about case sensitivity).",
"text",
"=",... | Tests if a string should be filtered out or not.
@text - The string to check against filter rules.
Returns True if the string should be filtered out, i.e., not displayed.
Returns False if the string should be displayed. | [
"Tests",
"if",
"a",
"string",
"should",
"be",
"filtered",
"out",
"or",
"not",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/magic.py#L436-L471 | train | Tests if a string should be filtered out or not. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/magic.py | Magic._do_math | def _do_math(self, offset, expression):
'''
Parses and evaluates complex expressions, e.g., "(4.l+12)", "(6*32)", etc.
@offset - The offset inside self.data that the current signature starts at.
@expressions - The expression to evaluate.
Returns an integer value that is th... | python | def _do_math(self, offset, expression):
'''
Parses and evaluates complex expressions, e.g., "(4.l+12)", "(6*32)", etc.
@offset - The offset inside self.data that the current signature starts at.
@expressions - The expression to evaluate.
Returns an integer value that is th... | [
"def",
"_do_math",
"(",
"self",
",",
"offset",
",",
"expression",
")",
":",
"# Does the expression contain an offset (e.g., \"(4.l+12)\")?",
"if",
"'.'",
"in",
"expression",
"and",
"'('",
"in",
"expression",
":",
"replacements",
"=",
"{",
"}",
"for",
"period",
"in... | Parses and evaluates complex expressions, e.g., "(4.l+12)", "(6*32)", etc.
@offset - The offset inside self.data that the current signature starts at.
@expressions - The expression to evaluate.
Returns an integer value that is the result of the evaluated expression. | [
"Parses",
"and",
"evaluates",
"complex",
"expressions",
"e",
".",
"g",
".",
"(",
"4",
".",
"l",
"+",
"12",
")",
"(",
"6",
"*",
"32",
")",
"etc",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/magic.py#L473-L546 | train | Parse and evaluate a complex expression and return the value of the expression. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/magic.py | Magic._analyze | def _analyze(self, signature, offset):
'''
Analyzes self.data for the specified signature data at the specified offset .
@signature - The signature to apply to the data.
@offset - The offset in self.data to apply the signature to.
Returns a dictionary of tags parsed from the... | python | def _analyze(self, signature, offset):
'''
Analyzes self.data for the specified signature data at the specified offset .
@signature - The signature to apply to the data.
@offset - The offset in self.data to apply the signature to.
Returns a dictionary of tags parsed from the... | [
"def",
"_analyze",
"(",
"self",
",",
"signature",
",",
"offset",
")",
":",
"description",
"=",
"[",
"]",
"max_line_level",
"=",
"0",
"previous_line_end",
"=",
"0",
"tags",
"=",
"{",
"'id'",
":",
"signature",
".",
"id",
",",
"'offset'",
":",
"offset",
"... | Analyzes self.data for the specified signature data at the specified offset .
@signature - The signature to apply to the data.
@offset - The offset in self.data to apply the signature to.
Returns a dictionary of tags parsed from the data. | [
"Analyzes",
"self",
".",
"data",
"for",
"the",
"specified",
"signature",
"data",
"at",
"the",
"specified",
"offset",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/magic.py#L548-L771 | train | Analyzes the data for the specified signature at the specified offset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/magic.py | Magic.scan | def scan(self, data, dlen=None):
'''
Scan a data block for matching signatures.
@data - A string of data to scan.
@dlen - If specified, signatures at offsets larger than dlen will be ignored.
Returns a list of SignatureResult objects.
'''
results = []
ma... | python | def scan(self, data, dlen=None):
'''
Scan a data block for matching signatures.
@data - A string of data to scan.
@dlen - If specified, signatures at offsets larger than dlen will be ignored.
Returns a list of SignatureResult objects.
'''
results = []
ma... | [
"def",
"scan",
"(",
"self",
",",
"data",
",",
"dlen",
"=",
"None",
")",
":",
"results",
"=",
"[",
"]",
"matched_offsets",
"=",
"set",
"(",
")",
"# Since data can potentially be quite a large string, make it available to other",
"# methods via a class attribute so that it ... | Scan a data block for matching signatures.
@data - A string of data to scan.
@dlen - If specified, signatures at offsets larger than dlen will be ignored.
Returns a list of SignatureResult objects. | [
"Scan",
"a",
"data",
"block",
"for",
"matching",
"signatures",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/magic.py#L783-L841 | train | Scan a data block for matching signatures. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/magic.py | Magic.load | def load(self, fname):
'''
Load signatures from a file.
@fname - Path to signature file.
Returns None.
'''
# Magic files must be ASCII, else encoding issues can arise.
fp = open(fname, "r")
lines = fp.readlines()
self.parse(lines)
fp.clos... | python | def load(self, fname):
'''
Load signatures from a file.
@fname - Path to signature file.
Returns None.
'''
# Magic files must be ASCII, else encoding issues can arise.
fp = open(fname, "r")
lines = fp.readlines()
self.parse(lines)
fp.clos... | [
"def",
"load",
"(",
"self",
",",
"fname",
")",
":",
"# Magic files must be ASCII, else encoding issues can arise.",
"fp",
"=",
"open",
"(",
"fname",
",",
"\"r\"",
")",
"lines",
"=",
"fp",
".",
"readlines",
"(",
")",
"self",
".",
"parse",
"(",
"lines",
")",
... | Load signatures from a file.
@fname - Path to signature file.
Returns None. | [
"Load",
"signatures",
"from",
"a",
"file",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/magic.py#L843-L855 | train | Load signatures from a file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/core/magic.py | Magic.parse | def parse(self, lines):
'''
Parse signature file lines.
@lines - A list of lines from a signature file.
Returns None.
'''
signature = None
for line in lines:
# Split at the first comment delimiter (if any) and strip the
# result
... | python | def parse(self, lines):
'''
Parse signature file lines.
@lines - A list of lines from a signature file.
Returns None.
'''
signature = None
for line in lines:
# Split at the first comment delimiter (if any) and strip the
# result
... | [
"def",
"parse",
"(",
"self",
",",
"lines",
")",
":",
"signature",
"=",
"None",
"for",
"line",
"in",
"lines",
":",
"# Split at the first comment delimiter (if any) and strip the",
"# result",
"line",
"=",
"line",
".",
"split",
"(",
"'#'",
")",
"[",
"0",
"]",
... | Parse signature file lines.
@lines - A list of lines from a signature file.
Returns None. | [
"Parse",
"signature",
"file",
"lines",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/magic.py#L857-L904 | train | Parse the signature file lines. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/modules/general.py | General._set_verbosity | def _set_verbosity(self):
'''
Sets the appropriate verbosity.
Must be called after self._test_target_files so that self.target_files is properly set.
'''
# If more than one target file was specified, enable verbose mode; else, there is
# nothing in some outputs to indicat... | python | def _set_verbosity(self):
'''
Sets the appropriate verbosity.
Must be called after self._test_target_files so that self.target_files is properly set.
'''
# If more than one target file was specified, enable verbose mode; else, there is
# nothing in some outputs to indicat... | [
"def",
"_set_verbosity",
"(",
"self",
")",
":",
"# If more than one target file was specified, enable verbose mode; else, there is",
"# nothing in some outputs to indicate which scan corresponds to which",
"# file.",
"if",
"len",
"(",
"self",
".",
"target_files",
")",
">",
"1",
"... | Sets the appropriate verbosity.
Must be called after self._test_target_files so that self.target_files is properly set. | [
"Sets",
"the",
"appropriate",
"verbosity",
".",
"Must",
"be",
"called",
"after",
"self",
".",
"_test_target_files",
"so",
"that",
"self",
".",
"target_files",
"is",
"properly",
"set",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/general.py#L159-L168 | train | Sets the appropriate verbosity. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ReFirmLabs/binwalk | src/binwalk/modules/general.py | General.file_name_filter | def file_name_filter(self, fp):
'''
Checks to see if a file should be scanned based on file name include/exclude filters.
Most useful for matryoshka scans where only certian files are desired.
@fp - An instances of binwalk.common.BlockFile
Returns True if the file should be sca... | python | def file_name_filter(self, fp):
'''
Checks to see if a file should be scanned based on file name include/exclude filters.
Most useful for matryoshka scans where only certian files are desired.
@fp - An instances of binwalk.common.BlockFile
Returns True if the file should be sca... | [
"def",
"file_name_filter",
"(",
"self",
",",
"fp",
")",
":",
"if",
"self",
".",
"file_name_include_regex",
"and",
"not",
"self",
".",
"file_name_include_regex",
".",
"search",
"(",
"fp",
".",
"name",
")",
":",
"return",
"False",
"if",
"self",
".",
"file_na... | Checks to see if a file should be scanned based on file name include/exclude filters.
Most useful for matryoshka scans where only certian files are desired.
@fp - An instances of binwalk.common.BlockFile
Returns True if the file should be scanned, False if not. | [
"Checks",
"to",
"see",
"if",
"a",
"file",
"should",
"be",
"scanned",
"based",
"on",
"file",
"name",
"include",
"/",
"exclude",
"filters",
".",
"Most",
"useful",
"for",
"matryoshka",
"scans",
"where",
"only",
"certian",
"files",
"are",
"desired",
"."
] | a0c5315fd2bae167e5c3d8469ce95d5defc743c2 | https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/general.py#L170-L184 | train | Checks to see if a file should be scanned based on file name include and exclude filters. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.