508878d13b11f16780152d147b1b1b185890ef16
[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 _0x867d=['licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','createHash','hex','substring','execSync','../environment','orderBy','keys','length','filter','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','update','digest','getUuid','test'];(function(_0x7e24bc,_0x408dfa){var _0xa226fc=function(_0x566461){while(--_0x566461){_0x7e24bc['push'](_0x7e24bc['shift']());}};_0xa226fc(++_0x408dfa);}(_0x867d,0x86));var _0xd867=function(_0x2b20c3,_0x62ef3){_0x2b20c3=_0x2b20c3-0x0;var _0x195881=_0x867d[_0x2b20c3];return _0x195881;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xd867('0x0')];var config=require(_0xd867('0x1'));function getInterfaces(){var _0x2dbb99=[];var _0xfd8d3c=os['networkInterfaces']();var _0x49fd4a=_[_0xd867('0x2')](_[_0xd867('0x3')](_0xfd8d3c));for(var _0x2f6891=0x0;_0x2f6891<_0x49fd4a[_0xd867('0x4')];_0x2f6891++){var _0x239352=_0xfd8d3c[_0x49fd4a[_0x2f6891]][_0xd867('0x5')](function(_0x126ea3){return _0x126ea3['family']===_0xd867('0x6')&&_0x126ea3[_0xd867('0x7')]===![];});_0x2dbb99=_0x2dbb99[_0xd867('0x8')](_0x239352);}return _0x2dbb99;}function getFirstInterface(){var _0x17dc41=_['head'](getInterfaces());return{'macAddress':_0x17dc41&&_0x17dc41[_0xd867('0x9')]?_0x17dc41['mac']:_0xd867('0xa'),'ipAddress':_0x17dc41&&_0x17dc41[_0xd867('0xb')]?_0x17dc41[_0xd867('0xb')]:_0xd867('0xc')};}exports[_0xd867('0xd')]=getFirstInterface;function getCPUhash(){var _0x34d2d2=_[_0xd867('0x2')](os[_0xd867('0xe')]()['map'](function(_0x26755f){return _0x26755f[_0xd867('0xf')];}))[_0xd867('0x10')](':');return crypto['createHash']('md5')[_0xd867('0x11')](_0x34d2d2)[_0xd867('0x12')]('hex');}exports[_0xd867('0x13')]=function(){var _0x16dffc=os['platform']();var _0x46adb6=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x46adb6[_0xd867('0x14')](config[_0xd867('0x15')])){return config[_0xd867('0x15')];}else if(_0x16dffc===_0xd867('0x16')){return exec(_0xd867('0x17'),{'encoding':_0xd867('0x18')})[_0xd867('0x19')]('\x0d\x0a','');}else{var _0x58ec5e=getFirstInterface();var _0x373ec6=getCPUhash();var _0x437e42=_0x373ec6+'|'+os[_0xd867('0x1a')]()+'|'+_0x58ec5e['macAddress']+'|'+_0x58ec5e[_0xd867('0x1b')];var _0x288a2d=crypto[_0xd867('0x1c')]('md5')[_0xd867('0x11')](_0x437e42)[_0xd867('0x12')](_0xd867('0x1d'));return _0x288a2d[_0xd867('0x1e')](0x0,0x8)+'-'+_0x288a2d[_0xd867('0x1e')](0x8,0xc)+'-'+_0x288a2d['substring'](0xc,0x10)+'-'+_0x288a2d['substring'](0x10,0x14)+'-'+_0x288a2d['substring'](0x14);}};