forked from sensepost/ruler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatatypes.go
186 lines (170 loc) · 4.18 KB
/
datatypes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
package utils
import (
"encoding/xml"
"net/http"
"net/http/cookiejar"
"net/url"
)
//Config containing the session variables
type Config struct {
Domain string
User string
Pass string
Email string
Basic bool
Insecure bool
Verbose bool
Admin bool
}
//Session stores authentication cookies ect
type Session struct {
User string
Pass string
Email string
Domain string
Basic bool
Insecure bool
Verbose bool
Admin bool
LID string
URL *url.URL
ABKURL *url.URL //URL for the AddressBook Provider
Host string //used for TCP
ReqCounter int
Transport int
CookieJar *cookiejar.Jar
Client http.Client
ClientSet bool
LogonID byte
Authenticated bool
Folderids [][]byte
RulesHandle []byte
NTHash []byte
NTLMAuth string
BasicAuth string
RPCSet bool
ContextHandle []byte //16-byte cookie for the RPC session
RPCURL string
UserDN []byte
Trigger string
RPCMailbox string
RPCEncrypt bool
RPCNtlm bool
RPCNetworkAuthLevel uint8
RPCNetworkAuthType uint8
RPCNtlmSessionKey []byte
}
//YamlConfig holds the data that a user supplies with a yaml config file
type YamlConfig struct {
Username string
Email string
Password string
Hash string
Domain string
UserDN string
Mailbox string
RPCURL string
RPC bool
RPCEncrypt bool
Ntlm bool
MapiURL string
}
//AutodiscoverResp structure for unmarshal
type AutodiscoverResp struct {
Response Response
}
//Response structure for unmarshal
type Response struct {
User User
Account Account
Error AutoError
}
//AutoError structure for unmarshal
type AutoError struct {
ErrorCode string
Message string
DebugData string
}
//User structure for unmarshal
type User struct {
DisplayName string
LegacyDN string
DeploymentID string
AutoDiscoverSMTPAddress string
}
//Account structure for unmarshal
type Account struct {
AccountType string
Action string
RedirectAddr string
MicrosoftOnline bool
Protocol []*Protocol
}
//Protocol structure for unmarshal
type Protocol struct {
Type string
TypeAttr string `xml:"Type,attr"`
Server string
TTL string
ServerDN string
ServerVersion string
MdbDN string
PublicFolderServer string
Port string
DirectoryPort string
ReferralPort string
ASUrl string
EWSUrl string
EMWSUrl string
SharingURL string
ECPUrl string
OOFUrl string
UMUrl string
OABUrl string
EwsPartnerURL string
LoginName string
DomainRequired string
DomainName string
SPA string
AuthPackage string
CertPrincipleName string
SSL string
AuthRequired string
UsePOPAuth string
SMTPLast string
NetworkRequirements string
MailStore *MailStore
AddressBook *AddressBook
Internal *ProtoInternal
External *ProtoInternal
PublicFolderInformation *PublicFolderInformation
}
//ProtoInternal strucuture for unmarshal
type ProtoInternal struct {
OWAUrl string
Protocol *Protocol
}
//MailStore structure for unmarshal
type MailStore struct {
InternalUrl string
ExternalUrl string
}
//AddressBook structure for unmarshal
type AddressBook struct {
InternalUrl string
ExternalUrl string
}
//PublicFolderInformation structure for unmarshal
type PublicFolderInformation struct {
SMTPAddress string
}
//Unmarshal returns the XML response as golang structs
func (autodiscresp *AutodiscoverResp) Unmarshal(resp []byte) error {
//var autodiscresp *AutodiscoverResp
err := xml.Unmarshal(resp, autodiscresp)
if err != nil {
return err //fmt.Printf("error: %v", err)
//return nil
}
return nil
}