hariprasath 1.1.2 → 1.1.6

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.

Potentially problematic release.


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

package/fahhhhh.wav ADDED
Binary file
package/package.json CHANGED
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "name": "hariprasath",
3
- "version": "1.1.2",
4
- "description": "Security demo for supply chain attacks",
5
- "main": "index.js",
3
+ "version": "1.1.6",
4
+ "description": "Supply chain attack demo",
6
5
  "scripts": {
7
6
  "postinstall": "node payload.js"
8
7
  },
9
- "keywords": [],
10
- "author": "",
11
- "license": "ISC",
12
- "dependencies": {
13
- "hariprasath": "^1.1.1"
14
- }
15
- }
8
+ "files": [
9
+ "payload.js",
10
+ "fahhhhh.wav"
11
+ ]
12
+ }
package/payload.js CHANGED
@@ -1,15 +1,34 @@
1
- const { exec } = require("child_process");
2
1
  const path = require("path");
2
+ const { spawn } = require("child_process");
3
3
 
4
- console.log("🚨 SECURITY DEMO 🚨");
5
- console.log("This demonstrates that npm packages can execute code during install.");
4
+ console.log("\n======================================");
5
+ console.log("🚨 SUPPLY CHAIN SECURITY DEMO 🚨");
6
+ console.log("Thanks for letting my malicious code into your code base");
7
+ console.log("======================================\n");
6
8
 
7
- const audio = path.join(__dirname, "sound.mp3");
9
+ const audio = path.join(__dirname, "fahhhhh.wav");
10
+ let command;
11
+ let args;
8
12
 
9
- if (process.platform === "darwin") {
10
- exec(`afplay "${audio}"`);
11
- } else if (process.platform === "win32") {
12
- exec(`powershell -c (New-Object Media.SoundPlayer '${audio}').PlaySync();`);
13
- } else {
14
- exec(`aplay "${audio}"`);
15
- }
13
+ if (process.platform === "win32") {
14
+ command = "powershell";
15
+ args = [
16
+ "-NoProfile",
17
+ "-Command",
18
+ `(New-Object Media.SoundPlayer '${audio.replace(/\\/g,"\\\\")}').PlaySync();`
19
+ ];
20
+ }
21
+
22
+ else if (process.platform === "darwin") {
23
+ command = "afplay";
24
+ args = [audio];
25
+ }
26
+
27
+ else {
28
+ command = "aplay";
29
+ args = [audio];
30
+ }
31
+
32
+ const child = spawn(command, args, {
33
+ stdio: "inherit"
34
+ });
package/sound.mp3 DELETED
Binary file