Skip to content

Commit

Permalink
Add HTTP_Client / HTTP_Server with SSP support (#4389)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpotter2 committed May 15, 2024
1 parent fa94fe3 commit 8461c2e
Show file tree
Hide file tree
Showing 11 changed files with 589 additions and 64 deletions.
2 changes: 2 additions & 0 deletions scapy/automaton.py
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,8 @@ def destroy(self):
Destroys a stopped Automaton: this cleanups all opened file descriptors.
Required on PyPy for instance where the garbage collector behaves differently.
"""
if not hasattr(self, "started"):
return # was never started.
if self.isrunning():
raise ValueError("Can't close running Automaton ! Call stop() beforehand")
# Close command pipes
Expand Down
16 changes: 12 additions & 4 deletions scapy/layers/gssapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ def dispatch_hook(cls, _pkt=None, *args, **kargs):
# heuristics.
if _pkt[:2] in [b"\x04\x04", b"\x05\x04"]:
from scapy.layers.kerberos import KRB_InnerToken

return KRB_InnerToken
elif len(_pkt) >= 4 and _pkt[:4] == b"\x01\x00\x00\x00":
from scapy.layers.ntlm import NTLMSSP_MESSAGE_SIGNATURE

return NTLMSSP_MESSAGE_SIGNATURE
return cls

Expand Down Expand Up @@ -260,6 +262,7 @@ class GSS_C_FLAGS(IntFlag):
"""
Authenticator Flags per RFC2744 req_flags
"""

GSS_C_DELEG_FLAG = 0x01
GSS_C_MUTUAL_FLAG = 0x02
GSS_C_REPLAY_FLAG = 0x04
Expand Down Expand Up @@ -297,12 +300,16 @@ def __init__(self, req_flags: Optional[GSS_C_FLAGS] = None):
if req_flags is None:
# Default
req_flags = (
GSS_C_FLAGS.GSS_C_EXTENDED_ERROR_FLAG |
GSS_C_FLAGS.GSS_C_MUTUAL_FLAG
GSS_C_FLAGS.GSS_C_EXTENDED_ERROR_FLAG
| GSS_C_FLAGS.GSS_C_MUTUAL_FLAG
)
self.flags = req_flags
self.passive = False

def clifailure(self):
# This allows to reset the client context without discarding it.
pass

def __repr__(self):
return "[Default SSP]"

Expand All @@ -312,8 +319,9 @@ class STATE(IntEnum):
"""

@abc.abstractmethod
def GSS_Init_sec_context(self, Context: CONTEXT, val=None,
req_flags: Optional[GSS_C_FLAGS] = None):
def GSS_Init_sec_context(
self, Context: CONTEXT, val=None, req_flags: Optional[GSS_C_FLAGS] = None
):
"""
GSS_Init_sec_context: client-side call for the SSP
"""
Expand Down

0 comments on commit 8461c2e

Please sign in to comment.