f08f24db24dc687c831c1b6bf8b214823694ea7b
[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 _0xea67=['family','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','win32','utf8','replace','hostname','ipAddress','substring','child_process','execSync','../environment','networkInterfaces','keys','length','filter'];(function(_0x524c74,_0x2b6986){var _0xb4b6f1=function(_0x26c642){while(--_0x26c642){_0x524c74['push'](_0x524c74['shift']());}};_0xb4b6f1(++_0x2b6986);}(_0xea67,0xa3));var _0x7ea6=function(_0x5005ba,_0x423ed1){_0x5005ba=_0x5005ba-0x0;var _0x21278c=_0xea67[_0x5005ba];return _0x21278c;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x7ea6('0x0'))[_0x7ea6('0x1')];var config=require(_0x7ea6('0x2'));function getInterfaces(){var _0x38c421=[];var _0x172c91=os[_0x7ea6('0x3')]();var _0x105031=_['orderBy'](_[_0x7ea6('0x4')](_0x172c91));for(var _0x3956f5=0x0;_0x3956f5<_0x105031[_0x7ea6('0x5')];_0x3956f5++){var _0x2f33b1=_0x172c91[_0x105031[_0x3956f5]][_0x7ea6('0x6')](function(_0x416c55){return _0x416c55[_0x7ea6('0x7')]==='IPv4'&&_0x416c55[_0x7ea6('0x8')]===![];});_0x38c421=_0x38c421[_0x7ea6('0x9')](_0x2f33b1);}return _0x38c421;}function getFirstInterface(){var _0x148203=_[_0x7ea6('0xa')](getInterfaces());return{'macAddress':_0x148203&&_0x148203[_0x7ea6('0xb')]?_0x148203[_0x7ea6('0xb')]:_0x7ea6('0xc'),'ipAddress':_0x148203&&_0x148203[_0x7ea6('0xd')]?_0x148203[_0x7ea6('0xd')]:'127.0.0.1'};}exports[_0x7ea6('0xe')]=getFirstInterface;function getCPUhash(){var _0x171199=_[_0x7ea6('0xf')](os[_0x7ea6('0x10')]()[_0x7ea6('0x11')](function(_0x34da9b){return _0x34da9b[_0x7ea6('0x12')];}))[_0x7ea6('0x13')](':');return crypto[_0x7ea6('0x14')](_0x7ea6('0x15'))[_0x7ea6('0x16')](_0x171199)[_0x7ea6('0x17')](_0x7ea6('0x18'));}exports[_0x7ea6('0x19')]=function(){var _0x471fd4=os[_0x7ea6('0x1a')]();var _0x4f2feb=/[0-9a-f-]{36}/;if(config[_0x7ea6('0x1b')]&&_0x4f2feb['test'](config[_0x7ea6('0x1b')])){return config[_0x7ea6('0x1b')];}else if(_0x471fd4===_0x7ea6('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x7ea6('0x1d')})[_0x7ea6('0x1e')]('\x0d\x0a','');}else{var _0xe593ce=getFirstInterface();var _0x368164=getCPUhash();var _0x40e744=_0x368164+'|'+os[_0x7ea6('0x1f')]()+'|'+_0xe593ce['macAddress']+'|'+_0xe593ce[_0x7ea6('0x20')];var _0x4efb33=crypto[_0x7ea6('0x14')]('md5')[_0x7ea6('0x16')](_0x40e744)[_0x7ea6('0x17')](_0x7ea6('0x18'));return _0x4efb33[_0x7ea6('0x21')](0x0,0x8)+'-'+_0x4efb33[_0x7ea6('0x21')](0x8,0xc)+'-'+_0x4efb33[_0x7ea6('0x21')](0xc,0x10)+'-'+_0x4efb33['substring'](0x10,0x14)+'-'+_0x4efb33[_0x7ea6('0x21')](0x14);}};