CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/proto/ntlm/constants.rb
Views: 11704
1
# -*- coding: binary -*-
2
module Rex
3
module Proto
4
module NTLM
5
class Constants
6
7
SSP_SIGN = "NTLMSSP\0"
8
BLOB_SIGN = 0x00000101
9
LM_MAGIC = "KGS!@\#$%"
10
TIME_OFFSET = 11644473600
11
MAX64 = 0xffffffffffffffff
12
13
FLAGS = {
14
:UNICODE => 0x00000001,
15
:OEM => 0x00000002,
16
:REQUEST_TARGET => 0x00000004,
17
#:UNKNOWN => 0x00000008,
18
:SIGN => 0x00000010,
19
:SEAL => 0x00000020,
20
#:UNKNOWN => 0x00000040,
21
:NETWARE => 0x00000100,
22
:NTLM => 0x00000200,
23
#:UNKNOWN => 0x00000400,
24
#:UNKNOWN => 0x00000800,
25
:DOMAIN_SUPPLIED => 0x00001000,
26
:WORKSTATION_SUPPLIED => 0x00002000,
27
:LOCAL_CALL => 0x00004000,
28
:ALWAYS_SIGN => 0x00008000,
29
:TARGET_TYPE_DOMAIN => 0x00010000,
30
:TARGET_INFO => 0x00800000,
31
:NTLM2_KEY => 0x00080000,
32
:KEY128 => 0x20000000,
33
:KEY56 => 0x80000000
34
}
35
36
FLAG_KEYS = FLAGS.keys.sort{|a, b| FLAGS[a] <=> FLAGS[b] }
37
38
DEFAULT_FLAGS = {
39
:TYPE1 => FLAGS[:UNICODE] | FLAGS[:OEM] | FLAGS[:REQUEST_TARGET] | FLAGS[:NTLM] | FLAGS[:ALWAYS_SIGN] | FLAGS[:NTLM2_KEY],
40
:TYPE2 => FLAGS[:UNICODE],
41
:TYPE3 => FLAGS[:UNICODE] | FLAGS[:REQUEST_TARGET] | FLAGS[:NTLM] | FLAGS[:ALWAYS_SIGN] | FLAGS[:NTLM2_KEY]
42
}
43
44
# NTLM Response Type
45
NTLM_V1_RESPONSE = 1
46
NTLM_V2_RESPONSE = 2
47
NTLM_2_SESSION_RESPONSE = 3
48
49
#the same flags but merged from lib/rex/proto/smb/constants and keeped for compatibility
50
# NTLMSSP Message Flags
51
NEGOTIATE_UNICODE = 0x00000001 # Only set if Type 1 contains it - this or oem, not both
52
NEGOTIATE_OEM = 0x00000002 # Only set if Type 1 contains it - this or unicode, not both
53
REQUEST_TARGET = 0x00000004 # If set in Type 1, must return domain or server
54
NEGOTIATE_SIGN = 0x00000010 # Session signature required
55
NEGOTIATE_SEAL = 0x00000020 # Session seal required
56
NEGOTIATE_LMKEY = 0x00000080 # LM Session Key should be used for signing and sealing
57
NEGOTIATE_NTLM = 0x00000200 # NTLM auth is supported
58
NEGOTIATE_ANONYMOUS = 0x00000800 # Anonymous context used
59
NEGOTIATE_DOMAIN = 0x00001000 # Sent in Type1, client gives domain info
60
NEGOTIATE_WORKSTATION = 0x00002000 # Sent in Type1, client gives workstation info
61
NEGOTIATE_LOCAL_CALL = 0x00004000 # Server and client are on same machine
62
NEGOTIATE_ALWAYS_SIGN = 0x00008000 # Add signatures to packets
63
TARGET_TYPE_DOMAIN = 0x00010000 # If REQUEST_TARGET, we're adding the domain name
64
TARGET_TYPE_SERVER = 0x00020000 # If REQUEST_TARGET, we're adding the server name
65
TARGET_TYPE_SHARE = 0x00040000 # Supposed to denote "a share" but for a webserver?
66
NEGOTIATE_NTLM2_KEY = 0x00080000 # NTLMv2 Signature and Key exchanges
67
NEGOTIATE_TARGET_INFO = 0x00800000 # Server set when sending Target Information Block
68
NEGOTIATE_128 = 0x20000000 # 128-bit encryption supported
69
NEGOTIATE_KEY_EXCH = 0x40000000 # Client will supply encrypted master key in Session Key field of Type3 msg
70
NEGOTIATE_56 = 0x80000000 # 56-bit encryption supported
71
72
end
73
end
74
end
75
end
76
77