77cc570dfd5c1e7a700472f9499426034c285f4b
[motion-next.git] / server / config / license / hardware.js
1 const a843_0x3f5c=['win32','family','internal','execSync','IPv4','child_process','filter','concat','utf8','lodash','hex','substring','exports','md5','address','ipAddress','orderBy','model','join','networkInterfaces','127.0.0.1','test','replace','../config.service','map','cpus','mac','macAddress','digest','dmidecode\x20--string\x20system-uuid','devLicense','platform','createHash','keys','update'];(function(_0x51506a,_0x3f5c1e){const _0x52cefd=function(_0x461a2a){while(--_0x461a2a){_0x51506a['push'](_0x51506a['shift']());}};_0x52cefd(++_0x3f5c1e);}(a843_0x3f5c,0x8c));const a843_0x52ce=function(_0x51506a,_0x3f5c1e){_0x51506a=_0x51506a-0x0;let _0x52cefd=a843_0x3f5c[_0x51506a];return _0x52cefd;};const _0x4a184e=a843_0x52ce;'use strict';const _=require(_0x4a184e('0x9')),os=require('os'),crypto=require('crypto'),{getConfigService}=require(_0x4a184e('0x17')),exec=require(_0x4a184e('0x5'))[_0x4a184e('0x3')];function getInterfaces(){const _0x54a673=_0x4a184e;let _0x461a2a=[];const _0x455610=os[_0x54a673('0x13')](),_0x41c66d=_['orderBy'](_[_0x54a673('0x21')](_0x455610));for(let _0x3ccaea=0x0;_0x3ccaea<_0x41c66d['length'];_0x3ccaea++){const _0x591af7=_0x455610[_0x41c66d[_0x3ccaea]][_0x54a673('0x6')](function(_0xc2c5ed){const _0x93d6a8=_0x54a673;return _0xc2c5ed[_0x93d6a8('0x1')]===_0x93d6a8('0x4')&&_0xc2c5ed[_0x93d6a8('0x2')]===![];});_0x461a2a=_0x461a2a[_0x54a673('0x7')](_0x591af7);}return _0x461a2a;}function getFirstInterface(){const _0x247bf3=_0x4a184e,_0x5884a4=_['head'](getInterfaces());return{'macAddress':_0x5884a4&&_0x5884a4[_0x247bf3('0x1a')]?_0x5884a4[_0x247bf3('0x1a')]:'00:00:00:00:00:00','ipAddress':_0x5884a4&&_0x5884a4['address']?_0x5884a4[_0x247bf3('0xe')]:_0x247bf3('0x14')};}function getCPUhash(){const _0x44a844=_0x4a184e,_0x1d67f0=_[_0x44a844('0x10')](os[_0x44a844('0x19')]()[_0x44a844('0x18')](function(_0x309259){const _0x243983=_0x44a844;return _0x309259[_0x243983('0x11')];}))[_0x44a844('0x12')](':');return crypto['createHash'](_0x44a844('0xd'))[_0x44a844('0x22')](_0x1d67f0)[_0x44a844('0x1c')]('hex');}function getUuid(){const _0x53143e=_0x4a184e,_0x2eb262=getConfigService(),_0x1d9320=os[_0x53143e('0x1f')](),_0x55df9c=/[0-9a-f-]{36}/;if(!_0x2eb262['isProduction']&&_0x55df9c[_0x53143e('0x15')](_0x2eb262[_0x53143e('0x1e')]))return _0x2eb262[_0x53143e('0x1e')];else{if(_0x1d9320===_0x53143e('0x0'))return exec(_0x53143e('0x1d'),{'encoding':_0x53143e('0x8')})[_0x53143e('0x16')]('\x0d\x0a','');else{const _0x1922e4=getFirstInterface(),_0x1016e9=getCPUhash(),_0x2a73e3=_0x1016e9+'|'+os['hostname']()+'|'+_0x1922e4[_0x53143e('0x1b')]+'|'+_0x1922e4[_0x53143e('0xf')],_0x42df24=crypto[_0x53143e('0x20')](_0x53143e('0xd'))[_0x53143e('0x22')](_0x2a73e3)[_0x53143e('0x1c')](_0x53143e('0xa'));return _0x42df24[_0x53143e('0xb')](0x0,0x8)+'-'+_0x42df24[_0x53143e('0xb')](0x8,0xc)+'-'+_0x42df24['substring'](0xc,0x10)+'-'+_0x42df24['substring'](0x10,0x14)+'-'+_0x42df24[_0x53143e('0xb')](0x14);}}}module[_0x4a184e('0xc')]={'getUuid':getUuid,'getFirstInterface':getFirstInterface,'getCPUhash':getCPUhash};