Online PHP and Javascript Decoder decode hidden script to uncover its real functionality


Show other level

namespace Bitrix\Main\Security\W;
$GLOBALS['____1868545639']= 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__.'\\___1795191430')){
		function ___1795191430($_777183396){
		static $_267851783= false;
		 if($_267851783 == false) $_267851783=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($_267851783[$_777183396]);
	}
};
 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 Bitrix\Main\License\UrlProvider;
 use CSecuritySystemInformation;
 use ReflectionExtension;
	 class WWall{
	 const CACHE_RULES_TTL= 10800;
	 protected $_2089441961= true;
		 public function handle(){
			 try{
			  $_102651695= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
				 if(empty($_102651695)){
				 return;
			}
			  $_1487687650= Cache::createInstance();
			 $_1273742852= false;
				 if($_1487687650->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
				 $_646021719= $_1487687650->getVars();
					 if($GLOBALS['____1868545639'][0]()- $_646021719> round(0+4+4+4+4+4)){
					  $_1470339538= Application::getConnection();
					 $_724236327= RuleRecordTable::getTableName();
					 $_1470339538->truncateTable($_724236327);
					 RuleRecordTable::cleanCache();
					 $_1487687650->clean(___1795191430(0), ___1795191430(1));
				}
			}
				 elseif($_1487687650->startDataCache()){
				  $_1487687650->endDataCache($GLOBALS['____1868545639'][1]());
				 $_1273742852= true;
			}
				 foreach($_102651695 as $_2059778942){
				 $_740175521= new PublicKeyCipher;
				 $_13083070= $_740175521->decrypt($_2059778942[___1795191430(2)], static::__1403820135());
					 if(!str_starts_with($_13083070, ___1795191430(3))){
					 continue;
				}
				 $_1986788859= $GLOBALS['____1868545639'][2]($_13083070, true);
					 if(!empty($_1986788859)){
					 $_1164902948= Rule::make($_1986788859);
					 $_1634303564= $this->handleRule($_1164902948);
					 $this->applyHandlingResults($_1634303564);
				}
			}
				  if($_1273742852){
				 $_1487687650->clean(___1795191430(4), ___1795191430(5));
			}
		}
			 catch(\Throwable $_101103004){
			 $this->logEvent( ___1795191430(6), ___1795191430(7), ___1795191430(8). $_101103004->getMessage(). ___1795191430(9). $_101103004->getTraceAsString());
		}
	}
		  public function handleRule(Rule $_1164902948): array{
		 $_1634303564=[];
			 if($_1164902948->matchPath($_SERVER[___1795191430(10)])){
			  $_1434953078= $this->getContextElements($_1164902948->getContext());
				 foreach($_1434953078 as $_1519286936 => &$_1881155965){
				 $_1634303564= $GLOBALS['____1868545639'][3]($_1634303564, $this->recursiveContextKeyHandle($_1519286936, $_1881155965,[], $_1164902948));
			}
		}
		 return $_1634303564;
	}
		  public function applyHandlingResults(array $_1634303564){
		 $_1434953078= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
			 foreach($_1634303564 as $_38065367){
			 $_1881155965=& $_1434953078[$_38065367->getContextName()];
			 $_1560487991= $_38065367->getRuleResult();
			 $_1164902948= $_38065367->getRule();
				 if($_1560487991 instanceof ModifyResult){
					 if($_1164902948->getProcess() === ___1795191430(11)){
					  static::rewriteContextKey( $_38065367->getContextName(), $_1881155965, $_38065367->getContextKey(), $_1560487991->getCleanValue());
				}
					 elseif($_1164902948->getProcess() === ___1795191430(12)){
					 static::rewriteContextValue( $_38065367->getContextName(), $_1881155965, $_38065367->getContextKey(), $_1560487991->getCleanValue());
				}
				 $this->logEvent( ___1795191430(13), $_38065367->getContextName(), $GLOBALS['____1868545639'][4](___1795191430(14), $_38065367->getContextKey()));
			}
				 elseif($_1560487991 instanceof CheckResult &&!$_1560487991->isSuccess()){
					 if($_1560487991->getAction() === RuleAction::UNSET){
					 static::unsetContextValue( $_38065367->getContextName(), $_1881155965, $_38065367->getContextKey(),);
					 $this->logEvent( ___1795191430(15), $_38065367->getContextName(), $GLOBALS['____1868545639'][5](___1795191430(16), $_38065367->getContextKey()));
				}
					 elseif($_1560487991->getAction() === RuleAction::EXIT){
					 $this->logEvent( ___1795191430(17), $_38065367->getContextName(), $GLOBALS['____1868545639'][6](___1795191430(18), $_38065367->getContextKey()));
					 exit;
				}
			}
		}
	}
		 public function disableEventLogging(){
		 $this->_2089441961= false;
	}
		 protected function rewriteContextKey($_1519286936, &$_1881155965, $_1964801418, $_1424040041){
		 $_1509488225= $_1964801418;
		  $GLOBALS['____1868545639'][7]($_1509488225);
		 $_1509488225[]= $_1424040041;
			 if($_1519286936 === ___1795191430(19)){
			 $_845407758= $GLOBALS['____1868545639'][8]($_1964801418);
			 $GLOBALS['____1868545639'][9]($_1509488225);
				 if(empty($_1964801418)){
				 $GLOBALS[$_1424040041]= $GLOBALS[$_845407758];
				 unset($GLOBALS[$_845407758]);
			}
				 else{
				 $_1881155965=& $GLOBALS[$_845407758];
				 $_905364533= ArrayHelper::getByNestedKey($_1881155965, $_1964801418);
				  ArrayHelper::setByNestedKey($_1881155965, $_1509488225, $_905364533);
				  ArrayHelper::unsetByNestedKey($_1881155965, $_1964801418);
			}
		}
			 else{
			 $_905364533= ArrayHelper::getByNestedKey($_1881155965, $_1964801418);
			  ArrayHelper::setByNestedKey($_1881155965, $_1509488225, $_905364533);
			  ArrayHelper::unsetByNestedKey($_1881155965, $_1964801418);
		}
	}
		 protected function rewriteContextValue($_1519286936, &$_1881155965, $_791132341, $_905364533){
			 if($_1519286936 === 'global'){
			 $_845407758= $GLOBALS['____1868545639'][10]($_791132341);
				 if(empty($_791132341)){
				 $GLOBALS[$_845407758]= $_905364533;
			}
				 else{
				 $_1881155965=& $GLOBALS[$_845407758];
				 ArrayHelper::setByNestedKey($_1881155965, $_791132341, $_905364533);
			}
		}
			 else{
			  ArrayHelper::setByNestedKey($_1881155965, $_791132341, $_905364533);
		}
	}
		 protected function unsetContextValue($_1519286936, &$_1881155965, $_791132341){
			 if($_1519286936 === 'global'){
			 $_845407758= $GLOBALS['____1868545639'][11]($_791132341);
				 if(empty($_791132341)){
				 unset($GLOBALS[$_845407758]);
			}
				 else{
				 $_1881155965=& $GLOBALS[$_845407758];
				 ArrayHelper::unsetByNestedKey($_1881155965, $_791132341);
			}
		}
			 else{
			 ArrayHelper::unsetByNestedKey($_1881155965, $_791132341);
		}
	}
		  protected function recursiveContextKeyHandle(string $_1519286936, array &$_1881155965, array $_355261997, Rule $_1164902948): array{
		  $_1634303564=[];
			 foreach($_1881155965 as $_142012392 => $_905364533){
			 $_791132341= $GLOBALS['____1868545639'][12]($_355261997,[$_142012392]);
				 if($_1164902948->matchKey($_791132341)){
					  if($_1164902948->getProcess() === ___1795191430(20)){
					 $_1560487991= $_1164902948->echo $_142012392;
				}
					 elseif($_1164902948->getProcess() === ___1795191430(21)){
					 $_1560487991= $_1164902948->evaluateValue($_905364533);
				}
					  if(!empty($_1560487991) && $_1560487991 instanceof RuleResult){
					 $_1634303564[]= new HandlingResult($_1519286936, $_791132341, $_1560487991, $_1164902948);
				}
			}
				  if($GLOBALS['____1868545639'][13]($_905364533)){
				 $_1634303564= $GLOBALS['____1868545639'][14]($_1634303564, $this->recursiveContextKeyHandle( $_1519286936, $_1881155965[$_142012392], $_791132341, $_1164902948));
			}
		}
		 return $_1634303564;
	}
		 protected function getContextElements(array $_1988337324){
		 $_2079501568=[];
			 if($GLOBALS['____1868545639'][15](___1795191430(22), $_1988337324, true)){
			 $_2079501568[___1795191430(23)]= &$_GET;
		}
			 if($GLOBALS['____1868545639'][16](___1795191430(24), $_1988337324, true)){
			 $_2079501568[___1795191430(25)]= &$_POST;
		}
			 if($GLOBALS['____1868545639'][17](___1795191430(26), $_1988337324, true)){
			 $_2079501568[___1795191430(27)]= &$_COOKIE;
		}
			 if($GLOBALS['____1868545639'][18](___1795191430(28), $_1988337324, true)){
			 $_2079501568[___1795191430(29)]= &$_REQUEST;
		}
			 if($GLOBALS['____1868545639'][19](___1795191430(30), $_1988337324, true)){
			 $_2079501568[___1795191430(31)]= $GLOBALS;
		}
		 return $_2079501568;
	}
		 public static function refreshRules(){
			 try{
			 $_1268296701= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
				 if(($GLOBALS['____1868545639'][20]()- $_1268296701)< static::CACHE_RULES_TTL){
				 return;
			}
			 Option::set(___1795191430(32), ___1795191430(33), $GLOBALS['____1868545639'][21]());
			 $_1767386910= null;
				  $_1880281881= $GLOBALS['____1868545639'][22](function($_353175819){
				 return[___1795191430(34) => $_353175819[___1795191430(35)], ___1795191430(36) => (int) $_353175819[___1795191430(37)]];
			}
			, ModuleManager::getModulesFromDisk());
			  $_263075959=[];
				 foreach($GLOBALS['____1868545639'][23]() as $_1396122968){
				 $_429584643= new ReflectionExtension($_1396122968);
				 $_263075959[$_1396122968]=[ ___1795191430(38) => $_429584643->getVersion(), ___1795191430(39) => $_429584643->getINIEntries()];
			}
			 $_1318827323=[ ___1795191430(40) => $GLOBALS['____1868545639'][24]($_1880281881), ___1795191430(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___1795191430(42) => $GLOBALS['____1868545639'][25]([ ___1795191430(43) => $GLOBALS['____1868545639'][26](), ___1795191430(44) => $_263075959])];
				 if(Loader::includeModule(___1795191430(45))){
				 $_1117161913= CSecuritySystemInformation::getSystemInformation();
					 if(isset($_1117161913[___1795191430(46)][___1795191430(47)]) && isset($_1117161913[___1795191430(48)][___1795191430(49)])){
					 $_1318827323[___1795191430(50)]=[ ___1795191430(51) => $_1117161913[___1795191430(52)][___1795191430(53)], ___1795191430(54) => $_1117161913[___1795191430(55)][___1795191430(56)]];
				}
					 if(isset($_1117161913[___1795191430(57)][___1795191430(58)])){
					 $_1318827323[___1795191430(59)]=[___1795191430(60) => $_1117161913[___1795191430(61)][___1795191430(62)]];
				}
			}
			  $_1370135084= new HttpClient([ ___1795191430(63) => round(0+1+1+1+1+1), ___1795191430(64) => round(0+5)]);
			 $_1640634300=(new UrlProvider())->getTechDomain();
				 $_559917633="https://wwall.{
				$_1640634300
			}
			/rules.php";
			 $_1273798877= $_1370135084->post($_559917633, $_1318827323);
				 if($_1370135084->getStatus() == round(0+100+100) &&!empty($_1273798877)){
				 $_1767386910= Json::decode($_1273798877);
			}
				  if($_1767386910 !== null){
				 $_1470339538= Application::getConnection();
				 $_724236327= RuleRecordTable::getTableName();
					 if(!empty($_1767386910)){
						 foreach($_1767386910 as $_2091050602){
							 if(!static::checkRuleSign($_2091050602)){
							 throw new SystemException('Invalid sign for rule '.$GLOBALS['____1868545639'][27]($_2091050602));
						}
					}
				}
				  $_1470339538->truncateTable($_724236327);
					  if(!empty($_1767386910)){
					 $_2095367311=[];
						 foreach($_1767386910 as $_2091050602){
						 $_2095367311[]= ___1795191430(65). $_1470339538->getSqlHelper()->forSql($_2091050602[___1795191430(66)]). ___1795191430(67). $_1470339538->getSqlHelper()->forSql($_2091050602[___1795191430(68)]). ___1795191430(69). $_1470339538->getSqlHelper()->forSql($_2091050602[___1795191430(70)]). ___1795191430(71);
					}
					 $_1928272420= $GLOBALS['____1868545639'][28](___1795191430(72), $_2095367311);
						  $_1470339538->query("INSERT INTO {
						$_724236327
					}
						 (DATA, MODULE, MODULE_VERSION) VALUES {
						$_1928272420
					}
					");
					  RuleRecordTable::cleanCache();
				}
			}
		}
			 catch(\Throwable $_101103004){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___1795191430(73), ___1795191430(74), ___1795191430(75), ___1795191430(76). $_101103004->getMessage(). ___1795191430(77). $_101103004->getTraceAsString());
		}
	}
		 protected static function checkRuleSign($_1164902948){
		 $_740175521= new PublicKeyCipher;
		 $_1986788859= $_740175521->decrypt($_1164902948[___1795191430(78)], static::__1403820135());
		 return str_starts_with($_1986788859, ___1795191430(79));
	}
		 private static function __1403820135(){
		 $_784161361= '';
		 $_784161361 .= ___1795191430(80);
		 $_784161361 .= ___1795191430(81);
		 return $_784161361;
	}
		 protected function logEvent($_2059791618, $_1848217452, $_1203079321){
			 if($this->_2089441961){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_2059791618, 'main', $_1848217452, $_1203079321);
		}
	}
}

