f44cc8388469bd7021db23e2d60b3af8718cb32a
[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 _0x49c4=['lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','model','join','createHash','update','hex','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','md5','digest','substring'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x49c4,0x9b));var _0x449c=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x49c4[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x449c('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x449c('0x1'));var exec=require(_0x449c('0x2'))[_0x449c('0x3')];function getInterfaces(){var _0x1d60ee=[];var _0x2646ac=os[_0x449c('0x4')]();var _0x23314e=_['orderBy'](_['keys'](_0x2646ac));for(var _0x98afc0=0x0;_0x98afc0<_0x23314e[_0x449c('0x5')];_0x98afc0++){var _0x12586c=_0x2646ac[_0x23314e[_0x98afc0]][_0x449c('0x6')](function(_0x3e7c19){return _0x3e7c19[_0x449c('0x7')]===_0x449c('0x8')&&_0x3e7c19[_0x449c('0x9')]===![];});_0x1d60ee=_0x1d60ee[_0x449c('0xa')](_0x12586c);}return _0x1d60ee;}function getFirstInterface(){var _0x1964a6=_[_0x449c('0xb')](getInterfaces());return{'macAddress':_0x1964a6&&_0x1964a6[_0x449c('0xc')]?_0x1964a6[_0x449c('0xc')]:_0x449c('0xd'),'ipAddress':_0x1964a6&&_0x1964a6[_0x449c('0xe')]?_0x1964a6['address']:'127.0.0.1'};}exports[_0x449c('0xf')]=getFirstInterface;function getCPUhash(){var _0xca48f=_['orderBy'](os['cpus']()['map'](function(_0x3e6303){return _0x3e6303[_0x449c('0x10')];}))[_0x449c('0x11')](':');return crypto[_0x449c('0x12')]('md5')[_0x449c('0x13')](_0xca48f)['digest'](_0x449c('0x14'));}exports['getUuid']=function(){switch(os[_0x449c('0x15')]()){case _0x449c('0x16'):return exec(_0x449c('0x17'),{'encoding':_0x449c('0x18')})[_0x449c('0x19')]('\x0d\x0a','');default:var _0x80bdf5=getFirstInterface();var _0x3369e3=getCPUhash();var _0x634564=_0x3369e3+'|'+os[_0x449c('0x1a')]()+'|'+_0x80bdf5[_0x449c('0x1b')]+'|'+_0x80bdf5['ipAddress'];var _0x4312d9=crypto[_0x449c('0x12')](_0x449c('0x1c'))[_0x449c('0x13')](_0x634564)[_0x449c('0x1d')]('hex');return _0x4312d9[_0x449c('0x1e')](0x0,0x8)+'-'+_0x4312d9[_0x449c('0x1e')](0x8,0xc)+'-'+_0x4312d9[_0x449c('0x1e')](0xc,0x10)+'-'+_0x4312d9[_0x449c('0x1e')](0x10,0x14)+'-'+_0x4312d9[_0x449c('0x1e')](0x14);}};