a0961154bd3fa9a5965a662b1bebab1bf410c82d
[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 _0xeca7=['lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','filter','IPv4','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','macAddress','ipAddress','substring'];(function(_0x1d6e8b,_0x1c1676){var _0x5f2977=function(_0xbf2d98){while(--_0xbf2d98){_0x1d6e8b['push'](_0x1d6e8b['shift']());}};_0x5f2977(++_0x1c1676);}(_0xeca7,0xba));var _0x7eca=function(_0xbd4254,_0x31c08b){_0xbd4254=_0xbd4254-0x0;var _0x46c0f3=_0xeca7[_0xbd4254];return _0x46c0f3;};'use strict';var _=require(_0x7eca('0x0'));var os=require('os');var crypto=require(_0x7eca('0x1'));var machine=require(_0x7eca('0x2'));var exec=require('child_process')[_0x7eca('0x3')];var config=require(_0x7eca('0x4'));function getInterfaces(){var _0x5a033f=[];var _0x2b5721=os[_0x7eca('0x5')]();var _0x519867=_[_0x7eca('0x6')](_[_0x7eca('0x7')](_0x2b5721));for(var _0x35b9cb=0x0;_0x35b9cb<_0x519867['length'];_0x35b9cb++){var _0x1c0553=_0x2b5721[_0x519867[_0x35b9cb]][_0x7eca('0x8')](function(_0x61f0f3){return _0x61f0f3['family']===_0x7eca('0x9')&&_0x61f0f3['internal']===![];});_0x5a033f=_0x5a033f['concat'](_0x1c0553);}return _0x5a033f;}function getFirstInterface(){var _0x1e3ff2=_['head'](getInterfaces());return{'macAddress':_0x1e3ff2&&_0x1e3ff2[_0x7eca('0xa')]?_0x1e3ff2['mac']:_0x7eca('0xb'),'ipAddress':_0x1e3ff2&&_0x1e3ff2['address']?_0x1e3ff2['address']:_0x7eca('0xc')};}exports[_0x7eca('0xd')]=getFirstInterface;function getCPUhash(){var _0x19221f=_['orderBy'](os[_0x7eca('0xe')]()[_0x7eca('0xf')](function(_0x4ec732){return _0x4ec732['model'];}))[_0x7eca('0x10')](':');return crypto[_0x7eca('0x11')](_0x7eca('0x12'))[_0x7eca('0x13')](_0x19221f)[_0x7eca('0x14')](_0x7eca('0x15'));}exports[_0x7eca('0x16')]=function(){var _0x567122=os[_0x7eca('0x17')]();var _0x7d640e=/[0-9a-f-]{36}/;if(config[_0x7eca('0x18')]&&_0x7d640e[_0x7eca('0x19')](config[_0x7eca('0x18')])){return config[_0x7eca('0x18')];}else if(_0x567122===_0x7eca('0x1a')){return exec(_0x7eca('0x1b'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0xc91f60=getFirstInterface();var _0xbec2b8=getCPUhash();var _0x499e44=_0xbec2b8+'|'+os['hostname']()+'|'+_0xc91f60[_0x7eca('0x1c')]+'|'+_0xc91f60[_0x7eca('0x1d')];var _0x242dad=crypto['createHash'](_0x7eca('0x12'))[_0x7eca('0x13')](_0x499e44)['digest'](_0x7eca('0x15'));return _0x242dad[_0x7eca('0x1e')](0x0,0x8)+'-'+_0x242dad['substring'](0x8,0xc)+'-'+_0x242dad[_0x7eca('0x1e')](0xc,0x10)+'-'+_0x242dad[_0x7eca('0x1e')](0x10,0x14)+'-'+_0x242dad[_0x7eca('0x1e')](0x14);}};