eaf57fc8c7def7684203c35ffdb14658813b95a0
[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 _0xc23a=['map','model','join','createHash','md5','update','hex','getUuid','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','crypto','bimedia-machine-uuid','child_process','keys','length','family','IPv4','concat','head','mac','address','127.0.0.1','orderBy','cpus'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xc23a,0xd2));var _0xac23=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xc23a[_0x5cc8b9];return _0x58892e;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xac23('0x0'));var machine=require(_0xac23('0x1'));var exec=require(_0xac23('0x2'))['execSync'];function getInterfaces(){var _0x99f7dc=[];var _0x4e806e=os['networkInterfaces']();var _0x35c541=_['orderBy'](_[_0xac23('0x3')](_0x4e806e));for(var _0x22a991=0x0;_0x22a991<_0x35c541[_0xac23('0x4')];_0x22a991++){var _0x4c1482=_0x4e806e[_0x35c541[_0x22a991]]['filter'](function(_0x44b7d2){return _0x44b7d2[_0xac23('0x5')]===_0xac23('0x6')&&_0x44b7d2['internal']===![];});_0x99f7dc=_0x99f7dc[_0xac23('0x7')](_0x4c1482);}return _0x99f7dc;}function getFirstInterface(){var _0x450229=_[_0xac23('0x8')](getInterfaces());return{'macAddress':_0x450229&&_0x450229[_0xac23('0x9')]?_0x450229['mac']:'00:00:00:00:00:00','ipAddress':_0x450229&&_0x450229['address']?_0x450229[_0xac23('0xa')]:_0xac23('0xb')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x3fe7c6=_[_0xac23('0xc')](os[_0xac23('0xd')]()[_0xac23('0xe')](function(_0x261ee1){return _0x261ee1[_0xac23('0xf')];}))[_0xac23('0x10')](':');return crypto[_0xac23('0x11')](_0xac23('0x12'))[_0xac23('0x13')](_0x3fe7c6)['digest'](_0xac23('0x14'));}exports[_0xac23('0x15')]=function(){switch(os['platform']()){case'win32':return exec(_0xac23('0x16'),{'encoding':_0xac23('0x17')})[_0xac23('0x18')]('\x0d\x0a','');default:var _0x49fa85=getFirstInterface();var _0x138548=getCPUhash();var _0x1c117f=_0x138548+'|'+os[_0xac23('0x19')]()+'|'+_0x49fa85[_0xac23('0x1a')]+'|'+_0x49fa85['ipAddress'];var _0xca15dd=crypto[_0xac23('0x11')](_0xac23('0x12'))['update'](_0x1c117f)['digest'](_0xac23('0x14'));return _0xca15dd[_0xac23('0x1b')](0x0,0x8)+'-'+_0xca15dd[_0xac23('0x1b')](0x8,0xc)+'-'+_0xca15dd[_0xac23('0x1b')](0xc,0x10)+'-'+_0xca15dd['substring'](0x10,0x14)+'-'+_0xca15dd[_0xac23('0x1b')](0x14);}};