ee6aa2f968928a20b7c074574aeb9d6df16b3dfa
[motion-next.git] / server / config / license / hardware.js
1 const a1004_0x17d7=['macAddress','../config.service','length','isProduction','hex','00:00:00:00:00:00','digest','127.0.0.1','address','join','filter','md5','getUuid','child_process','keys','win32','platform','model','lodash','IPv4','internal','utf8','devLicense','dmidecode\x20--string\x20system-uuid','head','map','cpus','family','substring','hostname','createHash','exports','update','networkInterfaces','orderBy'];(function(_0x3a63a2,_0x41f1d9){const _0x17d7b6=function(_0x4df2eb){while(--_0x4df2eb){_0x3a63a2['push'](_0x3a63a2['shift']());}};_0x17d7b6(++_0x41f1d9);}(a1004_0x17d7,0xb1));const a1004_0x4df2=function(_0x3a63a2,_0x41f1d9){_0x3a63a2=_0x3a63a2-0x7f;let _0x17d7b6=a1004_0x17d7[_0x3a63a2];return _0x17d7b6;};const a1004_0x498ef4=a1004_0x4df2;'use strict';const _=require(a1004_0x498ef4(0x8f)),os=require('os'),crypto=require('crypto'),{getConfigService}=require(a1004_0x498ef4(0xa1)),exec=require(a1004_0x498ef4(0x8a))['execSync'];function getInterfaces(){const _0x4f1a99=a1004_0x498ef4;let _0x13182a=[];const _0x1f74d6=os[_0x4f1a99(0x9e)](),_0x299d95=_[_0x4f1a99(0x9f)](_[_0x4f1a99(0x8b)](_0x1f74d6));for(let _0x2429fd=0x0;_0x2429fd<_0x299d95[_0x4f1a99(0x7f)];_0x2429fd++){const _0x4ec380=_0x1f74d6[_0x299d95[_0x2429fd]][_0x4f1a99(0x87)](function(_0x311a31){const _0x564147=_0x4f1a99;return _0x311a31[_0x564147(0x98)]===_0x564147(0x90)&&_0x311a31[_0x564147(0x91)]===![];});_0x13182a=_0x13182a['concat'](_0x4ec380);}return _0x13182a;}function getFirstInterface(){const _0x904811=a1004_0x498ef4,_0x163efa=_[_0x904811(0x95)](getInterfaces());return{'macAddress':_0x163efa&&_0x163efa['mac']?_0x163efa['mac']:_0x904811(0x82),'ipAddress':_0x163efa&&_0x163efa[_0x904811(0x85)]?_0x163efa[_0x904811(0x85)]:_0x904811(0x84)};}function getCPUhash(){const _0x38e915=a1004_0x498ef4,_0x2f265c=_[_0x38e915(0x9f)](os[_0x38e915(0x97)]()[_0x38e915(0x96)](function(_0x4576b5){const _0x358b8e=_0x38e915;return _0x4576b5[_0x358b8e(0x8e)];}))[_0x38e915(0x86)](':');return crypto[_0x38e915(0x9b)](_0x38e915(0x88))[_0x38e915(0x9d)](_0x2f265c)[_0x38e915(0x83)](_0x38e915(0x81));}function getUuid(){const _0x41905b=a1004_0x498ef4,_0x4215f9=getConfigService(),_0xb53368=os[_0x41905b(0x8d)](),_0x39eabf=/[0-9a-f-]{36}/;if(!_0x4215f9[_0x41905b(0x80)]&&_0x39eabf['test'](_0x4215f9[_0x41905b(0x93)]))return _0x4215f9['devLicense'];else{if(_0xb53368===_0x41905b(0x8c))return exec(_0x41905b(0x94),{'encoding':_0x41905b(0x92)})['replace']('\x0d\x0a','');else{const _0xdecbc4=getFirstInterface(),_0x59b115=getCPUhash(),_0x3c20d6=_0x59b115+'|'+os[_0x41905b(0x9a)]()+'|'+_0xdecbc4[_0x41905b(0xa0)]+'|'+_0xdecbc4['ipAddress'],_0x2ecc80=crypto[_0x41905b(0x9b)](_0x41905b(0x88))[_0x41905b(0x9d)](_0x3c20d6)[_0x41905b(0x83)]('hex');return _0x2ecc80[_0x41905b(0x99)](0x0,0x8)+'-'+_0x2ecc80[_0x41905b(0x99)](0x8,0xc)+'-'+_0x2ecc80[_0x41905b(0x99)](0xc,0x10)+'-'+_0x2ecc80[_0x41905b(0x99)](0x10,0x14)+'-'+_0x2ecc80[_0x41905b(0x99)](0x14);}}}module['exports'][a1004_0x498ef4(0x89)]=getUuid,module[a1004_0x498ef4(0x9c)]['getFirstInterface']=getFirstInterface,module[a1004_0x498ef4(0x9c)]['getCPUhash']=getCPUhash;