f31a29f1f4e6d50f553006132b96c259fb58abc8
[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 _0x37a7=['head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','model','join','createHash','md5','update','digest','getUuid','platform','utf8','replace','hostname','ipAddress','substring','lodash','crypto','keys','length','filter','family','IPv4','internal','concat'];(function(_0x481ffc,_0x4acb82){var _0x51d09a=function(_0x2d73e0){while(--_0x2d73e0){_0x481ffc['push'](_0x481ffc['shift']());}};_0x51d09a(++_0x4acb82);}(_0x37a7,0x6f));var _0x737a=function(_0xed1f9b,_0x156335){_0xed1f9b=_0xed1f9b-0x0;var _0x2f16d0=_0x37a7[_0xed1f9b];return _0x2f16d0;};'use strict';var _=require(_0x737a('0x0'));var os=require('os');var crypto=require(_0x737a('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')['execSync'];function getInterfaces(){var _0x2d4b54=[];var _0xc5eaef=os['networkInterfaces']();var _0x524516=_['orderBy'](_[_0x737a('0x2')](_0xc5eaef));for(var _0x477f2f=0x0;_0x477f2f<_0x524516[_0x737a('0x3')];_0x477f2f++){var _0x11109c=_0xc5eaef[_0x524516[_0x477f2f]][_0x737a('0x4')](function(_0x5cc52c){return _0x5cc52c[_0x737a('0x5')]===_0x737a('0x6')&&_0x5cc52c[_0x737a('0x7')]===![];});_0x2d4b54=_0x2d4b54[_0x737a('0x8')](_0x11109c);}return _0x2d4b54;}function getFirstInterface(){var _0x4fb3e0=_[_0x737a('0x9')](getInterfaces());return{'macAddress':_0x4fb3e0&&_0x4fb3e0[_0x737a('0xa')]?_0x4fb3e0['mac']:_0x737a('0xb'),'ipAddress':_0x4fb3e0&&_0x4fb3e0[_0x737a('0xc')]?_0x4fb3e0[_0x737a('0xc')]:_0x737a('0xd')};}exports[_0x737a('0xe')]=getFirstInterface;function getCPUhash(){var _0x27ccd9=_[_0x737a('0xf')](os['cpus']()[_0x737a('0x10')](function(_0x22cc58){return _0x22cc58[_0x737a('0x11')];}))[_0x737a('0x12')](':');return crypto[_0x737a('0x13')](_0x737a('0x14'))[_0x737a('0x15')](_0x27ccd9)[_0x737a('0x16')]('hex');}exports[_0x737a('0x17')]=function(){switch(os[_0x737a('0x18')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x737a('0x19')})[_0x737a('0x1a')]('\x0d\x0a','');default:var _0x64901f=getFirstInterface();var _0xd5dd7c=getCPUhash();var _0x1064c3=_0xd5dd7c+'|'+os[_0x737a('0x1b')]()+'|'+_0x64901f['macAddress']+'|'+_0x64901f[_0x737a('0x1c')];var _0x4a8323=crypto[_0x737a('0x13')](_0x737a('0x14'))['update'](_0x1064c3)[_0x737a('0x16')]('hex');return _0x4a8323['substring'](0x0,0x8)+'-'+_0x4a8323[_0x737a('0x1d')](0x8,0xc)+'-'+_0x4a8323[_0x737a('0x1d')](0xc,0x10)+'-'+_0x4a8323['substring'](0x10,0x14)+'-'+_0x4a8323[_0x737a('0x1d')](0x14);}};