Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / config / license / hardware.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x76b1=['createHash','update','hex','getUuid','platform','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','digest','substring','lodash','bimedia-machine-uuid','execSync','../environment','orderBy','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','getFirstInterface','cpus','map','model','join'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x76b1,0x6d));var _0x176b=function(_0x3540ea,_0x215b92){_0x3540ea=_0x3540ea-0x0;var _0x4fdac3=_0x76b1[_0x3540ea];return _0x4fdac3;};'use strict';var _=require(_0x176b('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x176b('0x1'));var exec=require('child_process')[_0x176b('0x2')];var config=require(_0x176b('0x3'));function getInterfaces(){var _0x31a121=[];var _0x38e66e=os['networkInterfaces']();var _0x4e79c1=_[_0x176b('0x4')](_['keys'](_0x38e66e));for(var _0x339874=0x0;_0x339874<_0x4e79c1[_0x176b('0x5')];_0x339874++){var _0x2974de=_0x38e66e[_0x4e79c1[_0x339874]][_0x176b('0x6')](function(_0x4fe741){return _0x4fe741[_0x176b('0x7')]===_0x176b('0x8')&&_0x4fe741[_0x176b('0x9')]===![];});_0x31a121=_0x31a121[_0x176b('0xa')](_0x2974de);}return _0x31a121;}function getFirstInterface(){var _0x4f62c4=_[_0x176b('0xb')](getInterfaces());return{'macAddress':_0x4f62c4&&_0x4f62c4[_0x176b('0xc')]?_0x4f62c4['mac']:_0x176b('0xd'),'ipAddress':_0x4f62c4&&_0x4f62c4['address']?_0x4f62c4['address']:'127.0.0.1'};}exports[_0x176b('0xe')]=getFirstInterface;function getCPUhash(){var _0x308d96=_[_0x176b('0x4')](os[_0x176b('0xf')]()[_0x176b('0x10')](function(_0x35720b){return _0x35720b[_0x176b('0x11')];}))[_0x176b('0x12')](':');return crypto[_0x176b('0x13')]('md5')[_0x176b('0x14')](_0x308d96)['digest'](_0x176b('0x15'));}exports[_0x176b('0x16')]=function(){var _0xc193f9=os[_0x176b('0x17')]();var _0x1687fd=/[0-9a-f-]{36}/;if(config[_0x176b('0x18')]&&_0x1687fd['test'](config[_0x176b('0x18')])){return config[_0x176b('0x18')];}else if(_0xc193f9==='win32'){return exec(_0x176b('0x19'),{'encoding':_0x176b('0x1a')})[_0x176b('0x1b')]('\x0d\x0a','');}else{var _0x131d42=getFirstInterface();var _0x229c52=getCPUhash();var _0x293f99=_0x229c52+'|'+os[_0x176b('0x1c')]()+'|'+_0x131d42['macAddress']+'|'+_0x131d42[_0x176b('0x1d')];var _0x248d25=crypto[_0x176b('0x13')]('md5')[_0x176b('0x14')](_0x293f99)[_0x176b('0x1e')](_0x176b('0x15'));return _0x248d25[_0x176b('0x1f')](0x0,0x8)+'-'+_0x248d25[_0x176b('0x1f')](0x8,0xc)+'-'+_0x248d25[_0x176b('0x1f')](0xc,0x10)+'-'+_0x248d25[_0x176b('0x1f')](0x10,0x14)+'-'+_0x248d25[_0x176b('0x1f')](0x14);}};