Built motion from commit 9d1906d1.|2.5.40
[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 _0x7f4d=['address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','update','digest','hex','platform','licenseToken','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','internal','concat','head','mac'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7f4d,0x13c));var _0xd7f4=function(_0x37549b,_0x4ab6ab){_0x37549b=_0x37549b-0x0;var _0x407d58=_0x7f4d[_0x37549b];return _0x407d58;};'use strict';var _=require(_0xd7f4('0x0'));var os=require('os');var crypto=require(_0xd7f4('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xd7f4('0x2'))[_0xd7f4('0x3')];var config=require(_0xd7f4('0x4'));function getInterfaces(){var _0xf729a2=[];var _0x447248=os[_0xd7f4('0x5')]();var _0x51b736=_[_0xd7f4('0x6')](_[_0xd7f4('0x7')](_0x447248));for(var _0x1e53ac=0x0;_0x1e53ac<_0x51b736['length'];_0x1e53ac++){var _0x599884=_0x447248[_0x51b736[_0x1e53ac]][_0xd7f4('0x8')](function(_0x1cff0a){return _0x1cff0a[_0xd7f4('0x9')]==='IPv4'&&_0x1cff0a[_0xd7f4('0xa')]===![];});_0xf729a2=_0xf729a2[_0xd7f4('0xb')](_0x599884);}return _0xf729a2;}function getFirstInterface(){var _0xcf3e1=_[_0xd7f4('0xc')](getInterfaces());return{'macAddress':_0xcf3e1&&_0xcf3e1[_0xd7f4('0xd')]?_0xcf3e1['mac']:'00:00:00:00:00:00','ipAddress':_0xcf3e1&&_0xcf3e1[_0xd7f4('0xe')]?_0xcf3e1[_0xd7f4('0xe')]:_0xd7f4('0xf')};}exports[_0xd7f4('0x10')]=getFirstInterface;function getCPUhash(){var _0x11b765=_['orderBy'](os[_0xd7f4('0x11')]()[_0xd7f4('0x12')](function(_0x29e14f){return _0x29e14f[_0xd7f4('0x13')];}))['join'](':');return crypto[_0xd7f4('0x14')](_0xd7f4('0x15'))[_0xd7f4('0x16')](_0x11b765)[_0xd7f4('0x17')](_0xd7f4('0x18'));}exports['getUuid']=function(){var _0xb361e5=os[_0xd7f4('0x19')]();var _0x3a3b80=/[0-9a-f-]{36}/;if(config[_0xd7f4('0x1a')]&&_0x3a3b80['test'](config[_0xd7f4('0x1a')])){return config[_0xd7f4('0x1a')];}else if(_0xb361e5==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xd7f4('0x1b')})[_0xd7f4('0x1c')]('\x0d\x0a','');}else{var _0x2acf18=getFirstInterface();var _0x58d045=getCPUhash();var _0x3b5a15=_0x58d045+'|'+os[_0xd7f4('0x1d')]()+'|'+_0x2acf18[_0xd7f4('0x1e')]+'|'+_0x2acf18[_0xd7f4('0x1f')];var _0x209fd8=crypto[_0xd7f4('0x14')](_0xd7f4('0x15'))['update'](_0x3b5a15)['digest'](_0xd7f4('0x18'));return _0x209fd8[_0xd7f4('0x20')](0x0,0x8)+'-'+_0x209fd8['substring'](0x8,0xc)+'-'+_0x209fd8[_0xd7f4('0x20')](0xc,0x10)+'-'+_0x209fd8[_0xd7f4('0x20')](0x10,0x14)+'-'+_0x209fd8[_0xd7f4('0x20')](0x14);}};