5b4614cd1c82a4003796e330d7cefd61d64b5840
[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 _0x04e3=['lodash','crypto','child_process','execSync','../environment','orderBy','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','model','join','createHash','md5','digest','hex','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','substring'];(function(_0xb67251,_0x1f6208){var _0x979d96=function(_0x41d0d0){while(--_0x41d0d0){_0xb67251['push'](_0xb67251['shift']());}};_0x979d96(++_0x1f6208);}(_0x04e3,0x1a0));var _0x304e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x04e3[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x304e('0x0'));var os=require('os');var crypto=require(_0x304e('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x304e('0x2'))[_0x304e('0x3')];var config=require(_0x304e('0x4'));function getInterfaces(){var _0x381561=[];var _0x451d21=os['networkInterfaces']();var _0x5f2648=_[_0x304e('0x5')](_[_0x304e('0x6')](_0x451d21));for(var _0x1faa42=0x0;_0x1faa42<_0x5f2648[_0x304e('0x7')];_0x1faa42++){var _0x17866d=_0x451d21[_0x5f2648[_0x1faa42]][_0x304e('0x8')](function(_0x132e17){return _0x132e17[_0x304e('0x9')]==='IPv4'&&_0x132e17[_0x304e('0xa')]===![];});_0x381561=_0x381561[_0x304e('0xb')](_0x17866d);}return _0x381561;}function getFirstInterface(){var _0x19da4a=_[_0x304e('0xc')](getInterfaces());return{'macAddress':_0x19da4a&&_0x19da4a[_0x304e('0xd')]?_0x19da4a[_0x304e('0xd')]:_0x304e('0xe'),'ipAddress':_0x19da4a&&_0x19da4a[_0x304e('0xf')]?_0x19da4a[_0x304e('0xf')]:_0x304e('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x1a1e52=_[_0x304e('0x5')](os[_0x304e('0x11')]()['map'](function(_0x59fe6f){return _0x59fe6f[_0x304e('0x12')];}))[_0x304e('0x13')](':');return crypto[_0x304e('0x14')](_0x304e('0x15'))['update'](_0x1a1e52)[_0x304e('0x16')](_0x304e('0x17'));}exports['getUuid']=function(){var _0x4ac141=os[_0x304e('0x18')]();var _0x559e89=/[0-9a-f-]{36}/;if(config[_0x304e('0x19')]&&_0x559e89['test'](config[_0x304e('0x19')])){return config[_0x304e('0x19')];}else if(_0x4ac141===_0x304e('0x1a')){return exec(_0x304e('0x1b'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x4c8622=getFirstInterface();var _0x44286c=getCPUhash();var _0x2707e2=_0x44286c+'|'+os[_0x304e('0x1c')]()+'|'+_0x4c8622[_0x304e('0x1d')]+'|'+_0x4c8622[_0x304e('0x1e')];var _0x20bba0=crypto['createHash'](_0x304e('0x15'))['update'](_0x2707e2)['digest'](_0x304e('0x17'));return _0x20bba0[_0x304e('0x1f')](0x0,0x8)+'-'+_0x20bba0[_0x304e('0x1f')](0x8,0xc)+'-'+_0x20bba0['substring'](0xc,0x10)+'-'+_0x20bba0[_0x304e('0x1f')](0x10,0x14)+'-'+_0x20bba0[_0x304e('0x1f')](0x14);}};