fe4ef5326419867bc8abafc28838b8b8164de3eb
[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 _0x7639=['child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','lodash','bimedia-machine-uuid'];(function(_0x2b7a85,_0x3b0c97){var _0x22c340=function(_0x2dd196){while(--_0x2dd196){_0x2b7a85['push'](_0x2b7a85['shift']());}};_0x22c340(++_0x3b0c97);}(_0x7639,0x14b));var _0x9763=function(_0xa900e0,_0x3023d4){_0xa900e0=_0xa900e0-0x0;var _0x1c8305=_0x7639[_0xa900e0];return _0x1c8305;};'use strict';var _=require(_0x9763('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x9763('0x1'));var exec=require(_0x9763('0x2'))[_0x9763('0x3')];var config=require(_0x9763('0x4'));function getInterfaces(){var _0x47324c=[];var _0x2c7a22=os[_0x9763('0x5')]();var _0x26b5ad=_[_0x9763('0x6')](_[_0x9763('0x7')](_0x2c7a22));for(var _0x1cbf8b=0x0;_0x1cbf8b<_0x26b5ad[_0x9763('0x8')];_0x1cbf8b++){var _0x400cc9=_0x2c7a22[_0x26b5ad[_0x1cbf8b]][_0x9763('0x9')](function(_0x3eb292){return _0x3eb292[_0x9763('0xa')]===_0x9763('0xb')&&_0x3eb292['internal']===![];});_0x47324c=_0x47324c[_0x9763('0xc')](_0x400cc9);}return _0x47324c;}function getFirstInterface(){var _0x4fe8bd=_[_0x9763('0xd')](getInterfaces());return{'macAddress':_0x4fe8bd&&_0x4fe8bd['mac']?_0x4fe8bd[_0x9763('0xe')]:_0x9763('0xf'),'ipAddress':_0x4fe8bd&&_0x4fe8bd[_0x9763('0x10')]?_0x4fe8bd[_0x9763('0x10')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xca7b08=_[_0x9763('0x6')](os[_0x9763('0x11')]()[_0x9763('0x12')](function(_0x1d1837){return _0x1d1837[_0x9763('0x13')];}))[_0x9763('0x14')](':');return crypto[_0x9763('0x15')](_0x9763('0x16'))[_0x9763('0x17')](_0xca7b08)[_0x9763('0x18')](_0x9763('0x19'));}exports[_0x9763('0x1a')]=function(){var _0x114350=os[_0x9763('0x1b')]();var _0xfcb650=/[0-9a-f-]{36}/;if(config[_0x9763('0x1c')]&&_0xfcb650[_0x9763('0x1d')](config[_0x9763('0x1c')])){return config[_0x9763('0x1c')];}else if(_0x114350===_0x9763('0x1e')){return exec(_0x9763('0x1f'),{'encoding':_0x9763('0x20')})[_0x9763('0x21')]('\x0d\x0a','');}else{var _0x5e24e9=getFirstInterface();var _0x508bf8=getCPUhash();var _0x6b1b5b=_0x508bf8+'|'+os[_0x9763('0x22')]()+'|'+_0x5e24e9[_0x9763('0x23')]+'|'+_0x5e24e9['ipAddress'];var _0x47cb7f=crypto[_0x9763('0x15')](_0x9763('0x16'))[_0x9763('0x17')](_0x6b1b5b)[_0x9763('0x18')](_0x9763('0x19'));return _0x47cb7f[_0x9763('0x24')](0x0,0x8)+'-'+_0x47cb7f[_0x9763('0x24')](0x8,0xc)+'-'+_0x47cb7f[_0x9763('0x24')](0xc,0x10)+'-'+_0x47cb7f[_0x9763('0x24')](0x10,0x14)+'-'+_0x47cb7f[_0x9763('0x24')](0x14);}};