Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / components / encryptor / index.js
index 58b592d..27fca12 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2ca=['final','end','close','unlink','decryptFile','algorithm','data','secret','utf8','base64','decryptString','createDecipher','crypto','bluebird','../../config/environment','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','update','binary','write'];(function(_0x21d744,_0x75c832){var _0x5693aa=function(_0x4d715d){while(--_0x4d715d){_0x21d744['push'](_0x21d744['shift']());}};_0x5693aa(++_0x75c832);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x3c08ea,_0x419b25){_0x3c08ea=_0x3c08ea-0x0;var _0x4b6e51=_0xf2ca[_0x3c08ea];return _0x4b6e51;};'use strict';var crypto=require(_0xaf2c('0x0'));var fs=require('fs');var BPromise=require(_0xaf2c('0x1'));var config=require(_0xaf2c('0x2'));const stringOptions={'secret':config['secrets'][_0xaf2c('0x3')],'algorithm':_0xaf2c('0x4')};const fileOptions={'algorithm':_0xaf2c('0x5')};function combineOptions(_0x219511){var _0x3a724c={};for(var _0x10c910 in fileOptions){if(fileOptions['hasOwnProperty'](_0x10c910)){_0x3a724c[_0x10c910]=fileOptions[_0x10c910];}}if(_0x219511){for(var _0x1fd101 in _0x219511){if(_0x219511[_0xaf2c('0x6')](_0x1fd101)){_0x3a724c[_0x1fd101]=_0x219511[_0x1fd101];}}}return _0x3a724c;}exports[_0xaf2c('0x7')]=function(_0x1f9531,_0x58351f,_0x37fedd,_0x3c0421){return new BPromise(function(_0x4a7397,_0x2a011d){_0x3c0421=combineOptions(_0x3c0421);var _0x4ba0a2=new Buffer(_0x37fedd);var _0x439ca3=fs['createReadStream'](_0x1f9531);var _0x2f5099=fs[_0xaf2c('0x8')](_0x58351f);var _0x2e04e5=crypto[_0xaf2c('0x9')](_0x3c0421['algorithm'],_0x4ba0a2);_0x439ca3['on']('data',function(_0x2c0d88){var _0x41a5a0=new Buffer(_0x2e04e5[_0xaf2c('0xa')](_0x2c0d88),_0xaf2c('0xb'));_0x2f5099[_0xaf2c('0xc')](_0x41a5a0);});_0x439ca3['on']('end',function(){try{var _0x590126=new Buffer(_0x2e04e5[_0xaf2c('0xd')](_0xaf2c('0xb')),_0xaf2c('0xb'));_0x2f5099[_0xaf2c('0xc')](_0x590126);_0x2f5099[_0xaf2c('0xe')]();_0x2f5099['on'](_0xaf2c('0xf'),function(){return _0x4a7397(_0x58351f);});}catch(_0x214f47){fs[_0xaf2c('0x10')](_0x58351f);return _0x2a011d(_0x214f47);}});});};exports[_0xaf2c('0x11')]=function(_0x1d0633,_0x6ac8e,_0x2b4d13,_0x26bf7b){return new BPromise(function(_0x3432e4,_0x705d09){_0x26bf7b=combineOptions(_0x26bf7b);var _0x54c34a=new Buffer(_0x2b4d13);var _0x3ca650=fs['createReadStream'](_0x1d0633);var _0x278a28=fs[_0xaf2c('0x8')](_0x6ac8e);var _0x1d544a=crypto['createDecipher'](_0x26bf7b[_0xaf2c('0x12')],_0x54c34a);_0x3ca650['on'](_0xaf2c('0x13'),function(_0x1fec4c){var _0x20000b=new Buffer(_0x1d544a[_0xaf2c('0xa')](_0x1fec4c),_0xaf2c('0xb'));_0x278a28['write'](_0x20000b);});_0x3ca650['on'](_0xaf2c('0xe'),function(){try{var _0x164bcb=new Buffer(_0x1d544a[_0xaf2c('0xd')](_0xaf2c('0xb')),_0xaf2c('0xb'));_0x278a28['write'](_0x164bcb);_0x278a28[_0xaf2c('0xe')]();_0x278a28['on'](_0xaf2c('0xf'),function(){return _0x3432e4(_0x6ac8e);});}catch(_0x18153c){fs['unlink'](_0x6ac8e);return _0x705d09(_0x18153c);}});});};exports['encryptString']=function(_0x29cbdf,_0x303546,_0x1cafad){var _0x99f78d=_0x1cafad||stringOptions['algorithm'];var _0x2b8f1a=_0x303546||stringOptions[_0xaf2c('0x14')];var _0x3a0145=crypto[_0xaf2c('0x9')](_0x99f78d,_0x2b8f1a);var _0xe929b5=_0x3a0145[_0xaf2c('0xa')](_0x29cbdf,_0xaf2c('0x15'),'base64');_0xe929b5+=_0x3a0145[_0xaf2c('0xd')](_0xaf2c('0x16'));return _0xe929b5;};exports[_0xaf2c('0x17')]=function(_0x410536,_0x4b7cf2,_0x3fb190){var _0x589d47=_0x3fb190||stringOptions[_0xaf2c('0x12')];var _0x42f980=_0x4b7cf2||stringOptions[_0xaf2c('0x14')];var _0x5d685a=crypto[_0xaf2c('0x18')](_0x589d47,_0x42f980);var _0x2ea490=_0x5d685a[_0xaf2c('0xa')](_0x410536,'base64',_0xaf2c('0x15'));_0x2ea490+=_0x5d685a[_0xaf2c('0xd')](_0xaf2c('0x15'));return _0x2ea490;};
\ No newline at end of file
+var _0xd67b=['createDecipher','encryptString','algorithm','secret','utf8','base64','decryptString','bluebird','secrets','session','aes-256-ctr','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','createWriteStream'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd67b,0x133));var _0xbd67=function(_0x1835ca,_0x1d1994){_0x1835ca=_0x1835ca-0x0;var _0x2b2482=_0xd67b[_0x1835ca];return _0x2b2482;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xbd67('0x0'));var config=require('../../config/environment');const stringOptions={'secret':config[_0xbd67('0x1')][_0xbd67('0x2')],'algorithm':_0xbd67('0x3')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x40e384){var _0x50da5a={};for(var _0x1bf96 in fileOptions){if(fileOptions['hasOwnProperty'](_0x1bf96)){_0x50da5a[_0x1bf96]=fileOptions[_0x1bf96];}}if(_0x40e384){for(var _0x309962 in _0x40e384){if(_0x40e384[_0xbd67('0x4')](_0x309962)){_0x50da5a[_0x309962]=_0x40e384[_0x309962];}}}return _0x50da5a;}exports[_0xbd67('0x5')]=function(_0x27b016,_0x1860c9,_0x72f9ac,_0x2d4af6){return new BPromise(function(_0xfad775,_0x1da7f1){_0x2d4af6=combineOptions(_0x2d4af6);var _0x461231=new Buffer(_0x72f9ac);var _0x177f41=fs[_0xbd67('0x6')](_0x27b016);var _0x283f2f=fs['createWriteStream'](_0x1860c9);var _0x54954b=crypto[_0xbd67('0x7')](_0x2d4af6['algorithm'],_0x461231);_0x177f41['on'](_0xbd67('0x8'),function(_0xb6b4b5){var _0x36027=new Buffer(_0x54954b[_0xbd67('0x9')](_0xb6b4b5),_0xbd67('0xa'));_0x283f2f[_0xbd67('0xb')](_0x36027);});_0x177f41['on'](_0xbd67('0xc'),function(){try{var _0x32bd81=new Buffer(_0x54954b[_0xbd67('0xd')](_0xbd67('0xa')),'binary');_0x283f2f[_0xbd67('0xb')](_0x32bd81);_0x283f2f[_0xbd67('0xc')]();_0x283f2f['on'](_0xbd67('0xe'),function(){return _0xfad775(_0x1860c9);});}catch(_0x2abcf2){fs[_0xbd67('0xf')](_0x1860c9);return _0x1da7f1(_0x2abcf2);}});});};exports[_0xbd67('0x10')]=function(_0x44c025,_0xbdd027,_0xa45c76,_0x140df9){return new BPromise(function(_0x591de9,_0x4ab3a6){_0x140df9=combineOptions(_0x140df9);var _0x36b990=new Buffer(_0xa45c76);var _0x475e36=fs[_0xbd67('0x6')](_0x44c025);var _0x47d066=fs[_0xbd67('0x11')](_0xbdd027);var _0x2e0e21=crypto[_0xbd67('0x12')](_0x140df9['algorithm'],_0x36b990);_0x475e36['on'](_0xbd67('0x8'),function(_0x5ceb31){var _0x1f9193=new Buffer(_0x2e0e21[_0xbd67('0x9')](_0x5ceb31),_0xbd67('0xa'));_0x47d066['write'](_0x1f9193);});_0x475e36['on'](_0xbd67('0xc'),function(){try{var _0x40ec96=new Buffer(_0x2e0e21[_0xbd67('0xd')](_0xbd67('0xa')),_0xbd67('0xa'));_0x47d066[_0xbd67('0xb')](_0x40ec96);_0x47d066['end']();_0x47d066['on'](_0xbd67('0xe'),function(){return _0x591de9(_0xbdd027);});}catch(_0x36a634){fs[_0xbd67('0xf')](_0xbdd027);return _0x4ab3a6(_0x36a634);}});});};exports[_0xbd67('0x13')]=function(_0x8a7174,_0x33fd8c,_0x46c519){var _0x922df8=_0x46c519||stringOptions[_0xbd67('0x14')];var _0x36f7c8=_0x33fd8c||stringOptions[_0xbd67('0x15')];var _0x57602d=crypto[_0xbd67('0x7')](_0x922df8,_0x36f7c8);var _0x5a5227=_0x57602d[_0xbd67('0x9')](_0x8a7174,_0xbd67('0x16'),_0xbd67('0x17'));_0x5a5227+=_0x57602d['final'](_0xbd67('0x17'));return _0x5a5227;};exports[_0xbd67('0x18')]=function(_0x4dfa19,_0x3a062e,_0x1b3253){var _0x374f1b=_0x1b3253||stringOptions[_0xbd67('0x14')];var _0x3726ea=_0x3a062e||stringOptions['secret'];var _0x5975dc=crypto[_0xbd67('0x12')](_0x374f1b,_0x3726ea);var _0x310d21=_0x5975dc[_0xbd67('0x9')](_0x4dfa19,_0xbd67('0x17'),_0xbd67('0x16'));_0x310d21+=_0x5975dc[_0xbd67('0xd')](_0xbd67('0x16'));return _0x310d21;};
\ No newline at end of file