tedious 1.12.3 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/appveyor.yml +9 -5
- package/benchmarks/README.md +33 -0
- package/benchmarks/common.js +82 -0
- package/benchmarks/index.js +34 -0
- package/benchmarks/query/many-result-rows.js +49 -0
- package/benchmarks/query/nvarchar-large.js +44 -0
- package/benchmarks/query/nvarchar-small.js +44 -0
- package/benchmarks/query/varbinary-4.js +42 -0
- package/benchmarks/query/varbinary-huge.js +46 -0
- package/benchmarks/query/varbinary-large.js +46 -0
- package/benchmarks/query/varbinary-small.js +42 -0
- package/benchmarks/token-parser/colmetadata-token.js +42 -0
- package/benchmarks/token-parser/done-token.js +42 -0
- package/benchmarks/token-parser/simple-tokens.js +366 -0
- package/lib/all-headers.js +9 -11
- package/lib/buffertools.js +17 -13
- package/lib/bulk-load.js +196 -169
- package/lib/collation.js +80 -2
- package/lib/connection.js +1086 -1060
- package/lib/data-type.js +450 -253
- package/lib/debug.js +57 -51
- package/lib/errors.js +40 -55
- package/lib/guid-parser.js +12 -36
- package/lib/instance-lookup.js +57 -54
- package/lib/library.js +3 -2
- package/lib/login7-payload.js +187 -180
- package/lib/message-io.js +169 -199
- package/lib/metadata-parser.js +169 -255
- package/lib/ntlm-payload.js +173 -160
- package/lib/packet.js +166 -152
- package/lib/prelogin-payload.js +170 -160
- package/lib/request.js +122 -122
- package/lib/rpcrequest-payload.js +64 -38
- package/lib/special-stored-procedure.js +3 -2
- package/lib/sqlbatch-payload.js +20 -16
- package/lib/stream-parser.js +116 -104
- package/lib/tds-versions.js +5 -8
- package/lib/tedious.js +8 -14
- package/lib/token/colmetadata-token-parser.js +79 -125
- package/lib/token/done-token-parser.js +47 -129
- package/lib/token/env-change-token-parser.js +90 -126
- package/lib/token/infoerror-token-parser.js +47 -125
- package/lib/token/loginack-token-parser.js +36 -74
- package/lib/token/nbcrow-token-parser.js +40 -64
- package/lib/token/order-token-parser.js +26 -43
- package/lib/token/returnstatus-token-parser.js +11 -23
- package/lib/token/returnvalue-token-parser.js +31 -54
- package/lib/token/row-token-parser.js +39 -52
- package/lib/token/sspi-token-parser.js +14 -32
- package/lib/token/stream-parser.js +424 -304
- package/lib/token/token-stream-parser.js +39 -34
- package/lib/token/token.js +3 -6
- package/lib/tracking-buffer/bigint.js +45 -48
- package/lib/tracking-buffer/readable-tracking-buffer.js +238 -223
- package/lib/tracking-buffer/tracking-buffer.js +3 -9
- package/lib/tracking-buffer/writable-tracking-buffer.js +272 -244
- package/lib/transaction.js +112 -102
- package/lib/value-parser.js +559 -1154
- package/package.json +10 -9
- package/benchmarks/benchmarks.coffee +0 -122
- package/benchmarks/query.coffee +0 -57
package/lib/login7-payload.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
var FLAGS_1, FLAGS_2, FLAGS_3, Login7Payload, NTLMFlags, TYPE_FLAGS, WritableTrackingBuffer, libraryName, os, sprintf, versions;
|
|
1
|
+
'use strict';
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
var _createClass = require('babel-runtime/helpers/create-class')['default'];
|
|
5
4
|
|
|
6
|
-
require('
|
|
7
|
-
|
|
8
|
-
os = require('os');
|
|
9
|
-
|
|
10
|
-
sprintf = require('sprintf').sprintf;
|
|
5
|
+
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
require('./buffertools');
|
|
13
8
|
|
|
14
|
-
|
|
9
|
+
var WritableTrackingBuffer = require('./tracking-buffer/writable-tracking-buffer');
|
|
10
|
+
var os = require('os');
|
|
11
|
+
var sprintf = require('sprintf').sprintf;
|
|
12
|
+
var libraryName = require('./library').name;
|
|
13
|
+
var versions = require('./tds-versions').versions;
|
|
15
14
|
|
|
16
|
-
FLAGS_1 = {
|
|
15
|
+
var FLAGS_1 = {
|
|
17
16
|
ENDIAN_LITTLE: 0x00,
|
|
18
17
|
ENDIAN_BIG: 0x01,
|
|
19
18
|
CHARSET_ASCII: 0x00,
|
|
@@ -31,7 +30,7 @@ FLAGS_1 = {
|
|
|
31
30
|
SET_LANG_WARN_ON: 0x80
|
|
32
31
|
};
|
|
33
32
|
|
|
34
|
-
FLAGS_2 = {
|
|
33
|
+
var FLAGS_2 = {
|
|
35
34
|
INIT_LANG_WARN: 0x00,
|
|
36
35
|
INIT_LANG_FATAL: 0x01,
|
|
37
36
|
ODBC_OFF: 0x00,
|
|
@@ -46,7 +45,7 @@ FLAGS_2 = {
|
|
|
46
45
|
INTEGRATED_SECURITY_ON: 0x80
|
|
47
46
|
};
|
|
48
47
|
|
|
49
|
-
TYPE_FLAGS = {
|
|
48
|
+
var TYPE_FLAGS = {
|
|
50
49
|
SQL_DFLT: 0x00,
|
|
51
50
|
SQL_TSQL: 0x08,
|
|
52
51
|
OLEDB_OFF: 0x00,
|
|
@@ -55,7 +54,7 @@ TYPE_FLAGS = {
|
|
|
55
54
|
READ_ONLY_INTENT: 0x20
|
|
56
55
|
};
|
|
57
56
|
|
|
58
|
-
FLAGS_3 = {
|
|
57
|
+
var FLAGS_3 = {
|
|
59
58
|
CHANGE_PASSWORD_NO: 0x00,
|
|
60
59
|
CHANGE_PASSWORD_YES: 0x01,
|
|
61
60
|
BINARY_XML: 0x02,
|
|
@@ -63,7 +62,7 @@ FLAGS_3 = {
|
|
|
63
62
|
UNKNOWN_COLLATION_HANDLING: 0x08
|
|
64
63
|
};
|
|
65
64
|
|
|
66
|
-
NTLMFlags = {
|
|
65
|
+
var NTLMFlags = {
|
|
67
66
|
NTLM_NegotiateUnicode: 0x00000001,
|
|
68
67
|
NTLM_NegotiateOEM: 0x00000002,
|
|
69
68
|
NTLM_RequestTarget: 0x00000004,
|
|
@@ -101,188 +100,196 @@ NTLMFlags = {
|
|
|
101
100
|
/*
|
|
102
101
|
s2.2.6.3
|
|
103
102
|
*/
|
|
104
|
-
|
|
105
|
-
Login7Payload = (function () {
|
|
103
|
+
module.exports = (function () {
|
|
106
104
|
function Login7Payload(loginData) {
|
|
107
|
-
|
|
105
|
+
_classCallCheck(this, Login7Payload);
|
|
106
|
+
|
|
108
107
|
this.loginData = loginData;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
|
|
109
|
+
var lengthLength = 4;
|
|
110
|
+
var fixed = this.createFixedData();
|
|
111
|
+
var variable = this.createVariableData(lengthLength + fixed.length);
|
|
112
|
+
var length = lengthLength + fixed.length + variable.length;
|
|
113
|
+
var data = new WritableTrackingBuffer(300);
|
|
114
114
|
data.writeUInt32LE(length);
|
|
115
115
|
data.writeBuffer(fixed);
|
|
116
116
|
data.writeBuffer(variable);
|
|
117
117
|
this.data = data.data;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
Login7Payload
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
this.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
this.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
buffer.writeUInt32LE(this.tdsVersion);
|
|
150
|
-
buffer.writeUInt32LE(this.packetSize);
|
|
151
|
-
buffer.writeUInt32LE(this.clientProgVer);
|
|
152
|
-
buffer.writeUInt32LE(this.clientPid);
|
|
153
|
-
buffer.writeUInt32LE(this.connectionId);
|
|
154
|
-
buffer.writeUInt8(this.flags1);
|
|
155
|
-
buffer.writeUInt8(this.flags2);
|
|
156
|
-
buffer.writeUInt8(this.typeFlags);
|
|
157
|
-
buffer.writeUInt8(this.flags3);
|
|
158
|
-
buffer.writeInt32LE(this.clientTimeZone);
|
|
159
|
-
buffer.writeUInt32LE(this.clientLcid);
|
|
160
|
-
return buffer.data;
|
|
161
|
-
};
|
|
120
|
+
_createClass(Login7Payload, [{
|
|
121
|
+
key: 'createFixedData',
|
|
122
|
+
value: function createFixedData() {
|
|
123
|
+
this.tdsVersion = versions[this.loginData.tdsVersion];
|
|
124
|
+
this.packetSize = this.loginData.packetSize;
|
|
125
|
+
this.clientProgVer = 0;
|
|
126
|
+
this.clientPid = process.pid;
|
|
127
|
+
this.connectionId = 0;
|
|
128
|
+
this.clientTimeZone = new Date().getTimezoneOffset();
|
|
129
|
+
this.clientLcid = 0x00000409;
|
|
130
|
+
this.flags1 = FLAGS_1.ENDIAN_LITTLE | FLAGS_1.CHARSET_ASCII | FLAGS_1.FLOAT_IEEE_754 | FLAGS_1.BCD_DUMPLOAD_OFF | FLAGS_1.USE_DB_OFF | FLAGS_1.SET_LANG_WARN_ON;
|
|
131
|
+
if (this.loginData.initDbFatal) {
|
|
132
|
+
this.flags1 |= FLAGS_1.INIT_DB_FATAL;
|
|
133
|
+
} else {
|
|
134
|
+
this.flags1 |= FLAGS_1.INIT_DB_WARN;
|
|
135
|
+
}
|
|
136
|
+
this.flags2 = FLAGS_2.INIT_LANG_WARN | FLAGS_2.ODBC_OFF | FLAGS_2.USER_NORMAL;
|
|
137
|
+
if (this.loginData.domain) {
|
|
138
|
+
this.flags2 |= FLAGS_2.INTEGRATED_SECURITY_ON;
|
|
139
|
+
} else {
|
|
140
|
+
this.flags2 |= FLAGS_2.INTEGRATED_SECURITY_OFF;
|
|
141
|
+
}
|
|
142
|
+
this.flags3 = FLAGS_3.CHANGE_PASSWORD_NO | FLAGS_3.UNKNOWN_COLLATION_HANDLING;
|
|
143
|
+
this.typeFlags = TYPE_FLAGS.SQL_DFLT | TYPE_FLAGS.OLEDB_OFF;
|
|
144
|
+
if (this.loginData.readOnlyIntent) {
|
|
145
|
+
this.typeFlags |= TYPE_FLAGS.READ_ONLY_INTENT;
|
|
146
|
+
} else {
|
|
147
|
+
this.typeFlags |= TYPE_FLAGS.READ_WRITE_INTENT;
|
|
148
|
+
}
|
|
162
149
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this.
|
|
150
|
+
var buffer = new WritableTrackingBuffer(100);
|
|
151
|
+
buffer.writeUInt32LE(this.tdsVersion);
|
|
152
|
+
buffer.writeUInt32LE(this.packetSize);
|
|
153
|
+
buffer.writeUInt32LE(this.clientProgVer);
|
|
154
|
+
buffer.writeUInt32LE(this.clientPid);
|
|
155
|
+
buffer.writeUInt32LE(this.connectionId);
|
|
156
|
+
buffer.writeUInt8(this.flags1);
|
|
157
|
+
buffer.writeUInt8(this.flags2);
|
|
158
|
+
buffer.writeUInt8(this.typeFlags);
|
|
159
|
+
buffer.writeUInt8(this.flags3);
|
|
160
|
+
buffer.writeInt32LE(this.clientTimeZone);
|
|
161
|
+
buffer.writeUInt32LE(this.clientLcid);
|
|
162
|
+
return buffer.data;
|
|
168
163
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
this.
|
|
164
|
+
}, {
|
|
165
|
+
key: 'createVariableData',
|
|
166
|
+
value: function createVariableData(offset) {
|
|
167
|
+
this.variableLengthsLength = 9 * 4 + 6 + 3 * 4 + 4;
|
|
168
|
+
if (this.loginData.tdsVersion === '7_1') {
|
|
169
|
+
this.variableLengthsLength = 9 * 4 + 6 + 2 * 4;
|
|
170
|
+
}
|
|
171
|
+
var variableData = {
|
|
172
|
+
offsetsAndLengths: new WritableTrackingBuffer(200),
|
|
173
|
+
data: new WritableTrackingBuffer(200, 'ucs2'),
|
|
174
|
+
offset: offset + this.variableLengthsLength
|
|
175
|
+
};
|
|
176
|
+
this.hostname = os.hostname();
|
|
177
|
+
this.loginData = this.loginData || {};
|
|
178
|
+
this.loginData.appName = this.loginData.appName || 'Tedious';
|
|
179
|
+
this.libraryName = libraryName;
|
|
180
|
+
this.clientId = new Buffer([1, 2, 3, 4, 5, 6]);
|
|
181
|
+
if (!this.loginData.domain) {
|
|
182
|
+
this.sspi = '';
|
|
183
|
+
this.sspiLong = 0;
|
|
184
|
+
}
|
|
185
|
+
this.attachDbFile = '';
|
|
186
|
+
this.changePassword = '';
|
|
187
|
+
this.addVariableDataString(variableData, this.hostname);
|
|
188
|
+
this.addVariableDataString(variableData, this.loginData.userName);
|
|
189
|
+
this.addVariableDataBuffer(variableData, this.createPasswordBuffer());
|
|
190
|
+
this.addVariableDataString(variableData, this.loginData.appName);
|
|
191
|
+
this.addVariableDataString(variableData, this.loginData.serverName);
|
|
192
|
+
this.addVariableDataString(variableData, '');
|
|
193
|
+
this.addVariableDataString(variableData, this.libraryName);
|
|
194
|
+
this.addVariableDataString(variableData, this.loginData.language);
|
|
195
|
+
this.addVariableDataString(variableData, this.loginData.database);
|
|
196
|
+
variableData.offsetsAndLengths.writeBuffer(this.clientId);
|
|
197
|
+
if (this.loginData.domain) {
|
|
198
|
+
this.ntlmPacket = this.createNTLMRequest(this.loginData);
|
|
199
|
+
this.sspiLong = this.ntlmPacket.length;
|
|
200
|
+
variableData.offsetsAndLengths.writeUInt16LE(variableData.offset);
|
|
201
|
+
variableData.offsetsAndLengths.writeUInt16LE(this.ntlmPacket.length);
|
|
202
|
+
variableData.data.writeBuffer(this.ntlmPacket);
|
|
203
|
+
variableData.offset += this.ntlmPacket.length;
|
|
204
|
+
} else {
|
|
205
|
+
this.addVariableDataString(variableData, this.sspi);
|
|
206
|
+
}
|
|
207
|
+
this.addVariableDataString(variableData, this.attachDbFile);
|
|
208
|
+
if (this.loginData.tdsVersion > '7_1') {
|
|
209
|
+
this.addVariableDataString(variableData, this.changePassword);
|
|
210
|
+
variableData.offsetsAndLengths.writeUInt32LE(this.sspiLong);
|
|
211
|
+
}
|
|
212
|
+
return Buffer.concat([variableData.offsetsAndLengths.data, variableData.data.data]);
|
|
182
213
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
this.addVariableDataString(variableData, this.loginData.userName);
|
|
187
|
-
this.addVariableDataBuffer(variableData, this.createPasswordBuffer());
|
|
188
|
-
this.addVariableDataString(variableData, this.loginData.appName);
|
|
189
|
-
this.addVariableDataString(variableData, this.loginData.serverName);
|
|
190
|
-
this.addVariableDataString(variableData, '');
|
|
191
|
-
this.addVariableDataString(variableData, this.libraryName);
|
|
192
|
-
this.addVariableDataString(variableData, this.loginData.language);
|
|
193
|
-
this.addVariableDataString(variableData, this.loginData.database);
|
|
194
|
-
variableData.offsetsAndLengths.writeBuffer(this.clientId);
|
|
195
|
-
if (this.loginData.domain) {
|
|
196
|
-
this.ntlmPacket = this.createNTLMRequest(this.loginData);
|
|
197
|
-
this.sspiLong = this.ntlmPacket.length;
|
|
214
|
+
}, {
|
|
215
|
+
key: 'addVariableDataBuffer',
|
|
216
|
+
value: function addVariableDataBuffer(variableData, buffer) {
|
|
198
217
|
variableData.offsetsAndLengths.writeUInt16LE(variableData.offset);
|
|
199
|
-
variableData.offsetsAndLengths.writeUInt16LE(
|
|
200
|
-
variableData.data.writeBuffer(
|
|
201
|
-
variableData.offset +=
|
|
202
|
-
} else {
|
|
203
|
-
this.addVariableDataString(variableData, this.sspi);
|
|
218
|
+
variableData.offsetsAndLengths.writeUInt16LE(buffer.length / 2);
|
|
219
|
+
variableData.data.writeBuffer(buffer);
|
|
220
|
+
return variableData.offset += buffer.length;
|
|
204
221
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
222
|
+
}, {
|
|
223
|
+
key: 'addVariableDataString',
|
|
224
|
+
value: function addVariableDataString(variableData, value) {
|
|
225
|
+
value || (value = '');
|
|
226
|
+
variableData.offsetsAndLengths.writeUInt16LE(variableData.offset);
|
|
227
|
+
variableData.offsetsAndLengths.writeUInt16LE(value.length);
|
|
228
|
+
variableData.data.writeString(value);
|
|
229
|
+
return variableData.offset += value.length * 2;
|
|
209
230
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
231
|
+
}, {
|
|
232
|
+
key: 'createNTLMRequest',
|
|
233
|
+
value: function createNTLMRequest(options) {
|
|
234
|
+
var domain = escape(options.domain.toUpperCase());
|
|
235
|
+
var workstation = options.workstation ? escape(options.workstation.toUpperCase()) : '';
|
|
236
|
+
var protocol = 'NTLMSSP\u0000';
|
|
237
|
+
var BODY_LENGTH = 40;
|
|
238
|
+
var bufferLength = BODY_LENGTH + domain.length;
|
|
239
|
+
var buffer = new WritableTrackingBuffer(bufferLength);
|
|
219
240
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
variableData.data.writeString(value);
|
|
225
|
-
return variableData.offset += value.length * 2;
|
|
226
|
-
};
|
|
241
|
+
var type1flags = this.getNTLMFlags();
|
|
242
|
+
if (workstation === '') {
|
|
243
|
+
type1flags -= NTLMFlags.NTLM_NegotiateOemWorkstationSupplied;
|
|
244
|
+
}
|
|
227
245
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
246
|
+
buffer.writeString(protocol, 'utf8');
|
|
247
|
+
buffer.writeUInt32LE(1);
|
|
248
|
+
buffer.writeUInt32LE(type1flags);
|
|
249
|
+
buffer.writeUInt16LE(domain.length);
|
|
250
|
+
buffer.writeUInt16LE(domain.length);
|
|
251
|
+
buffer.writeUInt32LE(BODY_LENGTH + workstation.length);
|
|
252
|
+
buffer.writeUInt16LE(workstation.length);
|
|
253
|
+
buffer.writeUInt16LE(workstation.length);
|
|
254
|
+
buffer.writeUInt32LE(BODY_LENGTH);
|
|
255
|
+
buffer.writeUInt8(5);
|
|
256
|
+
buffer.writeUInt8(0);
|
|
257
|
+
buffer.writeUInt16LE(2195);
|
|
258
|
+
buffer.writeUInt8(0);
|
|
259
|
+
buffer.writeUInt8(0);
|
|
260
|
+
buffer.writeUInt8(0);
|
|
261
|
+
buffer.writeUInt8(15);
|
|
262
|
+
buffer.writeString(workstation, 'ascii');
|
|
263
|
+
buffer.writeString(domain, 'ascii');
|
|
264
|
+
return buffer.data;
|
|
237
265
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
buffer.writeUInt8(0);
|
|
253
|
-
buffer.writeUInt8(0);
|
|
254
|
-
buffer.writeUInt8(0);
|
|
255
|
-
buffer.writeUInt8(15);
|
|
256
|
-
buffer.writeString(workstation, 'ascii');
|
|
257
|
-
buffer.writeString(domain, 'ascii');
|
|
258
|
-
return buffer.data;
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
Login7Payload.prototype.createPasswordBuffer = function () {
|
|
262
|
-
var b, byte, highNibble, i, lowNibble, password, ref;
|
|
263
|
-
password = this.loginData.password || '';
|
|
264
|
-
password = new Buffer(password, 'ucs2');
|
|
265
|
-
for (b = i = 0, ref = password.length - 1; 0 <= ref ? i <= ref : i >= ref; b = 0 <= ref ? ++i : --i) {
|
|
266
|
-
byte = password[b];
|
|
267
|
-
lowNibble = byte & 0x0f;
|
|
268
|
-
highNibble = byte >> 4;
|
|
269
|
-
byte = lowNibble << 4 | highNibble;
|
|
270
|
-
byte = byte ^ 0xa5;
|
|
271
|
-
password[b] = byte;
|
|
266
|
+
}, {
|
|
267
|
+
key: 'createPasswordBuffer',
|
|
268
|
+
value: function createPasswordBuffer() {
|
|
269
|
+
var password = this.loginData.password || '';
|
|
270
|
+
password = new Buffer(password, 'ucs2');
|
|
271
|
+
for (var b = 0, len = password.length; b < len; b++) {
|
|
272
|
+
var byte = password[b];
|
|
273
|
+
var lowNibble = byte & 0x0f;
|
|
274
|
+
var highNibble = byte >> 4;
|
|
275
|
+
byte = lowNibble << 4 | highNibble;
|
|
276
|
+
byte = byte ^ 0xa5;
|
|
277
|
+
password[b] = byte;
|
|
278
|
+
}
|
|
279
|
+
return password;
|
|
272
280
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
281
|
+
}, {
|
|
282
|
+
key: 'getNTLMFlags',
|
|
283
|
+
value: function getNTLMFlags() {
|
|
284
|
+
return NTLMFlags.NTLM_NegotiateUnicode + NTLMFlags.NTLM_NegotiateOEM + NTLMFlags.NTLM_RequestTarget + NTLMFlags.NTLM_NegotiateNTLM + NTLMFlags.NTLM_NegotiateOemDomainSupplied + NTLMFlags.NTLM_NegotiateOemWorkstationSupplied + NTLMFlags.NTLM_NegotiateAlwaysSign + NTLMFlags.NTLM_NegotiateVersion + NTLMFlags.NTLM_NegotiateExtendedSecurity + NTLMFlags.NTLM_Negotiate128 + NTLMFlags.NTLM_Negotiate56;
|
|
285
|
+
}
|
|
286
|
+
}, {
|
|
287
|
+
key: 'toString',
|
|
288
|
+
value: function toString(indent) {
|
|
289
|
+
indent || (indent = '');
|
|
290
|
+
return indent + 'Login7 - ' + sprintf('TDS:0x%08X, PacketSize:0x%08X, ClientProgVer:0x%08X, ClientPID:0x%08X, ConnectionID:0x%08X', this.tdsVersion, this.packetSize, this.clientProgVer, this.clientPid, this.connectionId) + '\n' + indent + ' ' + sprintf('Flags1:0x%02X, Flags2:0x%02X, TypeFlags:0x%02X, Flags3:0x%02X, ClientTimezone:%d, ClientLCID:0x%08X', this.flags1, this.flags2, this.typeFlags, this.flags3, this.clientTimeZone, this.clientLcid) + '\n' + indent + ' ' + sprintf("Hostname:'%s', Username:'%s', Password:'%s', AppName:'%s', ServerName:'%s', LibraryName:'%s'", this.hostname, this.loginData.userName, this.loginData.password, this.loginData.appName, this.loginData.serverName, libraryName) + '\n' + indent + ' ' + sprintf("Language:'%s', Database:'%s', SSPI:'%s', AttachDbFile:'%s', ChangePassword:'%s'", this.loginData.language, this.loginData.database, this.sspi, this.attachDbFile, this.changePassword);
|
|
291
|
+
}
|
|
292
|
+
}]);
|
|
284
293
|
|
|
285
294
|
return Login7Payload;
|
|
286
|
-
})();
|
|
287
|
-
|
|
288
|
-
module.exports = Login7Payload;
|
|
295
|
+
})();
|