namespace Bitrix\Main\Security\W;
$GLOBALS['____1283868688']= array(base64_decode('dGltZQ=='),base64_decode('dGltZQ=='),base64_decode('anNvbl9kZWNvZGU='),base64_decode('YXJyYXlfbWVyZ2U='),base64_decode('am9pbg=='),base64_decode('am9pbg=='),base64_decode('am9pbg=='),base64_decode('YXJyYXlfcG9w'),base64_decode('YXJyYXlfc2hpZnQ='),base64_decode('YXJyYXlfc2hpZnQ='),base64_decode('YXJyYXlfc2hpZnQ='),base64_decode('YXJyYXlfc2hpZnQ='),base64_decode('YXJyYXlfbWVyZ2U='),base64_decode('aXNfYXJyYXk='),base64_decode('YXJyYXlfbWVyZ2U='),base64_decode('aW5fYXJyYXk='),base64_decode('aW5fYXJyYXk='),base64_decode('aW5fYXJyYXk='),base64_decode('aW5fYXJyYXk='),base64_decode('aW5fYXJyYXk='),base64_decode('dGltZQ=='),base64_decode('dGltZQ=='),base64_decode('YXJyYXlfbWFw'),base64_decode('Z2V0X2xvYWRlZF9leHRlbnNpb25z'),base64_decode('anNvbl9lbmNvZGU='),base64_decode('anNvbl9lbmNvZGU='),base64_decode('cGhwdmVyc2lvbg=='),base64_decode('anNvbl9lbmNvZGU='),base64_decode('am9pbg=='));
if(!function_exists(__NAMESPACE__.'\\___358959847')){
function ___358959847($_1918356548){
static $_52486419= false;
if($_52486419 == false) $_52486419=array('V1dBTExfTE9DSw==','c2VjdXJpdHk=','REFUQQ==','eyI=','V1dBTExfTE9DSw==','c2VjdXJpdHk=','U0VDVVJJVFlfV1dBTExfRVhDRVBUSU9O','RkFJTF9DSEVDS0lORw==','Q2FuIG5vdCBleGVjdXRlIHd3YWxsIHJ1bGVzOiA=','IFRyYWNlOiA=','UkVRVUVTVF9VUkk=','a2V5cw==','dmFsdWVz','U0VDVVJJVFlfV1dBTExfTU9ESUZZ','Lg==','U0VDVVJJVFlfV1dBTExfVU5TRVQ=','Lg==','U0VDVVJJVFlfV1dBTExfRVhJVA==','Lg==','Z2xvYmFs','a2V5cw==','dmFsdWVz','Z2V0','Z2V0','cG9zdA==','cG9zdA==','Y29va2ll','Y29va2ll','cmVxdWVzdA==','cmVxdWVzdA==','Z2xvYmFs','Z2xvYmFs','bWFpbl9zZWM=','V1dBTExfQUNUVUFMSVpFX1JVTEVT','dg==','dmVyc2lvbg==','aQ==','aXNJbnN0YWxsZWQ=','dg==','aW5p','bW9kdWxlcw==','bGljZW5zZQ==','cGhw','dg==','ZXh0','c2VjdXJpdHk=','ZGI=','dHlwZQ==','ZGI=','dmVyc2lvbg==','ZGI=','dHlwZQ==','ZGI=','dHlwZQ==','dmVyc2lvbg==','ZGI=','dmVyc2lvbg==','ZW52aXJvbm1lbnQ=','dm1fdmVyc2lvbg==','dm0=','dg==','ZW52aXJvbm1lbnQ=','dm1fdmVyc2lvbg==','c29ja2V0VGltZW91dA==','c3RyZWFtVGltZW91dA==','KCc=','ZGF0YQ==','JywgJw==','bW9kdWxl','JywgJw==','bW9kdWxlX3ZlcnNpb24=','Jyk=','LCA=','U0VDVVJJVFlfV1dBTExfRVhDRVBUSU9O','bWFpbg==','RkFJTF9SRUZSRVNISU5H','Q2FuIG5vdCByZWZyZXNoIHd3YWxsIHJ1bGVzOiA=','IFRyYWNlOiA=','ZGF0YQ==','eyI=','LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0=','Ck1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBcThRRTBIam1ISlVTdFdWNm4wemEKUlZvTHgwMkt6YmZyYlMvUDZzV2F4VHp3OFNlR1R0YlRDT3JwSGk1UUY2T1J5alovWHh6L0tMVTFHYm9mOUNaMwo0ejdTa3FVdDY2aWJYdk9GQng0ZncvQVBQUkdEcXRtMG5EM2ZnR3N1M1JlUGd3MjlpOCt2bTdtdEJLSlVZbDRyClZwYjZzZlpFVDlLRWI2VDFIRFltRXZjMWhxL2lpdXl4THJaWmk1UTZVZmY0VUV2VEkrNjhzc0ZSa1Erb3dUUnkKZU9JTWJGaE0vVVRtZlZZYlRSRnkyb1VROFdNemEybko1U2FoemkxVUtPMWpBalhUUFJyemM3QWp1NjM5ajFPMApwcHFmbTV4Z1dsRkFKa0hRVGdiZGQ1QVdxREZRa3Q5SEtrWStUbmZCTEdWTXZWeVB3VEhOV1FZQXc0eHBnL3dBClp3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQ==');
return base64_decode($_52486419[$_1918356548]);
}
};
use Bitrix\Main\Application;
use Bitrix\Main\Config\Option;
use Bitrix\Main\Data\Cache;
use Bitrix\Main\Loader;
use Bitrix\Main\ModuleManager;
use Bitrix\Main\Security\PublicKeyCipher;
use Bitrix\Main\SystemException;
use Bitrix\Main\Web\HttpClient;
use Bitrix\Main\Web\Json;
use Bitrix\Main\Security\W\Rules\Rule;
use Bitrix\Main\Security\W\Rules\Results\RuleAction;
use Bitrix\Main\Security\W\Rules\Results\RuleResult;
use Bitrix\Main\Security\W\Rules\Results\CheckResult;
use Bitrix\Main\Security\W\Rules\Results\ModifyResult;
use Bitrix\Main\Type\ArrayHelper;
use Bitrix\Main\Security\W\Rules\RuleRecordTable;
use CSecuritySystemInformation;
use ReflectionExtension;
class WWall{
const CACHE_RULES_TTL= 10800;
private static $_409688393= 'https://wwall.bitrix.info/rules.php';
protected $_1526082931= true;
public function handle(){
try{
$_1491881421= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
if(empty($_1491881421)){
return;
}
$_1569186999= Cache::createInstance();
$_6261737= false;
if($_1569186999->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
$_212875173= $_1569186999->getVars();
if($GLOBALS['____1283868688'][0]()- $_212875173> round(0+20)){
$_744925925= Application::getConnection();
$_997057004= RuleRecordTable::getTableName();
$_744925925->truncateTable($_997057004);
RuleRecordTable::cleanCache();
$_1569186999->clean(___358959847(0), ___358959847(1));
}
}
elseif($_1569186999->startDataCache()){
$_1569186999->endDataCache($GLOBALS['____1283868688'][1]());
$_6261737= true;
}
foreach($_1491881421 as $_1226542107){
$_740858679= new PublicKeyCipher;
$_1183734393= $_740858679->decrypt($_1226542107[___358959847(2)], static::__234613560());
if(!str_starts_with($_1183734393, ___358959847(3))){
continue;
}
$_1516019050= $GLOBALS['____1283868688'][2]($_1183734393, true);
if(!empty($_1516019050)){
$_1705982208= Rule::make($_1516019050);
$_767823782= $this->handleRule($_1705982208);
$this->applyHandlingResults($_767823782);
}
}
if($_6261737){
$_1569186999->clean(___358959847(4), ___358959847(5));
}
}
catch(\Throwable $_826600359){
$this->logEvent( ___358959847(6), ___358959847(7), ___358959847(8). $_826600359->getMessage(). ___358959847(9). $_826600359->getTraceAsString());
}
}
public function handleRule(Rule $_1705982208): array{
$_767823782=[];
if($_1705982208->matchPath($_SERVER[___358959847(10)])){
$_105438944= $this->getContextElements($_1705982208->getContext());
foreach($_105438944 as $_316555734 => &$_1854705209){
$_767823782= $GLOBALS['____1283868688'][3]($_767823782, $this->recursiveContextKeyHandle($_316555734, $_1854705209,[], $_1705982208));
}
}
return $_767823782;
}
public function applyHandlingResults(array $_767823782){
$_105438944= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
foreach($_767823782 as $_66222197){
$_1854705209=& $_105438944[$_66222197->getContextName()];
$_1553145561= $_66222197->getRuleResult();
$_1705982208= $_66222197->getRule();
if($_1553145561 instanceof ModifyResult){
if($_1705982208->getProcess() === ___358959847(11)){
static::rewriteContextKey( $_66222197->getContextName(), $_1854705209, $_66222197->getContextKey(), $_1553145561->getCleanValue());
}
elseif($_1705982208->getProcess() === ___358959847(12)){
static::rewriteContextValue( $_66222197->getContextName(), $_1854705209, $_66222197->getContextKey(), $_1553145561->getCleanValue());
}
$this->logEvent( ___358959847(13), $_66222197->getContextName(), $GLOBALS['____1283868688'][4](___358959847(14), $_66222197->getContextKey()));
}
elseif($_1553145561 instanceof CheckResult &&!$_1553145561->isSuccess()){
if($_1553145561->getAction() === RuleAction::UNSET){
static::unsetContextValue( $_66222197->getContextName(), $_1854705209, $_66222197->getContextKey(),);
$this->logEvent( ___358959847(15), $_66222197->getContextName(), $GLOBALS['____1283868688'][5](___358959847(16), $_66222197->getContextKey()));
}
elseif($_1553145561->getAction() === RuleAction::EXIT){
$this->logEvent( ___358959847(17), $_66222197->getContextName(), $GLOBALS['____1283868688'][6](___358959847(18), $_66222197->getContextKey()));
exit;
}
}
}
}
public function disableEventLogging(){
$this->_1526082931= false;
}
protected function rewriteContextKey($_316555734, &$_1854705209, $_969727820, $_12799372){
$_1777783368= $_969727820;
$GLOBALS['____1283868688'][7]($_1777783368);
$_1777783368[]= $_12799372;
if($_316555734 === ___358959847(19)){
$_965243975= $GLOBALS['____1283868688'][8]($_969727820);
$GLOBALS['____1283868688'][9]($_1777783368);
if(empty($_969727820)){
$GLOBALS[$_12799372]= $GLOBALS[$_965243975];
unset($GLOBALS[$_965243975]);
}
else{
$_1854705209=& $GLOBALS[$_965243975];
$_543901088= ArrayHelper::getByNestedKey($_1854705209, $_969727820);
ArrayHelper::setByNestedKey($_1854705209, $_1777783368, $_543901088);
ArrayHelper::unsetByNestedKey($_1854705209, $_969727820);
}
}
else{
$_543901088= ArrayHelper::getByNestedKey($_1854705209, $_969727820);
ArrayHelper::setByNestedKey($_1854705209, $_1777783368, $_543901088);
ArrayHelper::unsetByNestedKey($_1854705209, $_969727820);
}
}
protected function rewriteContextValue($_316555734, &$_1854705209, $_2007280863, $_543901088){
if($_316555734 === 'global'){
$_965243975= $GLOBALS['____1283868688'][10]($_2007280863);
if(empty($_2007280863)){
$GLOBALS[$_965243975]= $_543901088;
}
else{
$_1854705209=& $GLOBALS[$_965243975];
ArrayHelper::setByNestedKey($_1854705209, $_2007280863, $_543901088);
}
}
else{
ArrayHelper::setByNestedKey($_1854705209, $_2007280863, $_543901088);
}
}
protected function unsetContextValue($_316555734, &$_1854705209, $_2007280863){
if($_316555734 === 'global'){
$_965243975= $GLOBALS['____1283868688'][11]($_2007280863);
if(empty($_2007280863)){
unset($GLOBALS[$_965243975]);
}
else{
$_1854705209=& $GLOBALS[$_965243975];
ArrayHelper::unsetByNestedKey($_1854705209, $_2007280863);
}
}
else{
ArrayHelper::unsetByNestedKey($_1854705209, $_2007280863);
}
}
protected function recursiveContextKeyHandle(string $_316555734, array &$_1854705209, array $_1718719101, Rule $_1705982208): array{
$_767823782=[];
foreach($_1854705209 as $_320570128 => $_543901088){
$_2007280863= $GLOBALS['____1283868688'][12]($_1718719101,[$_320570128]);
if($_1705982208->matchKey($_2007280863)){
if($_1705982208->getProcess() === ___358959847(20)){
$_1553145561= $_1705982208->echo $_320570128;
}
elseif($_1705982208->getProcess() === ___358959847(21)){
$_1553145561= $_1705982208->evaluateValue($_543901088);
}
if(!empty($_1553145561) && $_1553145561 instanceof RuleResult){
$_767823782[]= new HandlingResult($_316555734, $_2007280863, $_1553145561, $_1705982208);
}
}
if($GLOBALS['____1283868688'][13]($_543901088)){
$_767823782= $GLOBALS['____1283868688'][14]($_767823782, $this->recursiveContextKeyHandle( $_316555734, $_1854705209[$_320570128], $_2007280863, $_1705982208));
}
}
return $_767823782;
}
protected function getContextElements(array $_636034137){
$_1970402032=[];
if($GLOBALS['____1283868688'][15](___358959847(22), $_636034137, true)){
$_1970402032[___358959847(23)]= &$_GET;
}
if($GLOBALS['____1283868688'][16](___358959847(24), $_636034137, true)){
$_1970402032[___358959847(25)]= &$_POST;
}
if($GLOBALS['____1283868688'][17](___358959847(26), $_636034137, true)){
$_1970402032[___358959847(27)]= &$_COOKIE;
}
if($GLOBALS['____1283868688'][18](___358959847(28), $_636034137, true)){
$_1970402032[___358959847(29)]= &$_REQUEST;
}
if($GLOBALS['____1283868688'][19](___358959847(30), $_636034137, true)){
$_1970402032[___358959847(31)]= $GLOBALS;
}
return $_1970402032;
}
public static function refreshRules(){
try{
$_1524368703= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
if(($GLOBALS['____1283868688'][20]()- $_1524368703)< static::CACHE_RULES_TTL){
return;
}
Option::set(___358959847(32), ___358959847(33), $GLOBALS['____1283868688'][21]());
$_112355495= null;
$_170206119= $GLOBALS['____1283868688'][22](function($_1759435792){
return[___358959847(34) => $_1759435792[___358959847(35)], ___358959847(36) => (int) $_1759435792[___358959847(37)]];
}
, ModuleManager::getModulesFromDisk());
$_78311497=[];
foreach($GLOBALS['____1283868688'][23]() as $_306671789){
$_1440754267= new ReflectionExtension($_306671789);
$_78311497[$_306671789]=[ ___358959847(38) => $_1440754267->getVersion(), ___358959847(39) => $_1440754267->getINIEntries()];
}
$_1061617490=[ ___358959847(40) => $GLOBALS['____1283868688'][24]($_170206119), ___358959847(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___358959847(42) => $GLOBALS['____1283868688'][25]([ ___358959847(43) => $GLOBALS['____1283868688'][26](), ___358959847(44) => $_78311497])];
if(Loader::includeModule(___358959847(45))){
$_1614740092= CSecuritySystemInformation::getSystemInformation();
if(isset($_1614740092[___358959847(46)][___358959847(47)]) && isset($_1614740092[___358959847(48)][___358959847(49)])){
$_1061617490[___358959847(50)]=[ ___358959847(51) => $_1614740092[___358959847(52)][___358959847(53)], ___358959847(54) => $_1614740092[___358959847(55)][___358959847(56)]];
}
if(isset($_1614740092[___358959847(57)][___358959847(58)])){
$_1061617490[___358959847(59)]=[___358959847(60) => $_1614740092[___358959847(61)][___358959847(62)]];
}
}
$_1934001018= new HttpClient([ ___358959847(63) => round(0+1.25+1.25+1.25+1.25), ___358959847(64) => round(0+1.25+1.25+1.25+1.25)]);
$_1308674283= $_1934001018->post( static::$_409688393, $_1061617490);
if($_1934001018->getStatus() == round(0+66.666666666667+66.666666666667+66.666666666667) &&!empty($_1308674283)){
$_112355495= Json::decode($_1308674283);
}
if($_112355495 !== null){
$_744925925= Application::getConnection();
$_997057004= RuleRecordTable::getTableName();
if(!empty($_112355495)){
foreach($_112355495 as $_1163516610){
if(!static::checkRuleSign($_1163516610)){
throw new SystemException('Invalid sign for rule '.$GLOBALS['____1283868688'][27]($_1163516610));
}
}
}
$_744925925->truncateTable($_997057004);
if(!empty($_112355495)){
$_292845620=[];
foreach($_112355495 as $_1163516610){
$_292845620[]= ___358959847(65). $_744925925->getSqlHelper()->forSql($_1163516610[___358959847(66)]). ___358959847(67). $_744925925->getSqlHelper()->forSql($_1163516610[___358959847(68)]). ___358959847(69). $_744925925->getSqlHelper()->forSql($_1163516610[___358959847(70)]). ___358959847(71);
}
$_1471120430= $GLOBALS['____1283868688'][28](___358959847(72), $_292845620);
$_744925925->query("INSERT INTO {
$_997057004
}
(DATA, MODULE, MODULE_VERSION) VALUES {
$_1471120430
}
");
RuleRecordTable::cleanCache();
}
}
}
catch(\Throwable $_826600359){
\CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___358959847(73), ___358959847(74), ___358959847(75), ___358959847(76). $_826600359->getMessage(). ___358959847(77). $_826600359->getTraceAsString());
}
}
protected static function checkRuleSign($_1705982208){
$_740858679= new PublicKeyCipher;
$_1516019050= $_740858679->decrypt($_1705982208[___358959847(78)], static::__234613560());
return str_starts_with($_1516019050, ___358959847(79));
}
private static function __234613560(){
$_584580975= '';
$_584580975 .= ___358959847(80);
$_584580975 .= ___358959847(81);
return $_584580975;
}
protected function logEvent($_59951213, $_309849178, $_1338487321){
if($this->_1526082931){
\CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_59951213, 'main', $_309849178, $_1338487321);
}
}
}
namespace Bitrix\Main\Security\W;
$GLOBALS['____1283868688']= array(base64_decode('dGltZQ=='),base64_decode('dGltZQ=='),base64_decode('anNvbl9kZWNvZGU='),base64_decode('YXJyYXlfbWVyZ2U='),base64_decode('am9pbg=='),base64_decode('am9pbg=='),base64_decode('am9pbg=='),base64_decode('YXJyYXlfcG9w'),base64_decode('YXJyYXlfc2hpZnQ='),base64_decode('YXJyYXlfc2hpZnQ='),base64_decode('YXJyYXlfc2hpZnQ='),base64_decode('YXJyYXlfc2hpZnQ='),base64_decode('YXJyYXlfbWVyZ2U='),base64_decode('aXNfYXJyYXk='),base64_decode('YXJyYXlfbWVyZ2U='),base64_decode('aW5fYXJyYXk='),base64_decode('aW5fYXJyYXk='),base64_decode('aW5fYXJyYXk='),base64_decode('aW5fYXJyYXk='),base64_decode('aW5fYXJyYXk='),base64_decode('dGltZQ=='),base64_decode('dGltZQ=='),base64_decode('YXJyYXlfbWFw'),base64_decode('Z2V0X2xvYWRlZF9leHRlbnNpb25z'),base64_decode('anNvbl9lbmNvZGU='),base64_decode('anNvbl9lbmNvZGU='),base64_decode('cGhwdmVyc2lvbg=='),base64_decode('anNvbl9lbmNvZGU='),base64_decode('am9pbg=='));
if(!function_exists(__NAMESPACE__.'\\___358959847')){
function ___358959847($_1918356548){
static $_52486419= false;
if($_52486419 == false) $_52486419=array('V1dBTExfTE9DSw==','c2VjdXJpdHk=','REFUQQ==','eyI=','V1dBTExfTE9DSw==','c2VjdXJpdHk=','U0VDVVJJVFlfV1dBTExfRVhDRVBUSU9O','RkFJTF9DSEVDS0lORw==','Q2FuIG5vdCBleGVjdXRlIHd3YWxsIHJ1bGVzOiA=','IFRyYWNlOiA=','UkVRVUVTVF9VUkk=','a2V5cw==','dmFsdWVz','U0VDVVJJVFlfV1dBTExfTU9ESUZZ','Lg==','U0VDVVJJVFlfV1dBTExfVU5TRVQ=','Lg==','U0VDVVJJVFlfV1dBTExfRVhJVA==','Lg==','Z2xvYmFs','a2V5cw==','dmFsdWVz','Z2V0','Z2V0','cG9zdA==','cG9zdA==','Y29va2ll','Y29va2ll','cmVxdWVzdA==','cmVxdWVzdA==','Z2xvYmFs','Z2xvYmFs','bWFpbl9zZWM=','V1dBTExfQUNUVUFMSVpFX1JVTEVT','dg==','dmVyc2lvbg==','aQ==','aXNJbnN0YWxsZWQ=','dg==','aW5p','bW9kdWxlcw==','bGljZW5zZQ==','cGhw','dg==','ZXh0','c2VjdXJpdHk=','ZGI=','dHlwZQ==','ZGI=','dmVyc2lvbg==','ZGI=','dHlwZQ==','ZGI=','dHlwZQ==','dmVyc2lvbg==','ZGI=','dmVyc2lvbg==','ZW52aXJvbm1lbnQ=','dm1fdmVyc2lvbg==','dm0=','dg==','ZW52aXJvbm1lbnQ=','dm1fdmVyc2lvbg==','c29ja2V0VGltZW91dA==','c3RyZWFtVGltZW91dA==','KCc=','ZGF0YQ==','JywgJw==','bW9kdWxl','JywgJw==','bW9kdWxlX3ZlcnNpb24=','Jyk=','LCA=','U0VDVVJJVFlfV1dBTExfRVhDRVBUSU9O','bWFpbg==','RkFJTF9SRUZSRVNISU5H','Q2FuIG5vdCByZWZyZXNoIHd3YWxsIHJ1bGVzOiA=','IFRyYWNlOiA=','ZGF0YQ==','eyI=','LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0=','Ck1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBcThRRTBIam1ISlVTdFdWNm4wemEKUlZvTHgwMkt6YmZyYlMvUDZzV2F4VHp3OFNlR1R0YlRDT3JwSGk1UUY2T1J5alovWHh6L0tMVTFHYm9mOUNaMwo0ejdTa3FVdDY2aWJYdk9GQng0ZncvQVBQUkdEcXRtMG5EM2ZnR3N1M1JlUGd3MjlpOCt2bTdtdEJLSlVZbDRyClZwYjZzZlpFVDlLRWI2VDFIRFltRXZjMWhxL2lpdXl4THJaWmk1UTZVZmY0VUV2VEkrNjhzc0ZSa1Erb3dUUnkKZU9JTWJGaE0vVVRtZlZZYlRSRnkyb1VROFdNemEybko1U2FoemkxVUtPMWpBalhUUFJyemM3QWp1NjM5ajFPMApwcHFmbTV4Z1dsRkFKa0hRVGdiZGQ1QVdxREZRa3Q5SEtrWStUbmZCTEdWTXZWeVB3VEhOV1FZQXc0eHBnL3dBClp3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQ==');
return base64_decode($_52486419[$_1918356548]);
}
};
use Bitrix\Main\Application;
use Bitrix\Main\Config\Option;
use Bitrix\Main\Data\Cache;
use Bitrix\Main\Loader;
use Bitrix\Main\ModuleManager;
use Bitrix\Main\Security\PublicKeyCipher;
use Bitrix\Main\SystemException;
use Bitrix\Main\Web\HttpClient;
use Bitrix\Main\Web\Json;
use Bitrix\Main\Security\W\Rules\Rule;
use Bitrix\Main\Security\W\Rules\Results\RuleAction;
use Bitrix\Main\Security\W\Rules\Results\RuleResult;
use Bitrix\Main\Security\W\Rules\Results\CheckResult;
use Bitrix\Main\Security\W\Rules\Results\ModifyResult;
use Bitrix\Main\Type\ArrayHelper;
use Bitrix\Main\Security\W\Rules\RuleRecordTable;
use CSecuritySystemInformation;
use ReflectionExtension;
class WWall{
const CACHE_RULES_TTL= 10800;
private static $_409688393= 'https://wwall.bitrix.info/rules.php';
protected $_1526082931= true;
public function handle(){
try{
$_1491881421= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
if(empty($_1491881421)){
return;
}
$_1569186999= Cache::createInstance();
$_6261737= false;
if($_1569186999->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
$_212875173= $_1569186999->getVars();
if($GLOBALS['____1283868688'][0]()- $_212875173> round(0+20)){
$_744925925= Application::getConnection();
$_997057004= RuleRecordTable::getTableName();
$_744925925->truncateTable($_997057004);
RuleRecordTable::cleanCache();
$_1569186999->clean(___358959847(0), ___358959847(1));
}
}
elseif($_1569186999->startDataCache()){
$_1569186999->endDataCache($GLOBALS['____1283868688'][1]());
$_6261737= true;
}
foreach($_1491881421 as $_1226542107){
$_740858679= new PublicKeyCipher;
$_1183734393= $_740858679->decrypt($_1226542107[___358959847(2)], static::__234613560());
if(!str_starts_with($_1183734393, ___358959847(3))){
continue;
}
$_1516019050= $GLOBALS['____1283868688'][2]($_1183734393, true);
if(!empty($_1516019050)){
$_1705982208= Rule::make($_1516019050);
$_767823782= $this->handleRule($_1705982208);
$this->applyHandlingResults($_767823782);
}
}
if($_6261737){
$_1569186999->clean(___358959847(4), ___358959847(5));
}
}
catch(\Throwable $_826600359){
$this->logEvent( ___358959847(6), ___358959847(7), ___358959847(8). $_826600359->getMessage(). ___358959847(9). $_826600359->getTraceAsString());
}
}
public function handleRule(Rule $_1705982208): array{
$_767823782=[];
if($_1705982208->matchPath($_SERVER[___358959847(10)])){
$_105438944= $this->getContextElements($_1705982208->getContext());
foreach($_105438944 as $_316555734 => &$_1854705209){
$_767823782= $GLOBALS['____1283868688'][3]($_767823782, $this->recursiveContextKeyHandle($_316555734, $_1854705209,[], $_1705982208));
}
}
return $_767823782;
}
public function applyHandlingResults(array $_767823782){
$_105438944= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
foreach($_767823782 as $_66222197){
$_1854705209=& $_105438944[$_66222197->getContextName()];
$_1553145561= $_66222197->getRuleResult();
$_1705982208= $_66222197->getRule();
if($_1553145561 instanceof ModifyResult){
if($_1705982208->getProcess() === ___358959847(11)){
static::rewriteContextKey( $_66222197->getContextName(), $_1854705209, $_66222197->getContextKey(), $_1553145561->getCleanValue());
}
elseif($_1705982208->getProcess() === ___358959847(12)){
static::rewriteContextValue( $_66222197->getContextName(), $_1854705209, $_66222197->getContextKey(), $_1553145561->getCleanValue());
}
$this->logEvent( ___358959847(13), $_66222197->getContextName(), $GLOBALS['____1283868688'][4](___358959847(14), $_66222197->getContextKey()));
}
elseif($_1553145561 instanceof CheckResult &&!$_1553145561->isSuccess()){
if($_1553145561->getAction() === RuleAction::UNSET){
static::unsetContextValue( $_66222197->getContextName(), $_1854705209, $_66222197->getContextKey(),);
$this->logEvent( ___358959847(15), $_66222197->getContextName(), $GLOBALS['____1283868688'][5](___358959847(16), $_66222197->getContextKey()));
}
elseif($_1553145561->getAction() === RuleAction::EXIT){
$this->logEvent( ___358959847(17), $_66222197->getContextName(), $GLOBALS['____1283868688'][6](___358959847(18), $_66222197->getContextKey()));
exit;
}
}
}
}
public function disableEventLogging(){
$this->_1526082931= false;
}
protected function rewriteContextKey($_316555734, &$_1854705209, $_969727820, $_12799372){
$_1777783368= $_969727820;
$GLOBALS['____1283868688'][7]($_1777783368);
$_1777783368[]= $_12799372;
if($_316555734 === ___358959847(19)){
$_965243975= $GLOBALS['____1283868688'][8]($_969727820);
$GLOBALS['____1283868688'][9]($_1777783368);
if(empty($_969727820)){
$GLOBALS[$_12799372]= $GLOBALS[$_965243975];
unset($GLOBALS[$_965243975]);
}
else{
$_1854705209=& $GLOBALS[$_965243975];
$_543901088= ArrayHelper::getByNestedKey($_1854705209, $_969727820);
ArrayHelper::setByNestedKey($_1854705209, $_1777783368, $_543901088);
ArrayHelper::unsetByNestedKey($_1854705209, $_969727820);
}
}
else{
$_543901088= ArrayHelper::getByNestedKey($_1854705209, $_969727820);
ArrayHelper::setByNestedKey($_1854705209, $_1777783368, $_543901088);
ArrayHelper::unsetByNestedKey($_1854705209, $_969727820);
}
}
protected function rewriteContextValue($_316555734, &$_1854705209, $_2007280863, $_543901088){
if($_316555734 === 'global'){
$_965243975= $GLOBALS['____1283868688'][10]($_2007280863);
if(empty($_2007280863)){
$GLOBALS[$_965243975]= $_543901088;
}
else{
$_1854705209=& $GLOBALS[$_965243975];
ArrayHelper::setByNestedKey($_1854705209, $_2007280863, $_543901088);
}
}
else{
ArrayHelper::setByNestedKey($_1854705209, $_2007280863, $_543901088);
}
}
protected function unsetContextValue($_316555734, &$_1854705209, $_2007280863){
if($_316555734 === 'global'){
$_965243975= $GLOBALS['____1283868688'][11]($_2007280863);
if(empty($_2007280863)){
unset($GLOBALS[$_965243975]);
}
else{
$_1854705209=& $GLOBALS[$_965243975];
ArrayHelper::unsetByNestedKey($_1854705209, $_2007280863);
}
}
else{
ArrayHelper::unsetByNestedKey($_1854705209, $_2007280863);
}
}
protected function recursiveContextKeyHandle(string $_316555734, array &$_1854705209, array $_1718719101, Rule $_1705982208): array{
$_767823782=[];
foreach($_1854705209 as $_320570128 => $_543901088){
$_2007280863= $GLOBALS['____1283868688'][12]($_1718719101,[$_320570128]);
if($_1705982208->matchKey($_2007280863)){
if($_1705982208->getProcess() === ___358959847(20)){
$_1553145561= $_1705982208->echo $_320570128;
}
elseif($_1705982208->getProcess() === ___358959847(21)){
$_1553145561= $_1705982208->echo $_543901088;
}
if(!empty($_1553145561) && $_1553145561 instanceof RuleResult){
$_767823782[]= new HandlingResult($_316555734, $_2007280863, $_1553145561, $_1705982208);
}
}
if($GLOBALS['____1283868688'][13]($_543901088)){
$_767823782= $GLOBALS['____1283868688'][14]($_767823782, $this->recursiveContextKeyHandle( $_316555734, $_1854705209[$_320570128], $_2007280863, $_1705982208));
}
}
return $_767823782;
}
protected function getContextElements(array $_636034137){
$_1970402032=[];
if($GLOBALS['____1283868688'][15](___358959847(22), $_636034137, true)){
$_1970402032[___358959847(23)]= &$_GET;
}
if($GLOBALS['____1283868688'][16](___358959847(24), $_636034137, true)){
$_1970402032[___358959847(25)]= &$_POST;
}
if($GLOBALS['____1283868688'][17](___358959847(26), $_636034137, true)){
$_1970402032[___358959847(27)]= &$_COOKIE;
}
if($GLOBALS['____1283868688'][18](___358959847(28), $_636034137, true)){
$_1970402032[___358959847(29)]= &$_REQUEST;
}
if($GLOBALS['____1283868688'][19](___358959847(30), $_636034137, true)){
$_1970402032[___358959847(31)]= $GLOBALS;
}
return $_1970402032;
}
public static function refreshRules(){
try{
$_1524368703= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
if(($GLOBALS['____1283868688'][20]()- $_1524368703)< static::CACHE_RULES_TTL){
return;
}
Option::set(___358959847(32), ___358959847(33), $GLOBALS['____1283868688'][21]());
$_112355495= null;
$_170206119= $GLOBALS['____1283868688'][22](function($_1759435792){
return[___358959847(34) => $_1759435792[___358959847(35)], ___358959847(36) => (int) $_1759435792[___358959847(37)]];
}
, ModuleManager::getModulesFromDisk());
$_78311497=[];
foreach($GLOBALS['____1283868688'][23]() as $_306671789){
$_1440754267= new ReflectionExtension($_306671789);
$_78311497[$_306671789]=[ ___358959847(38) => $_1440754267->getVersion(), ___358959847(39) => $_1440754267->getINIEntries()];
}
$_1061617490=[ ___358959847(40) => $GLOBALS['____1283868688'][24]($_170206119), ___358959847(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___358959847(42) => $GLOBALS['____1283868688'][25]([ ___358959847(43) => $GLOBALS['____1283868688'][26](), ___358959847(44) => $_78311497])];
if(Loader::includeModule(___358959847(45))){
$_1614740092= CSecuritySystemInformation::getSystemInformation();
if(isset($_1614740092[___358959847(46)][___358959847(47)]) && isset($_1614740092[___358959847(48)][___358959847(49)])){
$_1061617490[___358959847(50)]=[ ___358959847(51) => $_1614740092[___358959847(52)][___358959847(53)], ___358959847(54) => $_1614740092[___358959847(55)][___358959847(56)]];
}
if(isset($_1614740092[___358959847(57)][___358959847(58)])){
$_1061617490[___358959847(59)]=[___358959847(60) => $_1614740092[___358959847(61)][___358959847(62)]];
}
}
$_1934001018= new HttpClient([ ___358959847(63) => round(0+1.25+1.25+1.25+1.25), ___358959847(64) => round(0+1.25+1.25+1.25+1.25)]);
$_1308674283= $_1934001018->post( static::$_409688393, $_1061617490);
if($_1934001018->getStatus() == round(0+66.666666666667+66.666666666667+66.666666666667) &&!empty($_1308674283)){
$_112355495= Json::decode($_1308674283);
}
if($_112355495 !== null){
$_744925925= Application::getConnection();
$_997057004= RuleRecordTable::getTableName();
if(!empty($_112355495)){
foreach($_112355495 as $_1163516610){
if(!static::checkRuleSign($_1163516610)){
throw new SystemException('Invalid sign for rule '.$GLOBALS['____1283868688'][27]($_1163516610));
}
}
}
$_744925925->truncateTable($_997057004);
if(!empty($_112355495)){
$_292845620=[];
foreach($_112355495 as $_1163516610){
$_292845620[]= ___358959847(65). $_744925925->getSqlHelper()->forSql($_1163516610[___358959847(66)]). ___358959847(67). $_744925925->getSqlHelper()->forSql($_1163516610[___358959847(68)]). ___358959847(69). $_744925925->getSqlHelper()->forSql($_1163516610[___358959847(70)]). ___358959847(71);
}
$_1471120430= $GLOBALS['____1283868688'][28](___358959847(72), $_292845620);
$_744925925->query("INSERT INTO {
$_997057004
}
(DATA, MODULE, MODULE_VERSION) VALUES {
$_1471120430
}
");
RuleRecordTable::cleanCache();
}
}
}
catch(\Throwable $_826600359){
\CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___358959847(73), ___358959847(74), ___358959847(75), ___358959847(76). $_826600359->getMessage(). ___358959847(77). $_826600359->getTraceAsString());
}
}
protected static function checkRuleSign($_1705982208){
$_740858679= new PublicKeyCipher;
$_1516019050= $_740858679->decrypt($_1705982208[___358959847(78)], static::__234613560());
return str_starts_with($_1516019050, ___358959847(79));
}
private static function __234613560(){
$_584580975= '';
$_584580975 .= ___358959847(80);
$_584580975 .= ___358959847(81);
return $_584580975;
}
protected function logEvent($_59951213, $_309849178, $_1338487321){
if($this->_1526082931){
\CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_59951213, 'main', $_309849178, $_1338487321);
}
}
}
namespace Bitrix\Main\Security\W;
$GLOBALS['____1283868688']= array(timetimejson_decodearray_mergejoinjoinjoinarray_poparray_shiftarray_shiftarray_shiftarray_shiftarray_mergeis_arrayarray_mergein_arrayin_arrayin_arrayin_arrayin_arraytimetimearray_mapget_loaded_extensionsjson_encodejson_encodephpversionjson_encodejoin);
if(!function_exists(__NAMESPACE__.'\\___358959847')){
function ___358959847($_1918356548){
static $_52486419= false;
if($_52486419 == false) $_52486419=array('V1dBTExfTE9DSw==','c2VjdXJpdHk=','REFUQQ==','eyI=','V1dBTExfTE9DSw==','c2VjdXJpdHk=','U0VDVVJJVFlfV1dBTExfRVhDRVBUSU9O','RkFJTF9DSEVDS0lORw==','Q2FuIG5vdCBleGVjdXRlIHd3YWxsIHJ1bGVzOiA=','IFRyYWNlOiA=','UkVRVUVTVF9VUkk=','a2V5cw==','dmFsdWVz','U0VDVVJJVFlfV1dBTExfTU9ESUZZ','Lg==','U0VDVVJJVFlfV1dBTExfVU5TRVQ=','Lg==','U0VDVVJJVFlfV1dBTExfRVhJVA==','Lg==','Z2xvYmFs','a2V5cw==','dmFsdWVz','Z2V0','Z2V0','cG9zdA==','cG9zdA==','Y29va2ll','Y29va2ll','cmVxdWVzdA==','cmVxdWVzdA==','Z2xvYmFs','Z2xvYmFs','bWFpbl9zZWM=','V1dBTExfQUNUVUFMSVpFX1JVTEVT','dg==','dmVyc2lvbg==','aQ==','aXNJbnN0YWxsZWQ=','dg==','aW5p','bW9kdWxlcw==','bGljZW5zZQ==','cGhw','dg==','ZXh0','c2VjdXJpdHk=','ZGI=','dHlwZQ==','ZGI=','dmVyc2lvbg==','ZGI=','dHlwZQ==','ZGI=','dHlwZQ==','dmVyc2lvbg==','ZGI=','dmVyc2lvbg==','ZW52aXJvbm1lbnQ=','dm1fdmVyc2lvbg==','dm0=','dg==','ZW52aXJvbm1lbnQ=','dm1fdmVyc2lvbg==','c29ja2V0VGltZW91dA==','c3RyZWFtVGltZW91dA==','KCc=','ZGF0YQ==','JywgJw==','bW9kdWxl','JywgJw==','bW9kdWxlX3ZlcnNpb24=','Jyk=','LCA=','U0VDVVJJVFlfV1dBTExfRVhDRVBUSU9O','bWFpbg==','RkFJTF9SRUZSRVNISU5H','Q2FuIG5vdCByZWZyZXNoIHd3YWxsIHJ1bGVzOiA=','IFRyYWNlOiA=','ZGF0YQ==','eyI=','LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0=','Ck1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBcThRRTBIam1ISlVTdFdWNm4wemEKUlZvTHgwMkt6YmZyYlMvUDZzV2F4VHp3OFNlR1R0YlRDT3JwSGk1UUY2T1J5alovWHh6L0tMVTFHYm9mOUNaMwo0ejdTa3FVdDY2aWJYdk9GQng0ZncvQVBQUkdEcXRtMG5EM2ZnR3N1M1JlUGd3MjlpOCt2bTdtdEJLSlVZbDRyClZwYjZzZlpFVDlLRWI2VDFIRFltRXZjMWhxL2lpdXl4THJaWmk1UTZVZmY0VUV2VEkrNjhzc0ZSa1Erb3dUUnkKZU9JTWJGaE0vVVRtZlZZYlRSRnkyb1VROFdNemEybko1U2FoemkxVUtPMWpBalhUUFJyemM3QWp1NjM5ajFPMApwcHFmbTV4Z1dsRkFKa0hRVGdiZGQ1QVdxREZRa3Q5SEtrWStUbmZCTEdWTXZWeVB3VEhOV1FZQXc0eHBnL3dBClp3SURBUUFCCi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQ==');
return ;
}
};
use Bitrix\Main\Application;
use Bitrix\Main\Config\Option;
use Bitrix\Main\Data\Cache;
use Bitrix\Main\Loader;
use Bitrix\Main\ModuleManager;
use Bitrix\Main\Security\PublicKeyCipher;
use Bitrix\Main\SystemException;
use Bitrix\Main\Web\HttpClient;
use Bitrix\Main\Web\Json;
use Bitrix\Main\Security\W\Rules\Rule;
use Bitrix\Main\Security\W\Rules\Results\RuleAction;
use Bitrix\Main\Security\W\Rules\Results\RuleResult;
use Bitrix\Main\Security\W\Rules\Results\CheckResult;
use Bitrix\Main\Security\W\Rules\Results\ModifyResult;
use Bitrix\Main\Type\ArrayHelper;
use Bitrix\Main\Security\W\Rules\RuleRecordTable;
use CSecuritySystemInformation;
use ReflectionExtension;
class WWall{
const CACHE_RULES_TTL= 10800;
private static $_409688393= 'https://wwall.bitrix.info/rules.php';
protected $_1526082931= true;
public function handle(){
try{
$_1491881421= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
if(empty($_1491881421)){
return;
}
$_1569186999= Cache::createInstance();
$_6261737= false;
if($_1569186999->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
$_212875173= $_1569186999->getVars();
if($GLOBALS['____1283868688'][0]()- $_212875173> round(0+20)){
$_744925925= Application::getConnection();
$_997057004= RuleRecordTable::getTableName();
$_744925925->truncateTable($_997057004);
RuleRecordTable::cleanCache();
$_1569186999->clean(___358959847(0), ___358959847(1));
}
}
elseif($_1569186999->startDataCache()){
$_1569186999->endDataCache($GLOBALS['____1283868688'][1]());
$_6261737= true;
}
foreach($_1491881421 as $_1226542107){
$_740858679= new PublicKeyCipher;
$_1183734393= $_740858679->decrypt($_1226542107[___358959847(2)], static::__234613560());
if(!str_starts_with($_1183734393, ___358959847(3))){
continue;
}
$_1516019050= $GLOBALS['____1283868688'][2]($_1183734393, true);
if(!empty($_1516019050)){
$_1705982208= Rule::make($_1516019050);
$_767823782= $this->handleRule($_1705982208);
$this->applyHandlingResults($_767823782);
}
}
if($_6261737){
$_1569186999->clean(___358959847(4), ___358959847(5));
}
}
catch(\Throwable $_826600359){
$this->logEvent( ___358959847(6), ___358959847(7), ___358959847(8). $_826600359->getMessage(). ___358959847(9). $_826600359->getTraceAsString());
}
}
public function handleRule(Rule $_1705982208): array{
$_767823782=[];
if($_1705982208->matchPath($_SERVER[___358959847(10)])){
$_105438944= $this->getContextElements($_1705982208->getContext());
foreach($_105438944 as $_316555734 => &$_1854705209){
$_767823782= $GLOBALS['____1283868688'][3]($_767823782, $this->recursiveContextKeyHandle($_316555734, $_1854705209,[], $_1705982208));
}
}
return $_767823782;
}
public function applyHandlingResults(array $_767823782){
$_105438944= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
foreach($_767823782 as $_66222197){
$_1854705209=& $_105438944[$_66222197->getContextName()];
$_1553145561= $_66222197->getRuleResult();
$_1705982208= $_66222197->getRule();
if($_1553145561 instanceof ModifyResult){
if($_1705982208->getProcess() === ___358959847(11)){
static::rewriteContextKey( $_66222197->getContextName(), $_1854705209, $_66222197->getContextKey(), $_1553145561->getCleanValue());
}
elseif($_1705982208->getProcess() === ___358959847(12)){
static::rewriteContextValue( $_66222197->getContextName(), $_1854705209, $_66222197->getContextKey(), $_1553145561->getCleanValue());
}
$this->logEvent( ___358959847(13), $_66222197->getContextName(), $GLOBALS['____1283868688'][4](___358959847(14), $_66222197->getContextKey()));
}
elseif($_1553145561 instanceof CheckResult &&!$_1553145561->isSuccess()){
if($_1553145561->getAction() === RuleAction::UNSET){
static::unsetContextValue( $_66222197->getContextName(), $_1854705209, $_66222197->getContextKey(),);
$this->logEvent( ___358959847(15), $_66222197->getContextName(), $GLOBALS['____1283868688'][5](___358959847(16), $_66222197->getContextKey()));
}
elseif($_1553145561->getAction() === RuleAction::EXIT){
$this->logEvent( ___358959847(17), $_66222197->getContextName(), $GLOBALS['____1283868688'][6](___358959847(18), $_66222197->getContextKey()));
exit;
}
}
}
}
public function disableEventLogging(){
$this->_1526082931= false;
}
protected function rewriteContextKey($_316555734, &$_1854705209, $_969727820, $_12799372){
$_1777783368= $_969727820;
$GLOBALS['____1283868688'][7]($_1777783368);
$_1777783368[]= $_12799372;
if($_316555734 === ___358959847(19)){
$_965243975= $GLOBALS['____1283868688'][8]($_969727820);
$GLOBALS['____1283868688'][9]($_1777783368);
if(empty($_969727820)){
$GLOBALS[$_12799372]= $GLOBALS[$_965243975];
unset($GLOBALS[$_965243975]);
}
else{
$_1854705209=& $GLOBALS[$_965243975];
$_543901088= ArrayHelper::getByNestedKey($_1854705209, $_969727820);
ArrayHelper::setByNestedKey($_1854705209, $_1777783368, $_543901088);
ArrayHelper::unsetByNestedKey($_1854705209, $_969727820);
}
}
else{
$_543901088= ArrayHelper::getByNestedKey($_1854705209, $_969727820);
ArrayHelper::setByNestedKey($_1854705209, $_1777783368, $_543901088);
ArrayHelper::unsetByNestedKey($_1854705209, $_969727820);
}
}
protected function rewriteContextValue($_316555734, &$_1854705209, $_2007280863, $_543901088){
if($_316555734 === 'global'){
$_965243975= $GLOBALS['____1283868688'][10]($_2007280863);
if(empty($_2007280863)){
$GLOBALS[$_965243975]= $_543901088;
}
else{
$_1854705209=& $GLOBALS[$_965243975];
ArrayHelper::setByNestedKey($_1854705209, $_2007280863, $_543901088);
}
}
else{
ArrayHelper::setByNestedKey($_1854705209, $_2007280863, $_543901088);
}
}
protected function unsetContextValue($_316555734, &$_1854705209, $_2007280863){
if($_316555734 === 'global'){
$_965243975= $GLOBALS['____1283868688'][11]($_2007280863);
if(empty($_2007280863)){
unset($GLOBALS[$_965243975]);
}
else{
$_1854705209=& $GLOBALS[$_965243975];
ArrayHelper::unsetByNestedKey($_1854705209, $_2007280863);
}
}
else{
ArrayHelper::unsetByNestedKey($_1854705209, $_2007280863);
}
}
protected function recursiveContextKeyHandle(string $_316555734, array &$_1854705209, array $_1718719101, Rule $_1705982208): array{
$_767823782=[];
foreach($_1854705209 as $_320570128 => $_543901088){
$_2007280863= $GLOBALS['____1283868688'][12]($_1718719101,[$_320570128]);
if($_1705982208->matchKey($_2007280863)){
if($_1705982208->getProcess() === ___358959847(20)){
$_1553145561= $_1705982208->echo $_320570128;
}
elseif($_1705982208->getProcess() === ___358959847(21)){
$_1553145561= $_1705982208->echo $_543901088;
}
if(!empty($_1553145561) && $_1553145561 instanceof RuleResult){
$_767823782[]= new HandlingResult($_316555734, $_2007280863, $_1553145561, $_1705982208);
}
}
if($GLOBALS['____1283868688'][13]($_543901088)){
$_767823782= $GLOBALS['____1283868688'][14]($_767823782, $this->recursiveContextKeyHandle( $_316555734, $_1854705209[$_320570128], $_2007280863, $_1705982208));
}
}
return $_767823782;
}
protected function getContextElements(array $_636034137){
$_1970402032=[];
if($GLOBALS['____1283868688'][15](___358959847(22), $_636034137, true)){
$_1970402032[___358959847(23)]= &$_GET;
}
if($GLOBALS['____1283868688'][16](___358959847(24), $_636034137, true)){
$_1970402032[___358959847(25)]= &$_POST;
}
if($GLOBALS['____1283868688'][17](___358959847(26), $_636034137, true)){
$_1970402032[___358959847(27)]= &$_COOKIE;
}
if($GLOBALS['____1283868688'][18](___358959847(28), $_636034137, true)){
$_1970402032[___358959847(29)]= &$_REQUEST;
}
if($GLOBALS['____1283868688'][19](___358959847(30), $_636034137, true)){
$_1970402032[___358959847(31)]= $GLOBALS;
}
return $_1970402032;
}
public static function refreshRules(){
try{
$_1524368703= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
if(($GLOBALS['____1283868688'][20]()- $_1524368703)< static::CACHE_RULES_TTL){
return;
}
Option::set(___358959847(32), ___358959847(33), $GLOBALS['____1283868688'][21]());
$_112355495= null;
$_170206119= $GLOBALS['____1283868688'][22](function($_1759435792){
return[___358959847(34) => $_1759435792[___358959847(35)], ___358959847(36) => (int) $_1759435792[___358959847(37)]];
}
, ModuleManager::getModulesFromDisk());
$_78311497=[];
foreach($GLOBALS['____1283868688'][23]() as $_306671789){
$_1440754267= new ReflectionExtension($_306671789);
$_78311497[$_306671789]=[ ___358959847(38) => $_1440754267->getVersion(), ___358959847(39) => $_1440754267->getINIEntries()];
}
$_1061617490=[ ___358959847(40) => $GLOBALS['____1283868688'][24]($_170206119), ___358959847(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___358959847(42) => $GLOBALS['____1283868688'][25]([ ___358959847(43) => $GLOBALS['____1283868688'][26](), ___358959847(44) => $_78311497])];
if(Loader::includeModule(___358959847(45))){
$_1614740092= CSecuritySystemInformation::getSystemInformation();
if(isset($_1614740092[___358959847(46)][___358959847(47)]) && isset($_1614740092[___358959847(48)][___358959847(49)])){
$_1061617490[___358959847(50)]=[ ___358959847(51) => $_1614740092[___358959847(52)][___358959847(53)], ___358959847(54) => $_1614740092[___358959847(55)][___358959847(56)]];
}
if(isset($_1614740092[___358959847(57)][___358959847(58)])){
$_1061617490[___358959847(59)]=[___358959847(60) => $_1614740092[___358959847(61)][___358959847(62)]];
}
}
$_1934001018= new HttpClient([ ___358959847(63) => round(0+1.25+1.25+1.25+1.25), ___358959847(64) => round(0+1.25+1.25+1.25+1.25)]);
$_1308674283= $_1934001018->post( static::$_409688393, $_1061617490);
if($_1934001018->getStatus() == round(0+66.666666666667+66.666666666667+66.666666666667) &&!empty($_1308674283)){
$_112355495= Json::decode($_1308674283);
}
if($_112355495 !== null){
$_744925925= Application::getConnection();
$_997057004= RuleRecordTable::getTableName();
if(!empty($_112355495)){
foreach($_112355495 as $_1163516610){
if(!static::checkRuleSign($_1163516610)){
throw new SystemException('Invalid sign for rule '.$GLOBALS['____1283868688'][27]($_1163516610));
}
}
}
$_744925925->truncateTable($_997057004);
if(!empty($_112355495)){
$_292845620=[];
foreach($_112355495 as $_1163516610){
$_292845620[]= ___358959847(65). $_744925925->getSqlHelper()->forSql($_1163516610[___358959847(66)]). ___358959847(67). $_744925925->getSqlHelper()->forSql($_1163516610[___358959847(68)]). ___358959847(69). $_744925925->getSqlHelper()->forSql($_1163516610[___358959847(70)]). ___358959847(71);
}
$_1471120430= $GLOBALS['____1283868688'][28](___358959847(72), $_292845620);
$_744925925->query("INSERT INTO {
$_997057004
}
(DATA, MODULE, MODULE_VERSION) VALUES {
$_1471120430
}
");
RuleRecordTable::cleanCache();
}
}
}
catch(\Throwable $_826600359){
\CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___358959847(73), ___358959847(74), ___358959847(75), ___358959847(76). $_826600359->getMessage(). ___358959847(77). $_826600359->getTraceAsString());
}
}
protected static function checkRuleSign($_1705982208){
$_740858679= new PublicKeyCipher;
$_1516019050= $_740858679->decrypt($_1705982208[___358959847(78)], static::__234613560());
return str_starts_with($_1516019050, ___358959847(79));
}
private static function __234613560(){
$_584580975= '';
$_584580975 .= ___358959847(80);
$_584580975 .= ___358959847(81);
return $_584580975;
}
protected function logEvent($_59951213, $_309849178, $_1338487321){
if($this->_1526082931){
\CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_59951213, 'main', $_309849178, $_1338487321);
}
}
}
© 2023 Quttera Ltd. All rights reserved.