@xulongzhe/clawbench-desktop-linux-x64-payload 0.102.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.
Files changed (120) hide show
  1. package/package.json +10 -0
  2. package/payload.json +4 -0
  3. package/resources/app.asar +0 -0
  4. package/resources/app.asar.unpacked/node_modules/cpu-features/.eslintrc.js +5 -0
  5. package/resources/app.asar.unpacked/node_modules/cpu-features/LICENSE +19 -0
  6. package/resources/app.asar.unpacked/node_modules/cpu-features/build/Release/cpufeatures.node +0 -0
  7. package/resources/app.asar.unpacked/node_modules/cpu-features/build/deps/cpu_features/cpu_features.Makefile +6 -0
  8. package/resources/app.asar.unpacked/node_modules/cpu-features/buildcheck.gypi +19 -0
  9. package/resources/app.asar.unpacked/node_modules/cpu-features/buildcheck.js +32 -0
  10. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/.clang-format +4 -0
  11. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/.dockerignore +31 -0
  12. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/.grenrc.yml +21 -0
  13. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/BUILD.bazel +329 -0
  14. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt +261 -0
  15. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/CONTRIBUTING.md +23 -0
  16. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/LICENSE +230 -0
  17. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/README.md +272 -0
  18. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/WORKSPACE +19 -0
  19. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/bazel/ci/README.md +5 -0
  20. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/bazel/platforms.bzl +11 -0
  21. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesConfig.cmake.in +3 -0
  22. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesNdkCompatConfig.cmake.in +3 -0
  23. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/README.md +30 -0
  24. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/Makefile +252 -0
  25. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/README.md +40 -0
  26. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.dot +64 -0
  27. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.svg +312 -0
  28. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/generate_image.sh +7 -0
  29. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/amd64/Dockerfile +48 -0
  30. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/toolchain/Dockerfile +34 -0
  31. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/CMakeLists.txt +22 -0
  32. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/main.cpp +11 -0
  33. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/vagrant/freebsd/Vagrantfile +107 -0
  34. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/googletest.CMakeLists.txt.in +15 -0
  35. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cpu_features.gyp +105 -0
  36. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpu_features_cache_info.h +54 -0
  37. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpu_features_macros.h +384 -0
  38. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_aarch64.h +259 -0
  39. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h +121 -0
  40. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_mips.h +74 -0
  41. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_ppc.h +149 -0
  42. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_riscv.h +72 -0
  43. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_s390x.h +108 -0
  44. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_x86.h +288 -0
  45. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/bit_utils.h +40 -0
  46. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/cpuid_x86.h +37 -0
  47. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/filesystem.h +39 -0
  48. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/hwcaps.h +240 -0
  49. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/stack_line_reader.h +49 -0
  50. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/string_view.h +110 -0
  51. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/windows_utils.h +70 -0
  52. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/CMakeLists.txt +60 -0
  53. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/README.md +4 -0
  54. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.c +205 -0
  55. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.h +320 -0
  56. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/ndk-compat-test.c +12 -0
  57. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/patches/0001-Add-Apple-Silicon-Support.patch +456 -0
  58. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/generate_badges.d +165 -0
  59. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/make_release.sh +75 -0
  60. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/run_integration.sh +490 -0
  61. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/test_integration.sh +79 -0
  62. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/copy.inl +19 -0
  63. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/define_introspection.inl +86 -0
  64. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/define_introspection_and_hwcaps.inl +26 -0
  65. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/equals.inl +22 -0
  66. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/filesystem.c +62 -0
  67. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/hwcaps.c +169 -0
  68. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64__base_implementation.inl +88 -0
  69. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_linux_or_android.c +79 -0
  70. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.c +82 -0
  71. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_windows.c +138 -0
  72. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_arm_linux_or_android.c +212 -0
  73. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_mips_linux_or_android.c +93 -0
  74. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_ppc_linux.c +163 -0
  75. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_riscv_linux.c +111 -0
  76. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_s390x_linux.c +120 -0
  77. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86__base_implementation.inl +2055 -0
  78. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_freebsd.c +68 -0
  79. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_linux_or_android.c +58 -0
  80. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_macos.c +57 -0
  81. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_windows.c +58 -0
  82. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/stack_line_reader.c +132 -0
  83. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/string_view.c +192 -0
  84. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/utils/list_cpu_features.c +461 -0
  85. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/test/CMakeLists.txt +114 -0
  86. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.h +61 -0
  87. package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.h +31 -0
  88. package/resources/app.asar.unpacked/node_modules/cpu-features/lib/index.js +5 -0
  89. package/resources/app.asar.unpacked/node_modules/cpu-features/package.json +28 -0
  90. package/resources/app.asar.unpacked/node_modules/ssh2/.eslintignore +4 -0
  91. package/resources/app.asar.unpacked/node_modules/ssh2/.eslintrc.js +5 -0
  92. package/resources/app.asar.unpacked/node_modules/ssh2/LICENSE +19 -0
  93. package/resources/app.asar.unpacked/node_modules/ssh2/SFTP.md +413 -0
  94. package/resources/app.asar.unpacked/node_modules/ssh2/install.js +27 -0
  95. package/resources/app.asar.unpacked/node_modules/ssh2/lib/Channel.js +295 -0
  96. package/resources/app.asar.unpacked/node_modules/ssh2/lib/agent.js +1123 -0
  97. package/resources/app.asar.unpacked/node_modules/ssh2/lib/client.js +2176 -0
  98. package/resources/app.asar.unpacked/node_modules/ssh2/lib/http-agents.js +84 -0
  99. package/resources/app.asar.unpacked/node_modules/ssh2/lib/index.js +44 -0
  100. package/resources/app.asar.unpacked/node_modules/ssh2/lib/keygen.js +582 -0
  101. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/Protocol.js +2136 -0
  102. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/SFTP.js +4052 -0
  103. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/constants.js +356 -0
  104. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node +0 -0
  105. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/crypto/poly1305.js +43 -0
  106. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/crypto.js +1602 -0
  107. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/handlers.js +16 -0
  108. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/handlers.misc.js +1285 -0
  109. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/kex.js +1908 -0
  110. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/keyParser.js +1484 -0
  111. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/node-fs-compat.js +115 -0
  112. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/utils.js +356 -0
  113. package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/zlib.js +255 -0
  114. package/resources/app.asar.unpacked/node_modules/ssh2/lib/server.js +1380 -0
  115. package/resources/app.asar.unpacked/node_modules/ssh2/lib/utils.js +336 -0
  116. package/resources/app.asar.unpacked/node_modules/ssh2/package.json +32 -0
  117. package/resources/app.asar.unpacked/node_modules/ssh2/util/build_pagent.bat +2 -0
  118. package/resources/app.asar.unpacked/node_modules/ssh2/util/pagent.c +88 -0
  119. package/resources/login.html +1777 -0
  120. package/resources/logo.png +0 -0