namespace Bitrix\Main\Security\W;
$GLOBALS['____1868545639']= 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__.'\\___1795191430')){
		function ___1795191430($_777183396){
		static $_267851783= false;
		 if($_267851783 == false) $_267851783=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($_267851783[$_777183396]);
	}
};
 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 Bitrix\Main\License\UrlProvider;
 use CSecuritySystemInformation;
 use ReflectionExtension;
	 class WWall{
	 const CACHE_RULES_TTL= 10800;
	 protected $_2089441961= true;
		 public function handle(){
			 try{
			  $_102651695= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
				 if(empty($_102651695)){
				 return;
			}
			  $_1487687650= Cache::createInstance();
			 $_1273742852= false;
				 if($_1487687650->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
				 $_646021719= $_1487687650->getVars();
					 if($GLOBALS['____1868545639'][0]()- $_646021719> round(0+4+4+4+4+4)){
					  $_1470339538= Application::getConnection();
					 $_724236327= RuleRecordTable::getTableName();
					 $_1470339538->truncateTable($_724236327);
					 RuleRecordTable::cleanCache();
					 $_1487687650->clean(___1795191430(0), ___1795191430(1));
				}
			}
				 elseif($_1487687650->startDataCache()){
				  $_1487687650->endDataCache($GLOBALS['____1868545639'][1]());
				 $_1273742852= true;
			}
				 foreach($_102651695 as $_2059778942){
				 $_740175521= new PublicKeyCipher;
				 $_13083070= $_740175521->decrypt($_2059778942[___1795191430(2)], static::__1403820135());
					 if(!str_starts_with($_13083070, ___1795191430(3))){
					 continue;
				}
				 $_1986788859= $GLOBALS['____1868545639'][2]($_13083070, true);
					 if(!empty($_1986788859)){
					 $_1164902948= Rule::make($_1986788859);
					 $_1634303564= $this->handleRule($_1164902948);
					 $this->applyHandlingResults($_1634303564);
				}
			}
				  if($_1273742852){
				 $_1487687650->clean(___1795191430(4), ___1795191430(5));
			}
		}
			 catch(\Throwable $_101103004){
			 $this->logEvent( ___1795191430(6), ___1795191430(7), ___1795191430(8). $_101103004->getMessage(). ___1795191430(9). $_101103004->getTraceAsString());
		}
	}
		  public function handleRule(Rule $_1164902948): array{
		 $_1634303564=[];
			 if($_1164902948->matchPath($_SERVER[___1795191430(10)])){
			  $_1434953078= $this->getContextElements($_1164902948->getContext());
				 foreach($_1434953078 as $_1519286936 => &$_1881155965){
				 $_1634303564= $GLOBALS['____1868545639'][3]($_1634303564, $this->recursiveContextKeyHandle($_1519286936, $_1881155965,[], $_1164902948));
			}
		}
		 return $_1634303564;
	}
		  public function applyHandlingResults(array $_1634303564){
		 $_1434953078= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
			 foreach($_1634303564 as $_38065367){
			 $_1881155965=& $_1434953078[$_38065367->getContextName()];
			 $_1560487991= $_38065367->getRuleResult();
			 $_1164902948= $_38065367->getRule();
				 if($_1560487991 instanceof ModifyResult){
					 if($_1164902948->getProcess() === ___1795191430(11)){
					  static::rewriteContextKey( $_38065367->getContextName(), $_1881155965, $_38065367->getContextKey(), $_1560487991->getCleanValue());
				}
					 elseif($_1164902948->getProcess() === ___1795191430(12)){
					 static::rewriteContextValue( $_38065367->getContextName(), $_1881155965, $_38065367->getContextKey(), $_1560487991->getCleanValue());
				}
				 $this->logEvent( ___1795191430(13), $_38065367->getContextName(), $GLOBALS['____1868545639'][4](___1795191430(14), $_38065367->getContextKey()));
			}
				 elseif($_1560487991 instanceof CheckResult &&!$_1560487991->isSuccess()){
					 if($_1560487991->getAction() === RuleAction::UNSET){
					 static::unsetContextValue( $_38065367->getContextName(), $_1881155965, $_38065367->getContextKey(),);
					 $this->logEvent( ___1795191430(15), $_38065367->getContextName(), $GLOBALS['____1868545639'][5](___1795191430(16), $_38065367->getContextKey()));
				}
					 elseif($_1560487991->getAction() === RuleAction::EXIT){
					 $this->logEvent( ___1795191430(17), $_38065367->getContextName(), $GLOBALS['____1868545639'][6](___1795191430(18), $_38065367->getContextKey()));
					 exit;
				}
			}
		}
	}
		 public function disableEventLogging(){
		 $this->_2089441961= false;
	}
		 protected function rewriteContextKey($_1519286936, &$_1881155965, $_1964801418, $_1424040041){
		 $_1509488225= $_1964801418;
		  $GLOBALS['____1868545639'][7]($_1509488225);
		 $_1509488225[]= $_1424040041;
			 if($_1519286936 === ___1795191430(19)){
			 $_845407758= $GLOBALS['____1868545639'][8]($_1964801418);
			 $GLOBALS['____1868545639'][9]($_1509488225);
				 if(empty($_1964801418)){
				 $GLOBALS[$_1424040041]= $GLOBALS[$_845407758];
				 unset($GLOBALS[$_845407758]);
			}
				 else{
				 $_1881155965=& $GLOBALS[$_845407758];
				 $_905364533= ArrayHelper::getByNestedKey($_1881155965, $_1964801418);
				  ArrayHelper::setByNestedKey($_1881155965, $_1509488225, $_905364533);
				  ArrayHelper::unsetByNestedKey($_1881155965, $_1964801418);
			}
		}
			 else{
			 $_905364533= ArrayHelper::getByNestedKey($_1881155965, $_1964801418);
			  ArrayHelper::setByNestedKey($_1881155965, $_1509488225, $_905364533);
			  ArrayHelper::unsetByNestedKey($_1881155965, $_1964801418);
		}
	}
		 protected function rewriteContextValue($_1519286936, &$_1881155965, $_791132341, $_905364533){
			 if($_1519286936 === 'global'){
			 $_845407758= $GLOBALS['____1868545639'][10]($_791132341);
				 if(empty($_791132341)){
				 $GLOBALS[$_845407758]= $_905364533;
			}
				 else{
				 $_1881155965=& $GLOBALS[$_845407758];
				 ArrayHelper::setByNestedKey($_1881155965, $_791132341, $_905364533);
			}
		}
			 else{
			  ArrayHelper::setByNestedKey($_1881155965, $_791132341, $_905364533);
		}
	}
		 protected function unsetContextValue($_1519286936, &$_1881155965, $_791132341){
			 if($_1519286936 === 'global'){
			 $_845407758= $GLOBALS['____1868545639'][11]($_791132341);
				 if(empty($_791132341)){
				 unset($GLOBALS[$_845407758]);
			}
				 else{
				 $_1881155965=& $GLOBALS[$_845407758];
				 ArrayHelper::unsetByNestedKey($_1881155965, $_791132341);
			}
		}
			 else{
			 ArrayHelper::unsetByNestedKey($_1881155965, $_791132341);
		}
	}
		  protected function recursiveContextKeyHandle(string $_1519286936, array &$_1881155965, array $_355261997, Rule $_1164902948): array{
		  $_1634303564=[];
			 foreach($_1881155965 as $_142012392 => $_905364533){
			 $_791132341= $GLOBALS['____1868545639'][12]($_355261997,[$_142012392]);
				 if($_1164902948->matchKey($_791132341)){
					  if($_1164902948->getProcess() === ___1795191430(20)){
					 $_1560487991= $_1164902948->echo $_142012392;
				}
					 elseif($_1164902948->getProcess() === ___1795191430(21)){
					 $_1560487991= $_1164902948->echo $_905364533;
				}
					  if(!empty($_1560487991) && $_1560487991 instanceof RuleResult){
					 $_1634303564[]= new HandlingResult($_1519286936, $_791132341, $_1560487991, $_1164902948);
				}
			}
				  if($GLOBALS['____1868545639'][13]($_905364533)){
				 $_1634303564= $GLOBALS['____1868545639'][14]($_1634303564, $this->recursiveContextKeyHandle( $_1519286936, $_1881155965[$_142012392], $_791132341, $_1164902948));
			}
		}
		 return $_1634303564;
	}
		 protected function getContextElements(array $_1988337324){
		 $_2079501568=[];
			 if($GLOBALS['____1868545639'][15](___1795191430(22), $_1988337324, true)){
			 $_2079501568[___1795191430(23)]= &$_GET;
		}
			 if($GLOBALS['____1868545639'][16](___1795191430(24), $_1988337324, true)){
			 $_2079501568[___1795191430(25)]= &$_POST;
		}
			 if($GLOBALS['____1868545639'][17](___1795191430(26), $_1988337324, true)){
			 $_2079501568[___1795191430(27)]= &$_COOKIE;
		}
			 if($GLOBALS['____1868545639'][18](___1795191430(28), $_1988337324, true)){
			 $_2079501568[___1795191430(29)]= &$_REQUEST;
		}
			 if($GLOBALS['____1868545639'][19](___1795191430(30), $_1988337324, true)){
			 $_2079501568[___1795191430(31)]= $GLOBALS;
		}
		 return $_2079501568;
	}
		 public static function refreshRules(){
			 try{
			 $_1268296701= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
				 if(($GLOBALS['____1868545639'][20]()- $_1268296701)< static::CACHE_RULES_TTL){
				 return;
			}
			 Option::set(___1795191430(32), ___1795191430(33), $GLOBALS['____1868545639'][21]());
			 $_1767386910= null;
				  $_1880281881= $GLOBALS['____1868545639'][22](function($_353175819){
				 return[___1795191430(34) => $_353175819[___1795191430(35)], ___1795191430(36) => (int) $_353175819[___1795191430(37)]];
			}
			, ModuleManager::getModulesFromDisk());
			  $_263075959=[];
				 foreach($GLOBALS['____1868545639'][23]() as $_1396122968){
				 $_429584643= new ReflectionExtension($_1396122968);
				 $_263075959[$_1396122968]=[ ___1795191430(38) => $_429584643->getVersion(), ___1795191430(39) => $_429584643->getINIEntries()];
			}
			 $_1318827323=[ ___1795191430(40) => $GLOBALS['____1868545639'][24]($_1880281881), ___1795191430(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___1795191430(42) => $GLOBALS['____1868545639'][25]([ ___1795191430(43) => $GLOBALS['____1868545639'][26](), ___1795191430(44) => $_263075959])];
				 if(Loader::includeModule(___1795191430(45))){
				 $_1117161913= CSecuritySystemInformation::getSystemInformation();
					 if(isset($_1117161913[___1795191430(46)][___1795191430(47)]) && isset($_1117161913[___1795191430(48)][___1795191430(49)])){
					 $_1318827323[___1795191430(50)]=[ ___1795191430(51) => $_1117161913[___1795191430(52)][___1795191430(53)], ___1795191430(54) => $_1117161913[___1795191430(55)][___1795191430(56)]];
				}
					 if(isset($_1117161913[___1795191430(57)][___1795191430(58)])){
					 $_1318827323[___1795191430(59)]=[___1795191430(60) => $_1117161913[___1795191430(61)][___1795191430(62)]];
				}
			}
			  $_1370135084= new HttpClient([ ___1795191430(63) => round(0+1+1+1+1+1), ___1795191430(64) => round(0+5)]);
			 $_1640634300=(new UrlProvider())->getTechDomain();
				 $_559917633="https://wwall.{
				$_1640634300
			}
			/rules.php";
			 $_1273798877= $_1370135084->post($_559917633, $_1318827323);
				 if($_1370135084->getStatus() == round(0+100+100) &&!empty($_1273798877)){
				 $_1767386910= Json::decode($_1273798877);
			}
				  if($_1767386910 !== null){
				 $_1470339538= Application::getConnection();
				 $_724236327= RuleRecordTable::getTableName();
					 if(!empty($_1767386910)){
						 foreach($_1767386910 as $_2091050602){
							 if(!static::checkRuleSign($_2091050602)){
							 throw new SystemException('Invalid sign for rule '.$GLOBALS['____1868545639'][27]($_2091050602));
						}
					}
				}
				  $_1470339538->truncateTable($_724236327);
					  if(!empty($_1767386910)){
					 $_2095367311=[];
						 foreach($_1767386910 as $_2091050602){
						 $_2095367311[]= ___1795191430(65). $_1470339538->getSqlHelper()->forSql($_2091050602[___1795191430(66)]). ___1795191430(67). $_1470339538->getSqlHelper()->forSql($_2091050602[___1795191430(68)]). ___1795191430(69). $_1470339538->getSqlHelper()->forSql($_2091050602[___1795191430(70)]). ___1795191430(71);
					}
					 $_1928272420= $GLOBALS['____1868545639'][28](___1795191430(72), $_2095367311);
						  $_1470339538->query("INSERT INTO {
						$_724236327
					}
						 (DATA, MODULE, MODULE_VERSION) VALUES {
						$_1928272420
					}
					");
					  RuleRecordTable::cleanCache();
				}
			}
		}
			 catch(\Throwable $_101103004){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___1795191430(73), ___1795191430(74), ___1795191430(75), ___1795191430(76). $_101103004->getMessage(). ___1795191430(77). $_101103004->getTraceAsString());
		}
	}
		 protected static function checkRuleSign($_1164902948){
		 $_740175521= new PublicKeyCipher;
		 $_1986788859= $_740175521->decrypt($_1164902948[___1795191430(78)], static::__1403820135());
		 return str_starts_with($_1986788859, ___1795191430(79));
	}
		 private static function __1403820135(){
		 $_784161361= '';
		 $_784161361 .= ___1795191430(80);
		 $_784161361 .= ___1795191430(81);
		 return $_784161361;
	}
		 protected function logEvent($_2059791618, $_1848217452, $_1203079321){
			 if($this->_2089441961){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_2059791618, 'main', $_1848217452, $_1203079321);
		}
	}
}

