2b60fc2a96fd13473addb26c612f2a0b0a0e35d9
[motion-next.git] / server / config / license / hardware.js
1 const a843_0x4ac3=['address','keys','internal','orderBy','createHash','devLicense','ipAddress','cpus','utf8','../config.service','dmidecode\x20--string\x20system-uuid','networkInterfaces','hex','family','digest','head','length','filter','win32','execSync','isProduction','127.0.0.1','hostname','mac','00:00:00:00:00:00','platform','crypto','test','join','map','substring','md5'];(function(_0x25828a,_0x4ac346){const _0xed2c4c=function(_0x2a3e09){while(--_0x2a3e09){_0x25828a['push'](_0x25828a['shift']());}};_0xed2c4c(++_0x4ac346);}(a843_0x4ac3,0x180));const a843_0xed2c=function(_0x25828a,_0x4ac346){_0x25828a=_0x25828a-0x0;let _0xed2c4c=a843_0x4ac3[_0x25828a];return _0xed2c4c;};const _0x23fd08=a843_0xed2c;'use strict';const _=require('lodash'),os=require('os'),crypto=require(_0x23fd08('0x1a')),{getConfigService}=require(_0x23fd08('0x9')),exec=require('child_process')[_0x23fd08('0x13')];function getInterfaces(){const _0x10764a=_0x23fd08;let _0x2a3e09=[];const _0x3fe8d4=os[_0x10764a('0xb')](),_0x123161=_[_0x10764a('0x3')](_[_0x10764a('0x1')](_0x3fe8d4));for(let _0x92df27=0x0;_0x92df27<_0x123161[_0x10764a('0x10')];_0x92df27++){const _0x5dbdab=_0x3fe8d4[_0x123161[_0x92df27]][_0x10764a('0x11')](function(_0x5d6cd7){const _0x3e9db0=_0x10764a;return _0x5d6cd7[_0x3e9db0('0xd')]==='IPv4'&&_0x5d6cd7[_0x3e9db0('0x2')]===![];});_0x2a3e09=_0x2a3e09['concat'](_0x5dbdab);}return _0x2a3e09;}function getFirstInterface(){const _0x4ff546=_0x23fd08,_0x2d5daa=_[_0x4ff546('0xf')](getInterfaces());return{'macAddress':_0x2d5daa&&_0x2d5daa['mac']?_0x2d5daa[_0x4ff546('0x17')]:_0x4ff546('0x18'),'ipAddress':_0x2d5daa&&_0x2d5daa[_0x4ff546('0x0')]?_0x2d5daa[_0x4ff546('0x0')]:_0x4ff546('0x15')};}function getCPUhash(){const _0x2a4f70=_0x23fd08,_0x3593df=_[_0x2a4f70('0x3')](os[_0x2a4f70('0x7')]()[_0x2a4f70('0x1d')](function(_0x29ae77){return _0x29ae77['model'];}))[_0x2a4f70('0x1c')](':');return crypto['createHash'](_0x2a4f70('0x1f'))['update'](_0x3593df)[_0x2a4f70('0xe')]('hex');}function getUuid(){const _0xab395c=_0x23fd08,_0x3a2cd5=getConfigService(),_0x59396a=os[_0xab395c('0x19')](),_0x141fb4=/[0-9a-f-]{36}/;if(!_0x3a2cd5[_0xab395c('0x14')]&&_0x141fb4[_0xab395c('0x1b')](_0x3a2cd5[_0xab395c('0x5')]))return _0x3a2cd5[_0xab395c('0x5')];else{if(_0x59396a===_0xab395c('0x12'))return exec(_0xab395c('0xa'),{'encoding':_0xab395c('0x8')})['replace']('\x0d\x0a','');else{const _0x44f44a=getFirstInterface(),_0xf137f=getCPUhash(),_0x41cbfc=_0xf137f+'|'+os[_0xab395c('0x16')]()+'|'+_0x44f44a['macAddress']+'|'+_0x44f44a[_0xab395c('0x6')],_0x343c83=crypto[_0xab395c('0x4')](_0xab395c('0x1f'))['update'](_0x41cbfc)[_0xab395c('0xe')](_0xab395c('0xc'));return _0x343c83['substring'](0x0,0x8)+'-'+_0x343c83[_0xab395c('0x1e')](0x8,0xc)+'-'+_0x343c83[_0xab395c('0x1e')](0xc,0x10)+'-'+_0x343c83['substring'](0x10,0x14)+'-'+_0x343c83['substring'](0x14);}}}module['exports']={'getUuid':getUuid,'getFirstInterface':getFirstInterface,'getCPUhash':getCPUhash};