e13db9de8969b0c10c5defb34d85f5cabfd29916
[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 _0xca9e=['update','digest','hex','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','family','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','join','createHash'];(function(_0x2cd4cf,_0x4960e8){var _0x557015=function(_0x43d05c){while(--_0x43d05c){_0x2cd4cf['push'](_0x2cd4cf['shift']());}};_0x557015(++_0x4960e8);}(_0xca9e,0x136));var _0xeca9=function(_0x3bbe01,_0x5a770e){_0x3bbe01=_0x3bbe01-0x0;var _0x238cec=_0xca9e[_0x3bbe01];return _0x238cec;};'use strict';var _=require(_0xeca9('0x0'));var os=require('os');var crypto=require(_0xeca9('0x1'));var machine=require(_0xeca9('0x2'));var exec=require(_0xeca9('0x3'))[_0xeca9('0x4')];function getInterfaces(){var _0x1443e3=[];var _0x8dbabb=os[_0xeca9('0x5')]();var _0x1b2864=_[_0xeca9('0x6')](_[_0xeca9('0x7')](_0x8dbabb));for(var _0x1c4ce6=0x0;_0x1c4ce6<_0x1b2864[_0xeca9('0x8')];_0x1c4ce6++){var _0x305dc5=_0x8dbabb[_0x1b2864[_0x1c4ce6]]['filter'](function(_0x369f5e){return _0x369f5e[_0xeca9('0x9')]==='IPv4'&&_0x369f5e['internal']===![];});_0x1443e3=_0x1443e3[_0xeca9('0xa')](_0x305dc5);}return _0x1443e3;}function getFirstInterface(){var _0x239e92=_[_0xeca9('0xb')](getInterfaces());return{'macAddress':_0x239e92&&_0x239e92['mac']?_0x239e92[_0xeca9('0xc')]:_0xeca9('0xd'),'ipAddress':_0x239e92&&_0x239e92[_0xeca9('0xe')]?_0x239e92[_0xeca9('0xe')]:_0xeca9('0xf')};}exports[_0xeca9('0x10')]=getFirstInterface;function getCPUhash(){var _0x5b5fbf=_[_0xeca9('0x6')](os[_0xeca9('0x11')]()['map'](function(_0x27ca6f){return _0x27ca6f['model'];}))[_0xeca9('0x12')](':');return crypto[_0xeca9('0x13')]('md5')[_0xeca9('0x14')](_0x5b5fbf)[_0xeca9('0x15')](_0xeca9('0x16'));}exports['getUuid']=function(){switch(os[_0xeca9('0x17')]()){case _0xeca9('0x18'):return exec(_0xeca9('0x19'),{'encoding':_0xeca9('0x1a')})['replace']('\x0d\x0a','');default:var _0x520411=getFirstInterface();var _0x964e05=getCPUhash();var _0x77cb=_0x964e05+'|'+os['hostname']()+'|'+_0x520411[_0xeca9('0x1b')]+'|'+_0x520411[_0xeca9('0x1c')];var _0x4fbe8a=crypto['createHash']('md5')[_0xeca9('0x14')](_0x77cb)[_0xeca9('0x15')](_0xeca9('0x16'));return _0x4fbe8a['substring'](0x0,0x8)+'-'+_0x4fbe8a[_0xeca9('0x1d')](0x8,0xc)+'-'+_0x4fbe8a['substring'](0xc,0x10)+'-'+_0x4fbe8a['substring'](0x10,0x14)+'-'+_0x4fbe8a[_0xeca9('0x1d')](0x14);}};