HTTPS server, better Automaton.spawn (#4520)

* HTTPS server, better Automaton.spawn

* Note regarding the closure of automatons
This commit is contained in:
gpotter2 2024-09-03 00:20:16 +02:00 committed by GitHub
parent a5dab9efc5
commit 6f0eb89f00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 125 additions and 44 deletions

View File

@ -125,7 +125,7 @@ Let's re-do the initial example programmatically, by turning off the CLI mode. O
('Users', 'DISKTREE', '')]
>>> cli.use('c$')
>>> cli.cd(r'Program Files\Microsoft')
>>> >>> names = [x[0] for x in cli.ls()]
>>> names = [x[0] for x in cli.ls()]
>>> names
['.', '..', 'EdgeUpdater']

View File

@ -976,6 +976,12 @@ class Automaton(metaclass=Automaton_metaclass):
:param port: the port to listen to
:param bg: background mode? (default: False)
Note that in background mode, you shall close the TCP server as such::
srv = MyAutomaton.spawn(8080, bg=True)
srv.shutdown(socket.SHUT_RDWR) # important
srv.close()
"""
from scapy.arch import get_if_addr
# create server sock and bind it
@ -1000,29 +1006,49 @@ class Automaton(metaclass=Automaton_metaclass):
# Wait for clients forever
try:
while True:
atmt_server = None
clientsocket, address = ssock.accept()
if kwargs.get("verb", True):
print(conf.color_theme.gold(
"\u2503 Connection received from %s" % repr(address)
))
# Start atmt class with socket
sock = cls.socketcls(clientsocket, cls.pkt_cls)
atmt_server = cls(
sock=sock,
iface=iface, **kwargs
)
try:
# Start atmt class with socket
if cls.socketcls is not None:
sock = cls.socketcls(clientsocket, cls.pkt_cls)
else:
sock = clientsocket
atmt_server = cls(
sock=sock,
iface=iface, **kwargs
)
except OSError:
if atmt_server is not None:
atmt_server.destroy()
if kwargs.get("verb", True):
print("X Connection aborted.")
if kwargs.get("debug", 0) > 0:
traceback.print_exc()
continue
clients.append((atmt_server, clientsocket))
# start atmt
atmt_server.runbg()
# housekeeping
for atmt, clientsocket in clients:
if not atmt.isrunning():
atmt.destroy()
except KeyboardInterrupt:
print("X Exiting.")
ssock.shutdown(socket.SHUT_RDWR)
except OSError:
print("X Server closed.")
if kwargs.get("debug", 0) > 0:
traceback.print_exc()
finally:
for atmt, clientsocket in clients:
try:
atmt.forcestop(wait=False)
atmt.destroy()
except Exception:
pass
try:

View File

@ -990,15 +990,15 @@ class HTTP_Server(Automaton):
def __init__(
self,
mech=HTTP_AUTH_MECHS.NONE,
ssp=None,
verb=True,
ssp=None,
*args,
**kwargs,
):
self.verb = verb
if "sock" not in kwargs:
raise ValueError(
"HTTP_Server cannot be started directly ! Use SMB_Server.spawn"
"HTTP_Server cannot be started directly ! Use HTTP_Server.spawn"
)
self.ssp = ssp
self.authmethod = mech.value
@ -1197,3 +1197,51 @@ class HTTP_Server(Automaton):
) / (
"<!doctype html><html><body><h1>404 - Not Found</h1></body></html>"
)
class HTTPS_Server(HTTP_Server):
"""
HTTPS server automaton
This has the same arguments and attributes as HTTP_Server, with the addition of:
:param sslcontext: an optional SSLContext object.
If used, cert and key are ignored.
:param cert: path to the certificate
:param key: path to the key
"""
socketcls = None
def __init__(
self,
mech=HTTP_AUTH_MECHS.NONE,
verb=True,
cert=None,
key=None,
sslcontext=None,
ssp=None,
*args,
**kwargs,
):
if "sock" not in kwargs:
raise ValueError(
"HTTPS_Server cannot be started directly ! Use HTTPS_Server.spawn"
)
# wrap socket in SSL
if sslcontext is None:
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(cert, key)
else:
context = sslcontext
kwargs["sock"] = SSLStreamSocket(
context.wrap_socket(kwargs["sock"], server_side=True),
self.pkt_cls,
)
super(HTTPS_Server, self).__init__(
mech=mech,
verb=verb,
ssp=ssp,
*args,
**kwargs,
)

View File

@ -1790,7 +1790,9 @@ class _KRBERROR_data_Field(ASN1F_STRING_PacketField):
# 24: KDC_ERR_PREAUTH_FAILED
# 25: KDC_ERR_PREAUTH_REQUIRED
return MethodData(val[0].val, _underlayer=pkt), val[1]
elif pkt.errorCode.val in [13, 18, 29, 41, 60]:
elif pkt.errorCode.val in [6, 7, 13, 18, 29, 41, 60]:
# 6: KDC_ERR_C_PRINCIPAL_UNKNOWN
# 7: KDC_ERR_S_PRINCIPAL_UNKNOWN
# 13: KDC_ERR_BADOPTION
# 18: KDC_ERR_CLIENT_REVOKED
# 29: KDC_ERR_SVC_UNAVAILABLE

View File

@ -1674,8 +1674,14 @@ class NTLMSSP(SSP):
# [MS-NLMP] sect 3.2.5.1.2
KeyExchangeKey = SessionBaseKey # Only true for NTLMv2
if auth_tok.NegotiateFlags.NEGOTIATE_KEY_EXCH:
if not auth_tok.EncryptedRandomSessionKeyLen:
# No EncryptedRandomSessionKey. libcurl for instance
# hmm. this looks bad
EncryptedRandomSessionKey = b"\x00" * 16
else:
EncryptedRandomSessionKey = auth_tok.EncryptedRandomSessionKey
ExportedSessionKey = RC4K(
KeyExchangeKey, auth_tok.EncryptedRandomSessionKey
KeyExchangeKey, EncryptedRandomSessionKey
)
else:
ExportedSessionKey = KeyExchangeKey

View File

@ -314,7 +314,7 @@ class LatexTheme(FormatTheme):
styler = super(LatexTheme, self).__getattr__(attr)
return cast(
_ColorFormatterType,
lambda x, *args, **kwargs: styler(tex_escape(x), *args, **kwargs),
lambda x, *args, **kwargs: styler(tex_escape(str(x)), *args, **kwargs),
)

View File

@ -13,8 +13,9 @@ from io import StringIO
from itertools import zip_longest
from uuid import UUID
import array
import argparse
import array
import base64
import collections
import decimal
import difflib
@ -44,8 +45,6 @@ from scapy.compat import (
orb,
plain_str,
chb,
bytes_base64,
base64_bytes,
hex_bytes,
bytes_encode,
)
@ -1229,7 +1228,7 @@ class Enum_metaclass(type):
def export_object(obj):
# type: (Any) -> None
import zlib
print(bytes_base64(zlib.compress(pickle.dumps(obj, 2), 9)))
print(base64.b64encode(zlib.compress(pickle.dumps(obj, 2), 9)).decode())
def import_object(obj=None):
@ -1237,7 +1236,7 @@ def import_object(obj=None):
import zlib
if obj is None:
obj = sys.stdin.read()
return pickle.loads(zlib.decompress(base64_bytes(obj.strip()))) # noqa: E501
return pickle.loads(zlib.decompress(base64.b64decode(obj.strip())))
def save_object(fname, obj):

View File

@ -2190,7 +2190,7 @@ pcapfile = BytesIO(b'\xd4\xc3\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x0
pcapngfile = BytesIO(b'\n\r\r\n\\\x00\x00\x00M<+\x1a\x01\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x01\x00,\x00File created by merging: \nFile1: test.pcap \n\x04\x00\x08\x00mergecap\x00\x00\x00\x00\\\x00\x00\x00\x01\x00\x00\x00\\\x00\x00\x00e\x00\x00\x00\xff\xff\x00\x00\x02\x006\x00Unknown/not available in original file format(libpcap)\x00\x00\t\x00\x01\x00\x06\x00\x00\x00\x00\x00\x00\x00\\\x00\x00\x00\x06\x00\x00\x00H\x00\x00\x00\x00\x00\x00\x00\x8d*\x05\x00/\xfc[\xcd(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00H\x00\x00\x00\x06\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x8d*\x05\x00\x1f\xff[\xcd\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r<\x00\x00\x00\x06\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x8d*\x05\x00\xb9\x02\\\xcd\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00<\x00\x00\x00')
pcapnanofile = BytesIO(b"M<\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00e\x00\x00\x00\xcf\xc5\xacV\xc9\xc1\xb5'(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00\xcf\xc5\xacV-;\xc1'\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r\xcf\xc5\xacV\x9aL\xcf'\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00")
pcapwirelenfile = BytesIO(b'\xd4\xc3\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x01\x00\x00\x00}\x87pZ.\xa2\x08\x00\x0f\x00\x00\x00\x10\x00\x00\x00\xff\xff\xff\xff\xff\xff GG\xee\xdd\xa8\x90\x00a')
pcapngdefaults = BytesIO(base64_bytes(b'Cg0NChwAAABNPCsaAQAAAP//////////HAAAAAEAAAAgAAAAEgEAAP//AAAJAAEACUeZiQAAAAAgAAAAAQAAACAAAAASAQAA//8AAAkAAQAJAAAAAAAAACAAAAABAAAAIAAAABIBAAD//wAACQABAAkAAAAAAAAAIAAAAAEAAAAgAAAAEgEAAP//AAAJAAEACQAAAAAAAAAgAAAABgAAAIQBAAADAAAApO/bFdgJaeBiAQAAYgEAAFVVVVVVVVXV////////IMbr4D7PCABFAAFIlQkAAEAR5JwAAAAA/////wBEAEMBNJDsAQEGAFSpVwIACoAAAAAAAAAAAAAAAAAAAAAAACDG6+A+zwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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XNjcmVlbi1vcmc6c2VydmljZTpkaWFsOjENCg0KLn5A6QCoAQAA'))
= Read a pcap file
pktpcap = rdpcap(pcapfile)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@ p = ASN1P_PRIVSEQ(s)
+ Private RSA & ECDSA keys class tests
= Key class : Importing DER encoded RSA private key
from scapy.layers.x509 import RSAPrivateKey
k = base64_bytes('MIIEowIBAAKCAQEAmFdqP+nTEZukS0lLP+yj1gNImsEIf7P2ySTunceYxwkm4VE5QReDbb2L5/HL\nA9pPmIeQLSq/BgO1meOcbOSJ2YVHQ28MQ56+8Crb6n28iycX4hp0H3AxRAjh0edX+q3yilvYJ4W9\n/NnIb/wAZwS0oJif/tTkVF77HybAfJde5Eqbp+bCKIvMWnambh9DRUyjrBBZo5dA1o32zpuFBrJd\nI8dmUpw9gtf0F0Ba8lGZm8Uqc0GyXeXOJUE2u7CiMu3M77BM6ZLLTcow5+bQImkmTL1SGhzwfinM\nE1e6p3Hm//pDjuJvFaY22k05LgLuyqc59vFiB3Toldz8+AbMNjvzAwIDAQABAoIBAH3KeJZL2hhI\n/1GXNMaU/PfDgFkgmYbxMA8JKusnm/SFjxAwBGnGI6UjBXpBgpQs2Nqm3ZseF9u8hmCKvGiCEX2G\nesCo2mSfmSQxD6RBrMTuQ99UXpxzBIscFnM/Zrs8lPBARGzmF2nI3qPxXtex4ABX5o0Cd4NfZlZj\npj96skUoO8+bd3I4OPUFYFFFuv81LoSQ6Hew0a8xtJXtKkDp9h1jTGGUOc189WACNoBLH0MGeVoS\nUfc1++RcC3cypUZ8fNP1OO6GBfv06f5oXES4ZbxGYpa+nCfNwb6V2gWbkvaYm7aFn0KWGNZXS1P3\nOcWv6IWdOmg2CI7MMBLJ0LyWVCECgYEAyMJYw195mvHl8VyxJ3HkxeQaaozWL4qhNQ0Kaw+mzD+j\nYdkbHb3aBYghsgEDZjnyOVblC7I+4smvAZJLWJaf6sZ5HAw3zmj1ibCkX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6SfA83sCLM31K/A8FTNJL2CDGA9WNBL3fOSs2GYg88AVBGpUJHeDK+0748OcPUSPaG+pVI\nETSn5RRgffq16r0nWYUvSdAn8cuTqw3y+yC1pZS6AU8dAoGBAL5QCi0dTWKN3kf3cXaCAnYiWe4Q\ng2S+SgLE+F1U4Xws2rqAuSvIiuT5i5+Mqk9ZCGdoReVbAovJFoRqe7Fj9yWM+b1awGjL0bOTtnqx\n0iljob6uFyhpl1xgW3a3ICJ/ZYLvkgb4IBEteOwWpp37fX57vzhW8EmUV2UX7ve1uNRI')
x=RSAPrivateKey(k)
= Key class : key version
@ -53,7 +53,7 @@ x.coefficient == ASN1_INTEGER(13364209135497709980522851534062695694375984073722
+ X509_Cert class tests
= Cert class : Importing DER encoded X.509 Certificate with RSA public key
from scapy.layers.x509 import X509_Cert
c = base64_bytes('MIIFEjCCA/qgAwIBAgIJALRecEPnCQtxMA0GCSqGSIb3DQEBBQUAMIG2MQswCQYDVQQGEwJGUjEO\nMAwGA1UECBMFUGFyaXMxDjAMBgNVBAcTBVBhcmlzMRcwFQYDVQQKEw5NdXNocm9vbSBDb3JwLjEe\nMBwGA1UECxMVTXVzaHJvb20gVlBOIFNlcnZpY2VzMSUwIwYDVQQDExxJS0V2MiBYLjUwOSBUZXN0\nIGNlcnRpZmljYXRlMScwJQYJKoZIhvcNAQkBFhhpa2V2Mi10ZXN0QG11c2hyb29tLmNvcnAwHhcN\nMDYwNzEzMDczODU5WhcNMjYwMzMwMDczODU5WjCBtjELMAkGA1UEBhMCRlIxDjAMBgNVBAgTBVBh\ncmlzMQ4wDAYDVQQHEwVQYXJpczEXMBUGA1UEChMOTXVzaHJvb20gQ29ycC4xHjAcBgNVBAsTFU11\nc2hyb29tIFZQTiBTZXJ2aWNlczElMCMGA1UEAxMcSUtFdjIgWC41MDkgVGVzdCBjZXJ0aWZpY2F0\nZTEnMCUGCSqGSIb3DQEJARYYaWtldjItdGVzdEBtdXNocm9vbS5jb3JwMIIBIjANBgkqhkiG9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Luyqc59vFiB3Toldz8+AbMNjvzAwIDAQABo4IBHzCC\nARswHQYDVR0OBBYEFPPYTt6Q9+Zd0s4zzVxWjG+XFDFLMIHrBgNVHSMEgeMwgeCAFPPYTt6Q9+Zd\n0s4zzVxWjG+XFDFLoYG8pIG5MIG2MQswCQYDVQQGEwJGUjEOMAwGA1UECBMFUGFyaXMxDjAMBgNV\nBAcTBVBhcmlzMRcwFQYDVQQKEw5NdXNocm9vbSBDb3JwLjEeMBwGA1UECxMVTXVzaHJvb20gVlBO\nIFNlcnZpY2VzMSUwIwYDVQQDExxJS0V2MiBYLjUwOSBUZXN0IGNlcnRpZmljYXRlMScwJQYJKoZI\nhvcNAQkBFhhpa2V2Mi10ZXN0QG11c2hyb29tLmNvcnCCCQC0XnBD5wkLcTAMBgNVHRMEBTADAQH/\nMA0GCSqGSIb3DQEBBQUAA4IBAQA2zt0BvXofiVvHMWlftZCstQaawej1SmxrAfDB4NUM24NsG+UZ\nI88XA5XM6QolmfyKnNromMLC1+6CaFxjq3jC/qdS7ifalFLQVo7ik/te0z6Olo0RkBNgyagWPX2L\nR5kHe9RvSDuoPIsbSHMmJA98AZwatbvEhmzMINJNUoHVzhPeHZnIaBgUBg02XULk/ElidO51Rf3g\nh8dR/kgFQSQT687vs1x9TWD00z0Q2bs2UF3Ob3+NYkEGEo5F9RePQm0mY94CT2xs6WpHo060Fo7f\nVpAFktMWx1vpu+wsEbQAhgGqV0fCR2QwKDIbTrPW/p9HJtJDYVjYdAFxr3s7V77y')
x=X509_Cert(c)
= Cert class : Rebuild certificate
@ -152,7 +152,7 @@ else:
= Cert class: Import Windows AD certificate
from scapy.layers.x509 import X509_Cert
c = base64_bytes('MIIHKjCCBRKgAwIBAgITEgAAAAerpFLcIBwL6QAAAAAABzANBgkqhkiG9w0BAQsFADBHMRUwEwYKCZImiZPyLGQBGRYFbG9jYWwxFjAUBgoJkiaJk/IsZAEZFgZkb21haW4xFjAUBgNVBAMTDWRvbWFpbi1EQzEtQ0Ew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DPwv8wqzTvbDA9JMWm7sUanrl0x2yvfB9JyuZmo8y3JE7D8RFs/Z5btvWvQ4CWWIgVKnVncXOr98ytSaGNOift2NNz/2sox26Dgls4xklllnHiF2353IDSNPZqTNruWjUyM+4RuGKu6djqlaTneNEOi9Cu5HSE95JC03k9NhYyDW8PUIAWksLiWMYFng4KH37U9P15EiPsgPY70nP4ll6NqKt7RfXnSH7AmvacvY7dazsKOulAdzp8YuQ5vjR61FsbB/jn1hwtR7OdNYFKd9KK66zFSrX+n0sTXMou1FzvqDUj5+qLlbyEzYvU/QbNTxYUIjjNv+asXtD9T+UaKoI5PyeRBA4cnU7+klduy0vVh2Lx6lnIZPVCG7i1sQYRQQ3ESP7QSUuJtG/wgJZ5KspzfIHBjt62549oVj0CoJcvMZ2wOr8iY=')
x=X509_Cert(c)
= Cert class: Check some Windows-specific extensions
@ -184,7 +184,7 @@ assert ext[9].extnValue.value == b'S-1-5-21-1924137214-3718646274-40215721-1000'
+ X509_CRL class tests
= CRL class : Importing DER encoded X.509 CRL
from scapy.layers.x509 import X509_CRL
c = base64_bytes('MIICHjCCAYcwDQYJKoZIhvcNAQEFBQAwXzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWdu\nLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAxIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0\naG9yaXR5Fw0wNjExMDIwMDAwMDBaFw0wNzAyMTcyMzU5NTlaMIH2MCECECzSS2LEl6QXzW6jyJx6\nLcgXDTA0MDQwMTE3NTYxNVowIQIQOkXeVssCzdzcTndjIhvU1RcNMDEwNTA4MTkyMjM0WjAhAhBB\nXYg2gRUg1YCDRqhZkngsFw0wMTA3MDYxNjU3MjNaMCECEEc5gf/9hIHxlfnrGMJ8DfEXDTAzMDEw\nOTE4MDYxMlowIQIQcFR+auK62HZ/R6mZEEFeZxcNMDIwOTIzMTcwMDA4WjAhAhB+C13eGPI5ZoKm\nj2UiOCPIF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