Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/js/generated/ts/smb.ts
2070 views
1
2
3
/**
4
* SMBClient is a client for SMB servers.
5
* Internally client uses github.com/zmap/zgrab2/lib/smb/smb driver.
6
* github.com/projectdiscovery/go-smb2 driver
7
* @example
8
* ```javascript
9
* const smb = require('nuclei/smb');
10
* const client = new smb.SMBClient();
11
* ```
12
*/
13
export class SMBClient {
14
15
16
// Constructor of SMBClient
17
constructor() {}
18
/**
19
* ConnectSMBInfoMode tries to connect to provided host and port
20
* and discovery SMB information
21
* Returns handshake log and error. If error is not nil,
22
* state will be false
23
* @example
24
* ```javascript
25
* const smb = require('nuclei/smb');
26
* const client = new smb.SMBClient();
27
* const info = client.ConnectSMBInfoMode('acme.com', 445);
28
* log(to_json(info));
29
* ```
30
*/
31
public ConnectSMBInfoMode(host: string, port: number): SMBLog | null | null {
32
return null;
33
}
34
35
36
/**
37
* ListSMBv2Metadata tries to connect to provided host and port
38
* and list SMBv2 metadata.
39
* Returns metadata and error. If error is not nil,
40
* state will be false
41
* @example
42
* ```javascript
43
* const smb = require('nuclei/smb');
44
* const client = new smb.SMBClient();
45
* const metadata = client.ListSMBv2Metadata('acme.com', 445);
46
* log(to_json(metadata));
47
* ```
48
*/
49
public ListSMBv2Metadata(host: string, port: number): ServiceSMB | null | null {
50
return null;
51
}
52
53
54
/**
55
* ListShares tries to connect to provided host and port
56
* and list shares by using given credentials.
57
* Credentials cannot be blank. guest or anonymous credentials
58
* can be used by providing empty password.
59
* @example
60
* ```javascript
61
* const smb = require('nuclei/smb');
62
* const client = new smb.SMBClient();
63
* const shares = client.ListShares('acme.com', 445, 'username', 'password');
64
* for (const share of shares) {
65
* log(share);
66
* }
67
* ```
68
*/
69
public ListShares(host: string, port: number, user: string): string[] | null {
70
return null;
71
}
72
73
74
/**
75
* DetectSMBGhost tries to detect SMBGhost vulnerability
76
* by using SMBv3 compression feature.
77
* If the host is vulnerable, it returns true.
78
* @example
79
* ```javascript
80
* const smb = require('nuclei/smb');
81
* const isSMBGhost = smb.DetectSMBGhost('acme.com', 445);
82
* ```
83
*/
84
public DetectSMBGhost(host: string, port: number): boolean | null {
85
return null;
86
}
87
88
89
}
90
91
92
93
/**
94
* HeaderLog Interface
95
*/
96
export interface HeaderLog {
97
98
ProtocolID?: Uint8Array,
99
100
Status?: number,
101
102
Command?: number,
103
104
Credits?: number,
105
106
Flags?: number,
107
}
108
109
110
111
/**
112
* NegotiationLog Interface
113
*/
114
export interface NegotiationLog {
115
116
SecurityMode?: number,
117
118
DialectRevision?: number,
119
120
ServerGuid?: Uint8Array,
121
122
Capabilities?: number,
123
124
SystemTime?: number,
125
126
ServerStartTime?: number,
127
128
AuthenticationTypes?: string[],
129
130
HeaderLog?: HeaderLog,
131
}
132
133
134
135
/**
136
* SMBCapabilities Interface
137
*/
138
export interface SMBCapabilities {
139
140
DFSSupport?: boolean,
141
142
Leasing?: boolean,
143
144
LargeMTU?: boolean,
145
146
MultiChan?: boolean,
147
148
Persist?: boolean,
149
150
DirLeasing?: boolean,
151
152
Encryption?: boolean,
153
}
154
155
156
157
/**
158
* SMBLog Interface
159
*/
160
export interface SMBLog {
161
162
NTLM?: string,
163
164
GroupName?: string,
165
166
HasNTLM?: boolean,
167
168
SupportV1?: boolean,
169
170
NativeOs?: string,
171
172
Version?: SMBVersions,
173
174
Capabilities?: SMBCapabilities,
175
176
NegotiationLog?: NegotiationLog,
177
178
SessionSetupLog?: SessionSetupLog,
179
}
180
181
182
183
/**
184
* SMBVersions Interface
185
*/
186
export interface SMBVersions {
187
188
Major?: number,
189
190
Minor?: number,
191
192
Revision?: number,
193
194
VerString?: string,
195
}
196
197
198
199
/**
200
* ServiceSMB Interface
201
*/
202
export interface ServiceSMB {
203
204
OSVersion?: string,
205
206
NetBIOSComputerName?: string,
207
208
NetBIOSDomainName?: string,
209
210
DNSComputerName?: string,
211
212
DNSDomainName?: string,
213
214
ForestName?: string,
215
216
SigningEnabled?: boolean,
217
218
SigningRequired?: boolean,
219
}
220
221
222
223
/**
224
* SessionSetupLog Interface
225
*/
226
export interface SessionSetupLog {
227
228
SetupFlags?: number,
229
230
TargetName?: string,
231
232
NegotiateFlags?: number,
233
234
HeaderLog?: HeaderLog,
235
}
236
237
238