namespace Bitrix\Main\Security\W;
$GLOBALS['____1868545639']= 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__.'\\___1795191430')){
		function ___1795191430($_777183396){
		static $_267851783= false;
		 if($_267851783 == false) $_267851783=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 Bitrix\Main\License\UrlProvider;
 use CSecuritySystemInformation;
 use ReflectionExtension;
	 class WWall{
	 const CACHE_RULES_TTL= 10800;
	 protected $_2089441961= true;
		 public function handle(){
			 try{
			  $_102651695= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
				 if(empty($_102651695)){
				 return;
			}
			  $_1487687650= Cache::createInstance();
			 $_1273742852= false;
				 if($_1487687650->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
				 $_646021719= $_1487687650->getVars();
					 if($GLOBALS['____1868545639'][0]()- $_646021719> round(0+4+4+4+4+4)){
					  $_1470339538= Application::getConnection();
					 $_724236327= RuleRecordTable::getTableName();
					 $_1470339538->truncateTable($_724236327);
					 RuleRecordTable::cleanCache();
					 $_1487687650->clean(___1795191430(0), ___1795191430(1));
				}
			}
				 elseif($_1487687650->startDataCache()){
				  $_1487687650->endDataCache($GLOBALS['____1868545639'][1]());
				 $_1273742852= true;
			}
				 foreach($_102651695 as $_2059778942){
				 $_740175521= new PublicKeyCipher;
				 $_13083070= $_740175521->decrypt($_2059778942[___1795191430(2)], static::__1403820135());
					 if(!str_starts_with($_13083070, ___1795191430(3))){
					 continue;
				}
				 $_1986788859= $GLOBALS['____1868545639'][2]($_13083070, true);
					 if(!empty($_1986788859)){
					 $_1164902948= Rule::make($_1986788859);
					 $_1634303564= $this->handleRule($_1164902948);
					 $this->applyHandlingResults($_1634303564);
				}
			}
				  if($_1273742852){
				 $_1487687650->clean(___1795191430(4), ___1795191430(5));
			}
		}
			 catch(\Throwable $_101103004){
			 $this->logEvent( ___1795191430(6), ___1795191430(7), ___1795191430(8). $_101103004->getMessage(). ___1795191430(9). $_101103004->getTraceAsString());
		}
	}
		  public function handleRule(Rule $_1164902948): array{
		 $_1634303564=[];
			 if($_1164902948->matchPath($_SERVER[___1795191430(10)])){
			  $_1434953078= $this->getContextElements($_1164902948->getContext());
				 foreach($_1434953078 as $_1519286936 => &$_1881155965){
				 $_1634303564= $GLOBALS['____1868545639'][3]($_1634303564, $this->recursiveContextKeyHandle($_1519286936, $_1881155965,[], $_1164902948));
			}
		}
		 return $_1634303564;
	}
		  public function applyHandlingResults(array $_1634303564){
		 $_1434953078= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
			 foreach($_1634303564 as $_38065367){
			 $_1881155965=& $_1434953078[$_38065367->getContextName()];
			 $_1560487991= $_38065367->getRuleResult();
			 $_1164902948= $_38065367->getRule();
				 if($_1560487991 instanceof ModifyResult){
					 if($_1164902948->getProcess() === ___1795191430(11)){
					  static::rewriteContextKey( $_38065367->getContextName(), $_1881155965, $_38065367->getContextKey(), $_1560487991->getCleanValue());
				}
					 elseif($_1164902948->getProcess() === ___1795191430(12)){
					 static::rewriteContextValue( $_38065367->getContextName(), $_1881155965, $_38065367->getContextKey(), $_1560487991->getCleanValue());
				}
				 $this->logEvent( ___1795191430(13), $_38065367->getContextName(), $GLOBALS['____1868545639'][4](___1795191430(14), $_38065367->getContextKey()));
			}
				 elseif($_1560487991 instanceof CheckResult &&!$_1560487991->isSuccess()){
					 if($_1560487991->getAction() === RuleAction::UNSET){
					 static::unsetContextValue( $_38065367->getContextName(), $_1881155965, $_38065367->getContextKey(),);
					 $this->logEvent( ___1795191430(15), $_38065367->getContextName(), $GLOBALS['____1868545639'][5](___1795191430(16), $_38065367->getContextKey()));
				}
					 elseif($_1560487991->getAction() === RuleAction::EXIT){
					 $this->logEvent( ___1795191430(17), $_38065367->getContextName(), $GLOBALS['____1868545639'][6](___1795191430(18), $_38065367->getContextKey()));
					 exit;
				}
			}
		}
	}
		 public function disableEventLogging(){
		 $this->_2089441961= false;
	}
		 protected function rewriteContextKey($_1519286936, &$_1881155965, $_1964801418, $_1424040041){
		 $_1509488225= $_1964801418;
		  $GLOBALS['____1868545639'][7]($_1509488225);
		 $_1509488225[]= $_1424040041;
			 if($_1519286936 === ___1795191430(19)){
			 $_845407758= $GLOBALS['____1868545639'][8]($_1964801418);
			 $GLOBALS['____1868545639'][9]($_1509488225);
				 if(empty($_1964801418)){
				 $GLOBALS[$_1424040041]= $GLOBALS[$_845407758];
				 unset($GLOBALS[$_845407758]);
			}
				 else{
				 $_1881155965=& $GLOBALS[$_845407758];
				 $_905364533= ArrayHelper::getByNestedKey($_1881155965, $_1964801418);
				  ArrayHelper::setByNestedKey($_1881155965, $_1509488225, $_905364533);
				  ArrayHelper::unsetByNestedKey($_1881155965, $_1964801418);
			}
		}
			 else{
			 $_905364533= ArrayHelper::getByNestedKey($_1881155965, $_1964801418);
			  ArrayHelper::setByNestedKey($_1881155965, $_1509488225, $_905364533);
			  ArrayHelper::unsetByNestedKey($_1881155965, $_1964801418);
		}
	}
		 protected function rewriteContextValue($_1519286936, &$_1881155965, $_791132341, $_905364533){
			 if($_1519286936 === 'global'){
			 $_845407758= $GLOBALS['____1868545639'][10]($_791132341);
				 if(empty($_791132341)){
				 $GLOBALS[$_845407758]= $_905364533;
			}
				 else{
				 $_1881155965=& $GLOBALS[$_845407758];
				 ArrayHelper::setByNestedKey($_1881155965, $_791132341, $_905364533);
			}
		}
			 else{
			  ArrayHelper::setByNestedKey($_1881155965, $_791132341, $_905364533);
		}
	}
		 protected function unsetContextValue($_1519286936, &$_1881155965, $_791132341){
			 if($_1519286936 === 'global'){
			 $_845407758= $GLOBALS['____1868545639'][11]($_791132341);
				 if(empty($_791132341)){
				 unset($GLOBALS[$_845407758]);
			}
				 else{
				 $_1881155965=& $GLOBALS[$_845407758];
				 ArrayHelper::unsetByNestedKey($_1881155965, $_791132341);
			}
		}
			 else{
			 ArrayHelper::unsetByNestedKey($_1881155965, $_791132341);
		}
	}
		  protected function recursiveContextKeyHandle(string $_1519286936, array &$_1881155965, array $_355261997, Rule $_1164902948): array{
		  $_1634303564=[];
			 foreach($_1881155965 as $_142012392 => $_905364533){
			 $_791132341= $GLOBALS['____1868545639'][12]($_355261997,[$_142012392]);
				 if($_1164902948->matchKey($_791132341)){
					  if($_1164902948->getProcess() === ___1795191430(20)){
					 $_1560487991= $_1164902948->echo $_142012392;
				}
					 elseif($_1164902948->getProcess() === ___1795191430(21)){
					 $_1560487991= $_1164902948->echo $_905364533;
				}
					  if(!empty($_1560487991) && $_1560487991 instanceof RuleResult){
					 $_1634303564[]= new HandlingResult($_1519286936, $_791132341, $_1560487991, $_1164902948);
				}
			}
				  if($GLOBALS['____1868545639'][13]($_905364533)){
				 $_1634303564= $GLOBALS['____1868545639'][14]($_1634303564, $this->recursiveContextKeyHandle( $_1519286936, $_1881155965[$_142012392], $_791132341, $_1164902948));
			}
		}
		 return $_1634303564;
	}
		 protected function getContextElements(array $_1988337324){
		 $_2079501568=[];
			 if($GLOBALS['____1868545639'][15](___1795191430(22), $_1988337324, true)){
			 $_2079501568[___1795191430(23)]= &$_GET;
		}
			 if($GLOBALS['____1868545639'][16](___1795191430(24), $_1988337324, true)){
			 $_2079501568[___1795191430(25)]= &$_POST;
		}
			 if($GLOBALS['____1868545639'][17](___1795191430(26), $_1988337324, true)){
			 $_2079501568[___1795191430(27)]= &$_COOKIE;
		}
			 if($GLOBALS['____1868545639'][18](___1795191430(28), $_1988337324, true)){
			 $_2079501568[___1795191430(29)]= &$_REQUEST;
		}
			 if($GLOBALS['____1868545639'][19](___1795191430(30), $_1988337324, true)){
			 $_2079501568[___1795191430(31)]= $GLOBALS;
		}
		 return $_2079501568;
	}
		 public static function refreshRules(){
			 try{
			 $_1268296701= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
				 if(($GLOBALS['____1868545639'][20]()- $_1268296701)< static::CACHE_RULES_TTL){
				 return;
			}
			 Option::set(___1795191430(32), ___1795191430(33), $GLOBALS['____1868545639'][21]());
			 $_1767386910= null;
				  $_1880281881= $GLOBALS['____1868545639'][22](function($_353175819){
				 return[___1795191430(34) => $_353175819[___1795191430(35)], ___1795191430(36) => (int) $_353175819[___1795191430(37)]];
			}
			, ModuleManager::getModulesFromDisk());
			  $_263075959=[];
				 foreach($GLOBALS['____1868545639'][23]() as $_1396122968){
				 $_429584643= new ReflectionExtension($_1396122968);
				 $_263075959[$_1396122968]=[ ___1795191430(38) => $_429584643->getVersion(), ___1795191430(39) => $_429584643->getINIEntries()];
			}
			 $_1318827323=[ ___1795191430(40) => $GLOBALS['____1868545639'][24]($_1880281881), ___1795191430(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___1795191430(42) => $GLOBALS['____1868545639'][25]([ ___1795191430(43) => $GLOBALS['____1868545639'][26](), ___1795191430(44) => $_263075959])];
				 if(Loader::includeModule(___1795191430(45))){
				 $_1117161913= CSecuritySystemInformation::getSystemInformation();
					 if(isset($_1117161913[___1795191430(46)][___1795191430(47)]) && isset($_1117161913[___1795191430(48)][___1795191430(49)])){
					 $_1318827323[___1795191430(50)]=[ ___1795191430(51) => $_1117161913[___1795191430(52)][___1795191430(53)], ___1795191430(54) => $_1117161913[___1795191430(55)][___1795191430(56)]];
				}
					 if(isset($_1117161913[___1795191430(57)][___1795191430(58)])){
					 $_1318827323[___1795191430(59)]=[___1795191430(60) => $_1117161913[___1795191430(61)][___1795191430(62)]];
				}
			}
			  $_1370135084= new HttpClient([ ___1795191430(63) => round(0+1+1+1+1+1), ___1795191430(64) => round(0+5)]);
			 $_1640634300=(new UrlProvider())->getTechDomain();
				 $_559917633="https://wwall.{
				$_1640634300
			}
			/rules.php";
			 $_1273798877= $_1370135084->post($_559917633, $_1318827323);
				 if($_1370135084->getStatus() == round(0+100+100) &&!empty($_1273798877)){
				 $_1767386910= Json::decode($_1273798877);
			}
				  if($_1767386910 !== null){
				 $_1470339538= Application::getConnection();
				 $_724236327= RuleRecordTable::getTableName();
					 if(!empty($_1767386910)){
						 foreach($_1767386910 as $_2091050602){
							 if(!static::checkRuleSign($_2091050602)){
							 throw new SystemException('Invalid sign for rule '.$GLOBALS['____1868545639'][27]($_2091050602));
						}
					}
				}
				  $_1470339538->truncateTable($_724236327);
					  if(!empty($_1767386910)){
					 $_2095367311=[];
						 foreach($_1767386910 as $_2091050602){
						 $_2095367311[]= ___1795191430(65). $_1470339538->getSqlHelper()->forSql($_2091050602[___1795191430(66)]). ___1795191430(67). $_1470339538->getSqlHelper()->forSql($_2091050602[___1795191430(68)]). ___1795191430(69). $_1470339538->getSqlHelper()->forSql($_2091050602[___1795191430(70)]). ___1795191430(71);
					}
					 $_1928272420= $GLOBALS['____1868545639'][28](___1795191430(72), $_2095367311);
						  $_1470339538->query("INSERT INTO {
						$_724236327
					}
						 (DATA, MODULE, MODULE_VERSION) VALUES {
						$_1928272420
					}
					");
					  RuleRecordTable::cleanCache();
				}
			}
		}
			 catch(\Throwable $_101103004){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___1795191430(73), ___1795191430(74), ___1795191430(75), ___1795191430(76). $_101103004->getMessage(). ___1795191430(77). $_101103004->getTraceAsString());
		}
	}
		 protected static function checkRuleSign($_1164902948){
		 $_740175521= new PublicKeyCipher;
		 $_1986788859= $_740175521->decrypt($_1164902948[___1795191430(78)], static::__1403820135());
		 return str_starts_with($_1986788859, ___1795191430(79));
	}
		 private static function __1403820135(){
		 $_784161361= '';
		 $_784161361 .= ___1795191430(80);
		 $_784161361 .= ___1795191430(81);
		 return $_784161361;
	}
		 protected function logEvent($_2059791618, $_1848217452, $_1203079321){
			 if($this->_2089441961){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_2059791618, 'main', $_1848217452, $_1203079321);
		}
	}
}



© 2023 Quttera Ltd. All rights reserved.