@@ -0,0 +1,336 @@
1
+ 'use strict';
2
+
3
+ const { SFTP } = require('./protocol/SFTP.js');
4
+
5
+ const MAX_CHANNEL = 2 ** 32 - 1;
6
+
7
+ function onChannelOpenFailure(self, recipient, info, cb) {
8
+ self._chanMgr.remove(recipient);
9
+ if (typeof cb !== 'function')
10
+ return;
11
+
12
+ let err;
13
+ if (info instanceof Error) {
14
+ err = info;
15
+ } else if (typeof info === 'object' && info !== null) {
16
+ err = new Error(`(SSH) Channel open failure: ${info.description}`);
17
+ err.reason = info.reason;
18
+ } else {
19
+ err = new Error(
20
+ '(SSH) Channel open failure: server closed channel unexpectedly'
21
+ );
22
+ err.reason = '';
23
+ }
24
+
25
+ cb(err);
26
+ }
27
+
28
+ function onCHANNEL_CLOSE(self, recipient, channel, err, dead) {
29
+ if (typeof channel === 'function') {
30
+ // We got CHANNEL_CLOSE instead of CHANNEL_OPEN_FAILURE when
31
+ // requesting to open a channel
32
+ onChannelOpenFailure(self, recipient, err, channel);
33
+ return;
34
+ }
35
+
36
+ if (typeof channel !== 'object' || channel === null)
37
+ return;
38
+
39
+ if (channel.incoming && channel.incoming.state === 'closed')
40
+ return;
41
+
42
+ self._chanMgr.remove(recipient);
43
+
44
+ if (channel.server && channel.constructor.name === 'Session')
45
+ return;
46
+
47
+ channel.incoming.state = 'closed';
48
+
49
+ if (channel.readable)
50
+ channel.push(null);
51
+ if (channel.server) {
52
+ if (channel.stderr.writable)
53
+ channel.stderr.end();
54
+ } else if (channel.stderr.readable) {
55
+ channel.stderr.push(null);
56
+ }
57
+
58
+ if (channel.constructor !== SFTP
59
+ && (channel.outgoing.state === 'open'
60
+ || channel.outgoing.state === 'eof')
61
+ && !dead) {
62
+ channel.close();
63
+ }
64
+ if (channel.outgoing.state === 'closing')
65
+ channel.outgoing.state = 'closed';
66
+
67
+ const readState = channel._readableState;
68
+ const writeState = channel._writableState;
69
+ if (writeState && !writeState.ending && !writeState.finished && !dead)
70
+ channel.end();
71
+
72
+ // Take care of any outstanding channel requests
73
+ const chanCallbacks = channel._callbacks;
74
+ channel._callbacks = [];
75
+ for (let i = 0; i < chanCallbacks.length; ++i)
76
+ chanCallbacks[i](true);
77
+
78
+ if (channel.server) {
79
+ if (!channel.readable
80
+ || channel.destroyed
81
+ || (readState && readState.endEmitted)) {
82
+ channel.emit('close');
83
+ } else {
84
+ channel.once('end', () => channel.emit('close'));
85
+ }
86
+ } else {
87
+ let doClose;
88
+ switch (channel.type) {
89
+ case 'direct-streamlocal@openssh.com':
90
+ case 'direct-tcpip':
91
+ doClose = () => channel.emit('close');
92
+ break;
93
+ default: {
94
+ // Align more with node child processes, where the close event gets
95
+ // the same arguments as the exit event
96
+ const exit = channel._exit;
97
+ doClose = () => {
98
+ if (exit.code === null)
99
+ channel.emit('close', exit.code, exit.signal, exit.dump, exit.desc);
100
+ else
101
+ channel.emit('close', exit.code);
102
+ };
103
+ }
104
+ }
105
+ if (!channel.readable
106
+ || channel.destroyed
107
+ || (readState && readState.endEmitted)) {
108
+ doClose();
109
+ } else {
110
+ channel.once('end', doClose);
111
+ }
112
+
113
+ const errReadState = channel.stderr._readableState;
114
+ if (!channel.stderr.readable
115
+ || channel.stderr.destroyed
116
+ || (errReadState && errReadState.endEmitted)) {
117
+ channel.stderr.emit('close');
118
+ } else {
119
+ channel.stderr.once('end', () => channel.stderr.emit('close'));
120
+ }
121
+ }
122
+ }
123
+
124
+ class ChannelManager {
125
+ constructor(client) {
126
+ this._client = client;
127
+ this._channels = {};
128
+ this._cur = -1;
129
+ this._count = 0;
130
+ }
131
+ add(val) {
132
+ // Attempt to reserve an id
133
+
134
+ let id;
135
+ // Optimized paths
136
+ if (this._cur < MAX_CHANNEL) {
137
+ id = ++this._cur;
138
+ } else if (this._count === 0) {
139
+ // Revert and reset back to fast path once we no longer have any channels
140
+ // open
141
+ this._cur = 0;
142
+ id = 0;
143
+ } else {
144
+ // Slower lookup path
145
+
146
+ // This path is triggered we have opened at least MAX_CHANNEL channels
147
+ // while having at least one channel open at any given time, so we have
148
+ // to search for a free id.
149
+ const channels = this._channels;
150
+ for (let i = 0; i < MAX_CHANNEL; ++i) {
151
+ if (channels[i] === undefined) {
152
+ id = i;
153
+ break;
154
+ }
155
+ }
156
+ }
157
+
158
+ if (id === undefined)
159
+ return -1;
160
+
161
+ this._channels[id] = (val || true);
162
+ ++this._count;
163
+
164
+ return id;
165
+ }
166
+ update(id, val) {
167
+ if (typeof id !== 'number' || id < 0 || id >= MAX_CHANNEL || !isFinite(id))
168
+ throw new Error(`Invalid channel id: ${id}`);
169
+
170
+ if (val && this._channels[id])
171
+ this._channels[id] = val;
172
+ }
173
+ get(id) {
174
+ if (typeof id !== 'number' || id < 0 || id >= MAX_CHANNEL || !isFinite(id))
175
+ throw new Error(`Invalid channel id: ${id}`);
176
+
177
+ return this._channels[id];
178
+ }
179
+ remove(id) {
180
+ if (typeof id !== 'number' || id < 0 || id >= MAX_CHANNEL || !isFinite(id))
181
+ throw new Error(`Invalid channel id: ${id}`);
182
+
183
+ if (this._channels[id]) {
184
+ delete this._channels[id];
185
+ if (this._count)
186
+ --this._count;
187
+ }
188
+ }
189
+ cleanup(err) {
190
+ const channels = this._channels;
191
+ this._channels = {};
192
+ this._cur = -1;
193
+ this._count = 0;
194
+
195
+ const chanIDs = Object.keys(channels);
196
+ const client = this._client;
197
+ for (let i = 0; i < chanIDs.length; ++i) {
198
+ const id = +chanIDs[i];
199
+ const channel = channels[id];
200
+ onCHANNEL_CLOSE(client, id, channel._channel || channel, err, true);
201
+ }
202
+ }
203
+ }
204
+
205
+ const isRegExp = (() => {
206
+ const toString = Object.prototype.toString;
207
+ return (val) => toString.call(val) === '[object RegExp]';
208
+ })();
209
+
210
+ function generateAlgorithmList(algoList, defaultList, supportedList) {
211
+ if (Array.isArray(algoList) && algoList.length > 0) {
212
+ // Exact list
213
+ for (let i = 0; i < algoList.length; ++i) {
214
+ if (supportedList.indexOf(algoList[i]) === -1)
215
+ throw new Error(`Unsupported algorithm: ${algoList[i]}`);
216
+ }
217
+ return algoList;
218
+ }
219
+
220
+ if (typeof algoList === 'object' && algoList !== null) {
221
+ // Operations based on the default list
222
+ const keys = Object.keys(algoList);
223
+ let list = defaultList;
224
+ for (let i = 0; i < keys.length; ++i) {
225
+ const key = keys[i];
226
+ let val = algoList[key];
227
+ switch (key) {
228
+ case 'append':
229
+ if (!Array.isArray(val))
230
+ val = [val];
231
+ if (Array.isArray(val)) {
232
+ for (let j = 0; j < val.length; ++j) {
233
+ const append = val[j];
234
+ if (typeof append === 'string') {
235
+ if (!append || list.indexOf(append) !== -1)
236
+ continue;
237
+ if (supportedList.indexOf(append) === -1)
238
+ throw new Error(`Unsupported algorithm: ${append}`);
239
+ if (list === defaultList)
240
+ list = list.slice();
241
+ list.push(append);
242
+ } else if (isRegExp(append)) {
243
+ for (let k = 0; k < supportedList.length; ++k) {
244
+ const algo = supportedList[k];
245
+ if (append.test(algo)) {
246
+ if (list.indexOf(algo) !== -1)
247
+ continue;
248
+ if (list === defaultList)
249
+ list = list.slice();
250
+ list.push(algo);
251
+ }
252
+ }
253
+ }
254
+ }
255
+ }
256
+ break;
257
+ case 'prepend':
258
+ if (!Array.isArray(val))
259
+ val = [val];
260
+ if (Array.isArray(val)) {
261
+ for (let j = val.length; j >= 0; --j) {
262
+ const prepend = val[j];
263
+ if (typeof prepend === 'string') {
264
+ if (!prepend || list.indexOf(prepend) !== -1)
265
+ continue;
266
+ if (supportedList.indexOf(prepend) === -1)
267
+ throw new Error(`Unsupported algorithm: ${prepend}`);
268
+ if (list === defaultList)
269
+ list = list.slice();
270
+ list.unshift(prepend);
271
+ } else if (isRegExp(prepend)) {
272
+ for (let k = supportedList.length; k >= 0; --k) {
273
+ const algo = supportedList[k];
274
+ if (prepend.test(algo)) {
275
+ if (list.indexOf(algo) !== -1)
276
+ continue;
277
+ if (list === defaultList)
278
+ list = list.slice();
279
+ list.unshift(algo);
280
+ }
281
+ }
282
+ }
283
+ }
284
+ }
285
+ break;
286
+ case 'remove':
287
+ if (!Array.isArray(val))
288
+ val = [val];
289
+ if (Array.isArray(val)) {
290
+ for (let j = 0; j < val.length; ++j) {
291
+ const search = val[j];
292
+ if (typeof search === 'string') {
293
+ if (!search)
294
+ continue;
295
+ const idx = list.indexOf(search);
296
+ if (idx === -1)
297
+ continue;
298
+ if (list === defaultList)
299
+ list = list.slice();
300
+ list.splice(idx, 1);
301
+ } else if (isRegExp(search)) {
302
+ for (let k = 0; k < list.length; ++k) {
303
+ if (search.test(list[k])) {
304
+ if (list === defaultList)
305
+ list = list.slice();
306
+ list.splice(k, 1);
307
+ --k;
308
+ }
309
+ }
310
+ }
311
+ }
312
+ }
313
+ break;
314
+ }
315
+ }
316
+
317
+ return list;
318
+ }
319
+
320
+ return defaultList;
321
+ }
322
+
323
+ module.exports = {
324
+ ChannelManager,
325
+ generateAlgorithmList,
326
+ onChannelOpenFailure,
327
+ onCHANNEL_CLOSE,
328
+ isWritable: (stream) => {
329
+ // XXX: hack to workaround regression in node
330
+ // See: https://github.com/nodejs/node/issues/36029
331
+ return (stream
332
+ && stream.writable
333
+ && stream._readableState
334
+ && stream._readableState.ended === false);
335
+ },
336
+ };
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "ssh2",
3
+ "version": "1.17.0",
4
+ "author": "Brian White <mscdex@mscdex.net>",
5
+ "description": "SSH2 client and server modules written in pure JavaScript for node.js",
6
+ "main": "./lib/index.js",
7
+ "engines": {
8
+ "node": ">=10.16.0"
9
+ },
10
+ "dependencies": {
11
+ "asn1": "^0.2.6",
12
+ "bcrypt-pbkdf": "^1.0.2"
13
+ },
14
+ "devDependencies": {
15
+ "@mscdex/eslint-config": "^1.1.0",
16
+ "eslint": "^7.32.0"
17
+ },
18
+ "optionalDependencies": {
19
+ "cpu-features": "~0.0.10",
20
+ "nan": "^2.23.0"
21
+ },
22
+ "licenses": [
23
+ {
24
+ "type": "MIT",
25
+ "url": "http://github.com/mscdex/ssh2/raw/master/LICENSE"
26
+ }
27
+ ],
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "http://github.com/mscdex/ssh2.git"
31
+ }
32
+ }
@@ -0,0 +1,2 @@
1
+ @cl /Ox pagent.c User32.lib
2
+ @del /Q *.obj
@@ -0,0 +1,88 @@
1
+ #include <windows.h>
2
+ #include <stdio.h>
3
+ #include <fcntl.h>
4
+
5
+ #define AGENT_COPYDATA_ID 0x804e50ba
6
+ #define AGENT_MAX_MSGLEN 8192
7
+
8
+ #define GET_32BIT_MSB_FIRST(cp) \
9
+ (((unsigned long)(unsigned char)(cp)[0] << 24) | \
10
+ ((unsigned long)(unsigned char)(cp)[1] << 16) | \
11
+ ((unsigned long)(unsigned char)(cp)[2] << 8) | \
12
+ ((unsigned long)(unsigned char)(cp)[3]))
13
+
14
+ #define GET_32BIT(cp) GET_32BIT_MSB_FIRST(cp)
15
+
16
+ #define RET_ERR_BADARGS 10
17
+ #define RET_ERR_UNAVAILABLE 11
18
+ #define RET_ERR_NOMAP 12
19
+ #define RET_ERR_BINSTDIN 13
20
+ #define RET_ERR_BINSTDOUT 14
21
+ #define RET_ERR_BADLEN 15
22
+
23
+ #define RET_NORESPONSE 1
24
+ #define RET_RESPONSE 0
25
+
26
+ int main (int argc, const char* argv[]) {
27
+ HWND hwnd;
28
+ char *mapname;
29
+ HANDLE filemap;
30
+ unsigned char *p, *ret;
31
+ int id, retlen, inlen, n, rmode, r = RET_NORESPONSE;
32
+ COPYDATASTRUCT cds;
33
+ void *in;
34
+
35
+ if (argc < 2)
36
+ return RET_ERR_BADARGS;
37
+
38
+ hwnd = FindWindow("Pageant", "Pageant");
39
+ if (!hwnd)
40
+ return RET_ERR_UNAVAILABLE;
41
+
42
+ rmode = _setmode(_fileno(stdin), _O_BINARY);
43
+ if (rmode == -1)
44
+ return RET_ERR_BINSTDIN;
45
+
46
+ rmode = _setmode(_fileno(stdout), _O_BINARY);
47
+ if (rmode == -1)
48
+ return RET_ERR_BINSTDOUT;
49
+
50
+ inlen = atoi(argv[1]);
51
+ in = malloc(inlen);
52
+ n = fread(in, 1, inlen, stdin);
53
+ if (n != inlen) {
54
+ free(in);
55
+ return RET_ERR_BADLEN;
56
+ }
57
+
58
+ mapname = malloc(32);
59
+ n = sprintf(mapname, "PageantRequest%08x", (unsigned)GetCurrentThreadId());
60
+
61
+ filemap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
62
+ 0, AGENT_MAX_MSGLEN, mapname);
63
+ if (filemap == NULL || filemap == INVALID_HANDLE_VALUE) {
64
+ free(in);
65
+ free(mapname);
66
+ return RET_ERR_NOMAP;
67
+ }
68
+
69
+ p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, 0);
70
+ memcpy(p, in, inlen);
71
+ cds.dwData = AGENT_COPYDATA_ID;
72
+ cds.cbData = 1 + n;
73
+ cds.lpData = mapname;
74
+
75
+ id = SendMessage(hwnd, WM_COPYDATA, (WPARAM) NULL, (LPARAM) &cds);
76
+ if (id > 0) {
77
+ r = RET_RESPONSE;
78
+ retlen = 4 + GET_32BIT(p);
79
+ fwrite(p, 1, retlen, stdout);
80
+ }
81
+
82
+ free(in);
83
+ free(mapname);
84
+ UnmapViewOfFile(p);
85
+ CloseHandle(filemap);
86
+
87
+ return r;
88
+ }