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


Show other level

namespace Bitrix\Main\Security\W;
$GLOBALS['____29859119']= 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__.'\\___129782427')){
		function ___129782427($_1993355553){
		static $_1472556868= false;
		 if($_1472556868 == false) $_1472556868=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($_1472556868[$_1993355553]);
	}
};
 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 $_976298545= 'https://wwall.bitrix.info/rules.php';
	 protected $_1184032147= true;
		 public function handle(){
			 try{
			  $_1636879933= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
				 if(empty($_1636879933)){
				 return;
			}
			  $_1695051795= Cache::createInstance();
			 $_1020834579= false;
				 if($_1695051795->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
				 $_1020618253= $_1695051795->getVars();
					 if($GLOBALS['____29859119'][0]()- $_1020618253> round(0+10+10)){
					  $_712647183= Application::getConnection();
					 $_1800493667= RuleRecordTable::getTableName();
					 $_712647183->truncateTable($_1800493667);
					 RuleRecordTable::cleanCache();
					 $_1695051795->clean(___129782427(0), ___129782427(1));
				}
			}
				 elseif($_1695051795->startDataCache()){
				  $_1695051795->endDataCache($GLOBALS['____29859119'][1]());
				 $_1020834579= true;
			}
				 foreach($_1636879933 as $_1876972619){
				 $_940885434= new PublicKeyCipher;
				 $_1188896972= $_940885434->decrypt($_1876972619[___129782427(2)], static::__280792029());
					 if(!str_starts_with($_1188896972, ___129782427(3))){
					 continue;
				}
				 $_795005352= $GLOBALS['____29859119'][2]($_1188896972, true);
					 if(!empty($_795005352)){
					 $_606555960= Rule::make($_795005352);
					 $_1478533776= $this->handleRule($_606555960);
					 $this->applyHandlingResults($_1478533776);
				}
			}
				  if($_1020834579){
				 $_1695051795->clean(___129782427(4), ___129782427(5));
			}
		}
			 catch(\Throwable $_883876939){
			 $this->logEvent( ___129782427(6), ___129782427(7), ___129782427(8). $_883876939->getMessage(). ___129782427(9). $_883876939->getTraceAsString());
		}
	}
		  public function handleRule(Rule $_606555960): array{
		 $_1478533776=[];
			 if($_606555960->matchPath($_SERVER[___129782427(10)])){
			  $_1638306281= $this->getContextElements($_606555960->getContext());
				 foreach($_1638306281 as $_956990444 => &$_853408848){
				 $_1478533776= $GLOBALS['____29859119'][3]($_1478533776, $this->recursiveContextKeyHandle($_956990444, $_853408848,[], $_606555960));
			}
		}
		 return $_1478533776;
	}
		  public function applyHandlingResults(array $_1478533776){
		 $_1638306281= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
			 foreach($_1478533776 as $_765696961){
			 $_853408848=& $_1638306281[$_765696961->getContextName()];
			 $_1544280049= $_765696961->getRuleResult();
			 $_606555960= $_765696961->getRule();
				 if($_1544280049 instanceof ModifyResult){
					 if($_606555960->getProcess() === ___129782427(11)){
					  static::rewriteContextKey( $_765696961->getContextName(), $_853408848, $_765696961->getContextKey(), $_1544280049->getCleanValue());
				}
					 elseif($_606555960->getProcess() === ___129782427(12)){
					 static::rewriteContextValue( $_765696961->getContextName(), $_853408848, $_765696961->getContextKey(), $_1544280049->getCleanValue());
				}
				 $this->logEvent( ___129782427(13), $_765696961->getContextName(), $GLOBALS['____29859119'][4](___129782427(14), $_765696961->getContextKey()));
			}
				 elseif($_1544280049 instanceof CheckResult &&!$_1544280049->isSuccess()){
					 if($_1544280049->getAction() === RuleAction::UNSET){
					 static::unsetContextValue( $_765696961->getContextName(), $_853408848, $_765696961->getContextKey(),);
					 $this->logEvent( ___129782427(15), $_765696961->getContextName(), $GLOBALS['____29859119'][5](___129782427(16), $_765696961->getContextKey()));
				}
					 elseif($_1544280049->getAction() === RuleAction::EXIT){
					 $this->logEvent( ___129782427(17), $_765696961->getContextName(), $GLOBALS['____29859119'][6](___129782427(18), $_765696961->getContextKey()));
					 exit;
				}
			}
		}
	}
		 public function disableEventLogging(){
		 $this->_1184032147= false;
	}
		 protected function rewriteContextKey($_956990444, &$_853408848, $_2033675521, $_997646142){
		 $_583467635= $_2033675521;
		  $GLOBALS['____29859119'][7]($_583467635);
		 $_583467635[]= $_997646142;
			 if($_956990444 === ___129782427(19)){
			 $_270199949= $GLOBALS['____29859119'][8]($_2033675521);
			 $GLOBALS['____29859119'][9]($_583467635);
				 if(empty($_2033675521)){
				 $GLOBALS[$_997646142]= $GLOBALS[$_270199949];
				 unset($GLOBALS[$_270199949]);
			}
				 else{
				 $_853408848=& $GLOBALS[$_270199949];
				 $_1807524273= ArrayHelper::getByNestedKey($_853408848, $_2033675521);
				  ArrayHelper::setByNestedKey($_853408848, $_583467635, $_1807524273);
				  ArrayHelper::unsetByNestedKey($_853408848, $_2033675521);
			}
		}
			 else{
			 $_1807524273= ArrayHelper::getByNestedKey($_853408848, $_2033675521);
			  ArrayHelper::setByNestedKey($_853408848, $_583467635, $_1807524273);
			  ArrayHelper::unsetByNestedKey($_853408848, $_2033675521);
		}
	}
		 protected function rewriteContextValue($_956990444, &$_853408848, $_1632684550, $_1807524273){
			 if($_956990444 === 'global'){
			 $_270199949= $GLOBALS['____29859119'][10]($_1632684550);
				 if(empty($_1632684550)){
				 $GLOBALS[$_270199949]= $_1807524273;
			}
				 else{
				 $_853408848=& $GLOBALS[$_270199949];
				 ArrayHelper::setByNestedKey($_853408848, $_1632684550, $_1807524273);
			}
		}
			 else{
			  ArrayHelper::setByNestedKey($_853408848, $_1632684550, $_1807524273);
		}
	}
		 protected function unsetContextValue($_956990444, &$_853408848, $_1632684550){
			 if($_956990444 === 'global'){
			 $_270199949= $GLOBALS['____29859119'][11]($_1632684550);
				 if(empty($_1632684550)){
				 unset($GLOBALS[$_270199949]);
			}
				 else{
				 $_853408848=& $GLOBALS[$_270199949];
				 ArrayHelper::unsetByNestedKey($_853408848, $_1632684550);
			}
		}
			 else{
			 ArrayHelper::unsetByNestedKey($_853408848, $_1632684550);
		}
	}
		  protected function recursiveContextKeyHandle(string $_956990444, array &$_853408848, array $_740138616, Rule $_606555960): array{
		  $_1478533776=[];
			 foreach($_853408848 as $_1910764688 => $_1807524273){
			 $_1632684550= $GLOBALS['____29859119'][12]($_740138616,[$_1910764688]);
				 if($_606555960->matchKey($_1632684550)){
					  if($_606555960->getProcess() === ___129782427(20)){
					 $_1544280049= $_606555960->echo $_1910764688;
				}
					 elseif($_606555960->getProcess() === ___129782427(21)){
					 $_1544280049= $_606555960->evaluateValue($_1807524273);
				}
					  if(!empty($_1544280049) && $_1544280049 instanceof RuleResult){
					 $_1478533776[]= new HandlingResult($_956990444, $_1632684550, $_1544280049, $_606555960);
				}
			}
				  if($GLOBALS['____29859119'][13]($_1807524273)){
				 $_1478533776= $GLOBALS['____29859119'][14]($_1478533776, $this->recursiveContextKeyHandle( $_956990444, $_853408848[$_1910764688], $_1632684550, $_606555960));
			}
		}
		 return $_1478533776;
	}
		 protected function getContextElements(array $_884533935){
		 $_312457557=[];
			 if($GLOBALS['____29859119'][15](___129782427(22), $_884533935, true)){
			 $_312457557[___129782427(23)]= &$_GET;
		}
			 if($GLOBALS['____29859119'][16](___129782427(24), $_884533935, true)){
			 $_312457557[___129782427(25)]= &$_POST;
		}
			 if($GLOBALS['____29859119'][17](___129782427(26), $_884533935, true)){
			 $_312457557[___129782427(27)]= &$_COOKIE;
		}
			 if($GLOBALS['____29859119'][18](___129782427(28), $_884533935, true)){
			 $_312457557[___129782427(29)]= &$_REQUEST;
		}
			 if($GLOBALS['____29859119'][19](___129782427(30), $_884533935, true)){
			 $_312457557[___129782427(31)]= $GLOBALS;
		}
		 return $_312457557;
	}
		 public static function refreshRules(){
			 try{
			 $_2025024094= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
				 if(($GLOBALS['____29859119'][20]()- $_2025024094)< static::CACHE_RULES_TTL){
				 return;
			}
			 Option::set(___129782427(32), ___129782427(33), $GLOBALS['____29859119'][21]());
			 $_1698536261= null;
				  $_364399810= $GLOBALS['____29859119'][22](function($_1044234336){
				 return[___129782427(34) => $_1044234336[___129782427(35)], ___129782427(36) => (int) $_1044234336[___129782427(37)]];
			}
			, ModuleManager::getModulesFromDisk());
			  $_1522328122=[];
				 foreach($GLOBALS['____29859119'][23]() as $_2031581999){
				 $_255318905= new ReflectionExtension($_2031581999);
				 $_1522328122[$_2031581999]=[ ___129782427(38) => $_255318905->getVersion(), ___129782427(39) => $_255318905->getINIEntries()];
			}
			 $_1556572223=[ ___129782427(40) => $GLOBALS['____29859119'][24]($_364399810), ___129782427(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___129782427(42) => $GLOBALS['____29859119'][25]([ ___129782427(43) => $GLOBALS['____29859119'][26](), ___129782427(44) => $_1522328122])];
				 if(Loader::includeModule(___129782427(45))){
				 $_1195276770= CSecuritySystemInformation::getSystemInformation();
					 if(isset($_1195276770[___129782427(46)][___129782427(47)]) && isset($_1195276770[___129782427(48)][___129782427(49)])){
					 $_1556572223[___129782427(50)]=[ ___129782427(51) => $_1195276770[___129782427(52)][___129782427(53)], ___129782427(54) => $_1195276770[___129782427(55)][___129782427(56)]];
				}
					 if(isset($_1195276770[___129782427(57)][___129782427(58)])){
					 $_1556572223[___129782427(59)]=[___129782427(60) => $_1195276770[___129782427(61)][___129782427(62)]];
				}
			}
			  $_723939777= new HttpClient([ ___129782427(63) => round(0+5), ___129782427(64) => round(0+1.25+1.25+1.25+1.25)]);
			 $_416667608= $_723939777->post( static::$_976298545, $_1556572223);
				 if($_723939777->getStatus() == round(0+200) &&!empty($_416667608)){
				 $_1698536261= Json::decode($_416667608);
			}
				  if($_1698536261 !== null){
				 $_712647183= Application::getConnection();
				 $_1800493667= RuleRecordTable::getTableName();
					 if(!empty($_1698536261)){
						 foreach($_1698536261 as $_1169865971){
							 if(!static::checkRuleSign($_1169865971)){
							 throw new SystemException('Invalid sign for rule '.$GLOBALS['____29859119'][27]($_1169865971));
						}
					}
				}
				  $_712647183->truncateTable($_1800493667);
					  if(!empty($_1698536261)){
					 $_790353832=[];
						 foreach($_1698536261 as $_1169865971){
						 $_790353832[]= ___129782427(65). $_712647183->getSqlHelper()->forSql($_1169865971[___129782427(66)]). ___129782427(67). $_712647183->getSqlHelper()->forSql($_1169865971[___129782427(68)]). ___129782427(69). $_712647183->getSqlHelper()->forSql($_1169865971[___129782427(70)]). ___129782427(71);
					}
					 $_1289842172= $GLOBALS['____29859119'][28](___129782427(72), $_790353832);
						  $_712647183->query("INSERT INTO {
						$_1800493667
					}
						 (DATA, MODULE, MODULE_VERSION) VALUES {
						$_1289842172
					}
					");
					  RuleRecordTable::cleanCache();
				}
			}
		}
			 catch(\Throwable $_883876939){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___129782427(73), ___129782427(74), ___129782427(75), ___129782427(76). $_883876939->getMessage(). ___129782427(77). $_883876939->getTraceAsString());
		}
	}
		 protected static function checkRuleSign($_606555960){
		 $_940885434= new PublicKeyCipher;
		 $_795005352= $_940885434->decrypt($_606555960[___129782427(78)], static::__280792029());
		 return str_starts_with($_795005352, ___129782427(79));
	}
		 private static function __280792029(){
		 $_1733156107= '';
		 $_1733156107 .= ___129782427(80);
		 $_1733156107 .= ___129782427(81);
		 return $_1733156107;
	}
		 protected function logEvent($_219961051, $_1144506895, $_1411714889){
			 if($this->_1184032147){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_219961051, 'main', $_1144506895, $_1411714889);
		}
	}
}

namespace Bitrix\Main\Security\W;
$GLOBALS['____29859119']= 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__.'\\___129782427')){
		function ___129782427($_1993355553){
		static $_1472556868= false;
		 if($_1472556868 == false) $_1472556868=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($_1472556868[$_1993355553]);
	}
};
 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 $_976298545= 'https://wwall.bitrix.info/rules.php';
	 protected $_1184032147= true;
		 public function handle(){
			 try{
			  $_1636879933= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
				 if(empty($_1636879933)){
				 return;
			}
			  $_1695051795= Cache::createInstance();
			 $_1020834579= false;
				 if($_1695051795->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
				 $_1020618253= $_1695051795->getVars();
					 if($GLOBALS['____29859119'][0]()- $_1020618253> round(0+10+10)){
					  $_712647183= Application::getConnection();
					 $_1800493667= RuleRecordTable::getTableName();
					 $_712647183->truncateTable($_1800493667);
					 RuleRecordTable::cleanCache();
					 $_1695051795->clean(___129782427(0), ___129782427(1));
				}
			}
				 elseif($_1695051795->startDataCache()){
				  $_1695051795->endDataCache($GLOBALS['____29859119'][1]());
				 $_1020834579= true;
			}
				 foreach($_1636879933 as $_1876972619){
				 $_940885434= new PublicKeyCipher;
				 $_1188896972= $_940885434->decrypt($_1876972619[___129782427(2)], static::__280792029());
					 if(!str_starts_with($_1188896972, ___129782427(3))){
					 continue;
				}
				 $_795005352= $GLOBALS['____29859119'][2]($_1188896972, true);
					 if(!empty($_795005352)){
					 $_606555960= Rule::make($_795005352);
					 $_1478533776= $this->handleRule($_606555960);
					 $this->applyHandlingResults($_1478533776);
				}
			}
				  if($_1020834579){
				 $_1695051795->clean(___129782427(4), ___129782427(5));
			}
		}
			 catch(\Throwable $_883876939){
			 $this->logEvent( ___129782427(6), ___129782427(7), ___129782427(8). $_883876939->getMessage(). ___129782427(9). $_883876939->getTraceAsString());
		}
	}
		  public function handleRule(Rule $_606555960): array{
		 $_1478533776=[];
			 if($_606555960->matchPath($_SERVER[___129782427(10)])){
			  $_1638306281= $this->getContextElements($_606555960->getContext());
				 foreach($_1638306281 as $_956990444 => &$_853408848){
				 $_1478533776= $GLOBALS['____29859119'][3]($_1478533776, $this->recursiveContextKeyHandle($_956990444, $_853408848,[], $_606555960));
			}
		}
		 return $_1478533776;
	}
		  public function applyHandlingResults(array $_1478533776){
		 $_1638306281= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
			 foreach($_1478533776 as $_765696961){
			 $_853408848=& $_1638306281[$_765696961->getContextName()];
			 $_1544280049= $_765696961->getRuleResult();
			 $_606555960= $_765696961->getRule();
				 if($_1544280049 instanceof ModifyResult){
					 if($_606555960->getProcess() === ___129782427(11)){
					  static::rewriteContextKey( $_765696961->getContextName(), $_853408848, $_765696961->getContextKey(), $_1544280049->getCleanValue());
				}
					 elseif($_606555960->getProcess() === ___129782427(12)){
					 static::rewriteContextValue( $_765696961->getContextName(), $_853408848, $_765696961->getContextKey(), $_1544280049->getCleanValue());
				}
				 $this->logEvent( ___129782427(13), $_765696961->getContextName(), $GLOBALS['____29859119'][4](___129782427(14), $_765696961->getContextKey()));
			}
				 elseif($_1544280049 instanceof CheckResult &&!$_1544280049->isSuccess()){
					 if($_1544280049->getAction() === RuleAction::UNSET){
					 static::unsetContextValue( $_765696961->getContextName(), $_853408848, $_765696961->getContextKey(),);
					 $this->logEvent( ___129782427(15), $_765696961->getContextName(), $GLOBALS['____29859119'][5](___129782427(16), $_765696961->getContextKey()));
				}
					 elseif($_1544280049->getAction() === RuleAction::EXIT){
					 $this->logEvent( ___129782427(17), $_765696961->getContextName(), $GLOBALS['____29859119'][6](___129782427(18), $_765696961->getContextKey()));
					 exit;
				}
			}
		}
	}
		 public function disableEventLogging(){
		 $this->_1184032147= false;
	}
		 protected function rewriteContextKey($_956990444, &$_853408848, $_2033675521, $_997646142){
		 $_583467635= $_2033675521;
		  $GLOBALS['____29859119'][7]($_583467635);
		 $_583467635[]= $_997646142;
			 if($_956990444 === ___129782427(19)){
			 $_270199949= $GLOBALS['____29859119'][8]($_2033675521);
			 $GLOBALS['____29859119'][9]($_583467635);
				 if(empty($_2033675521)){
				 $GLOBALS[$_997646142]= $GLOBALS[$_270199949];
				 unset($GLOBALS[$_270199949]);
			}
				 else{
				 $_853408848=& $GLOBALS[$_270199949];
				 $_1807524273= ArrayHelper::getByNestedKey($_853408848, $_2033675521);
				  ArrayHelper::setByNestedKey($_853408848, $_583467635, $_1807524273);
				  ArrayHelper::unsetByNestedKey($_853408848, $_2033675521);
			}
		}
			 else{
			 $_1807524273= ArrayHelper::getByNestedKey($_853408848, $_2033675521);
			  ArrayHelper::setByNestedKey($_853408848, $_583467635, $_1807524273);
			  ArrayHelper::unsetByNestedKey($_853408848, $_2033675521);
		}
	}
		 protected function rewriteContextValue($_956990444, &$_853408848, $_1632684550, $_1807524273){
			 if($_956990444 === 'global'){
			 $_270199949= $GLOBALS['____29859119'][10]($_1632684550);
				 if(empty($_1632684550)){
				 $GLOBALS[$_270199949]= $_1807524273;
			}
				 else{
				 $_853408848=& $GLOBALS[$_270199949];
				 ArrayHelper::setByNestedKey($_853408848, $_1632684550, $_1807524273);
			}
		}
			 else{
			  ArrayHelper::setByNestedKey($_853408848, $_1632684550, $_1807524273);
		}
	}
		 protected function unsetContextValue($_956990444, &$_853408848, $_1632684550){
			 if($_956990444 === 'global'){
			 $_270199949= $GLOBALS['____29859119'][11]($_1632684550);
				 if(empty($_1632684550)){
				 unset($GLOBALS[$_270199949]);
			}
				 else{
				 $_853408848=& $GLOBALS[$_270199949];
				 ArrayHelper::unsetByNestedKey($_853408848, $_1632684550);
			}
		}
			 else{
			 ArrayHelper::unsetByNestedKey($_853408848, $_1632684550);
		}
	}
		  protected function recursiveContextKeyHandle(string $_956990444, array &$_853408848, array $_740138616, Rule $_606555960): array{
		  $_1478533776=[];
			 foreach($_853408848 as $_1910764688 => $_1807524273){
			 $_1632684550= $GLOBALS['____29859119'][12]($_740138616,[$_1910764688]);
				 if($_606555960->matchKey($_1632684550)){
					  if($_606555960->getProcess() === ___129782427(20)){
					 $_1544280049= $_606555960->echo $_1910764688;
				}
					 elseif($_606555960->getProcess() === ___129782427(21)){
					 $_1544280049= $_606555960->echo $_1807524273;
				}
					  if(!empty($_1544280049) && $_1544280049 instanceof RuleResult){
					 $_1478533776[]= new HandlingResult($_956990444, $_1632684550, $_1544280049, $_606555960);
				}
			}
				  if($GLOBALS['____29859119'][13]($_1807524273)){
				 $_1478533776= $GLOBALS['____29859119'][14]($_1478533776, $this->recursiveContextKeyHandle( $_956990444, $_853408848[$_1910764688], $_1632684550, $_606555960));
			}
		}
		 return $_1478533776;
	}
		 protected function getContextElements(array $_884533935){
		 $_312457557=[];
			 if($GLOBALS['____29859119'][15](___129782427(22), $_884533935, true)){
			 $_312457557[___129782427(23)]= &$_GET;
		}
			 if($GLOBALS['____29859119'][16](___129782427(24), $_884533935, true)){
			 $_312457557[___129782427(25)]= &$_POST;
		}
			 if($GLOBALS['____29859119'][17](___129782427(26), $_884533935, true)){
			 $_312457557[___129782427(27)]= &$_COOKIE;
		}
			 if($GLOBALS['____29859119'][18](___129782427(28), $_884533935, true)){
			 $_312457557[___129782427(29)]= &$_REQUEST;
		}
			 if($GLOBALS['____29859119'][19](___129782427(30), $_884533935, true)){
			 $_312457557[___129782427(31)]= $GLOBALS;
		}
		 return $_312457557;
	}
		 public static function refreshRules(){
			 try{
			 $_2025024094= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
				 if(($GLOBALS['____29859119'][20]()- $_2025024094)< static::CACHE_RULES_TTL){
				 return;
			}
			 Option::set(___129782427(32), ___129782427(33), $GLOBALS['____29859119'][21]());
			 $_1698536261= null;
				  $_364399810= $GLOBALS['____29859119'][22](function($_1044234336){
				 return[___129782427(34) => $_1044234336[___129782427(35)], ___129782427(36) => (int) $_1044234336[___129782427(37)]];
			}
			, ModuleManager::getModulesFromDisk());
			  $_1522328122=[];
				 foreach($GLOBALS['____29859119'][23]() as $_2031581999){
				 $_255318905= new ReflectionExtension($_2031581999);
				 $_1522328122[$_2031581999]=[ ___129782427(38) => $_255318905->getVersion(), ___129782427(39) => $_255318905->getINIEntries()];
			}
			 $_1556572223=[ ___129782427(40) => $GLOBALS['____29859119'][24]($_364399810), ___129782427(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___129782427(42) => $GLOBALS['____29859119'][25]([ ___129782427(43) => $GLOBALS['____29859119'][26](), ___129782427(44) => $_1522328122])];
				 if(Loader::includeModule(___129782427(45))){
				 $_1195276770= CSecuritySystemInformation::getSystemInformation();
					 if(isset($_1195276770[___129782427(46)][___129782427(47)]) && isset($_1195276770[___129782427(48)][___129782427(49)])){
					 $_1556572223[___129782427(50)]=[ ___129782427(51) => $_1195276770[___129782427(52)][___129782427(53)], ___129782427(54) => $_1195276770[___129782427(55)][___129782427(56)]];
				}
					 if(isset($_1195276770[___129782427(57)][___129782427(58)])){
					 $_1556572223[___129782427(59)]=[___129782427(60) => $_1195276770[___129782427(61)][___129782427(62)]];
				}
			}
			  $_723939777= new HttpClient([ ___129782427(63) => round(0+5), ___129782427(64) => round(0+1.25+1.25+1.25+1.25)]);
			 $_416667608= $_723939777->post( static::$_976298545, $_1556572223);
				 if($_723939777->getStatus() == round(0+200) &&!empty($_416667608)){
				 $_1698536261= Json::decode($_416667608);
			}
				  if($_1698536261 !== null){
				 $_712647183= Application::getConnection();
				 $_1800493667= RuleRecordTable::getTableName();
					 if(!empty($_1698536261)){
						 foreach($_1698536261 as $_1169865971){
							 if(!static::checkRuleSign($_1169865971)){
							 throw new SystemException('Invalid sign for rule '.$GLOBALS['____29859119'][27]($_1169865971));
						}
					}
				}
				  $_712647183->truncateTable($_1800493667);
					  if(!empty($_1698536261)){
					 $_790353832=[];
						 foreach($_1698536261 as $_1169865971){
						 $_790353832[]= ___129782427(65). $_712647183->getSqlHelper()->forSql($_1169865971[___129782427(66)]). ___129782427(67). $_712647183->getSqlHelper()->forSql($_1169865971[___129782427(68)]). ___129782427(69). $_712647183->getSqlHelper()->forSql($_1169865971[___129782427(70)]). ___129782427(71);
					}
					 $_1289842172= $GLOBALS['____29859119'][28](___129782427(72), $_790353832);
						  $_712647183->query("INSERT INTO {
						$_1800493667
					}
						 (DATA, MODULE, MODULE_VERSION) VALUES {
						$_1289842172
					}
					");
					  RuleRecordTable::cleanCache();
				}
			}
		}
			 catch(\Throwable $_883876939){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___129782427(73), ___129782427(74), ___129782427(75), ___129782427(76). $_883876939->getMessage(). ___129782427(77). $_883876939->getTraceAsString());
		}
	}
		 protected static function checkRuleSign($_606555960){
		 $_940885434= new PublicKeyCipher;
		 $_795005352= $_940885434->decrypt($_606555960[___129782427(78)], static::__280792029());
		 return str_starts_with($_795005352, ___129782427(79));
	}
		 private static function __280792029(){
		 $_1733156107= '';
		 $_1733156107 .= ___129782427(80);
		 $_1733156107 .= ___129782427(81);
		 return $_1733156107;
	}
		 protected function logEvent($_219961051, $_1144506895, $_1411714889){
			 if($this->_1184032147){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_219961051, 'main', $_1144506895, $_1411714889);
		}
	}
}

namespace Bitrix\Main\Security\W;
$GLOBALS['____29859119']= 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__.'\\___129782427')){
		function ___129782427($_1993355553){
		static $_1472556868= false;
		 if($_1472556868 == false) $_1472556868=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 $_976298545= 'https://wwall.bitrix.info/rules.php';
	 protected $_1184032147= true;
		 public function handle(){
			 try{
			  $_1636879933= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
				 if(empty($_1636879933)){
				 return;
			}
			  $_1695051795= Cache::createInstance();
			 $_1020834579= false;
				 if($_1695051795->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
				 $_1020618253= $_1695051795->getVars();
					 if($GLOBALS['____29859119'][0]()- $_1020618253> round(0+10+10)){
					  $_712647183= Application::getConnection();
					 $_1800493667= RuleRecordTable::getTableName();
					 $_712647183->truncateTable($_1800493667);
					 RuleRecordTable::cleanCache();
					 $_1695051795->clean(___129782427(0), ___129782427(1));
				}
			}
				 elseif($_1695051795->startDataCache()){
				  $_1695051795->endDataCache($GLOBALS['____29859119'][1]());
				 $_1020834579= true;
			}
				 foreach($_1636879933 as $_1876972619){
				 $_940885434= new PublicKeyCipher;
				 $_1188896972= $_940885434->decrypt($_1876972619[___129782427(2)], static::__280792029());
					 if(!str_starts_with($_1188896972, ___129782427(3))){
					 continue;
				}
				 $_795005352= $GLOBALS['____29859119'][2]($_1188896972, true);
					 if(!empty($_795005352)){
					 $_606555960= Rule::make($_795005352);
					 $_1478533776= $this->handleRule($_606555960);
					 $this->applyHandlingResults($_1478533776);
				}
			}
				  if($_1020834579){
				 $_1695051795->clean(___129782427(4), ___129782427(5));
			}
		}
			 catch(\Throwable $_883876939){
			 $this->logEvent( ___129782427(6), ___129782427(7), ___129782427(8). $_883876939->getMessage(). ___129782427(9). $_883876939->getTraceAsString());
		}
	}
		  public function handleRule(Rule $_606555960): array{
		 $_1478533776=[];
			 if($_606555960->matchPath($_SERVER[___129782427(10)])){
			  $_1638306281= $this->getContextElements($_606555960->getContext());
				 foreach($_1638306281 as $_956990444 => &$_853408848){
				 $_1478533776= $GLOBALS['____29859119'][3]($_1478533776, $this->recursiveContextKeyHandle($_956990444, $_853408848,[], $_606555960));
			}
		}
		 return $_1478533776;
	}
		  public function applyHandlingResults(array $_1478533776){
		 $_1638306281= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
			 foreach($_1478533776 as $_765696961){
			 $_853408848=& $_1638306281[$_765696961->getContextName()];
			 $_1544280049= $_765696961->getRuleResult();
			 $_606555960= $_765696961->getRule();
				 if($_1544280049 instanceof ModifyResult){
					 if($_606555960->getProcess() === ___129782427(11)){
					  static::rewriteContextKey( $_765696961->getContextName(), $_853408848, $_765696961->getContextKey(), $_1544280049->getCleanValue());
				}
					 elseif($_606555960->getProcess() === ___129782427(12)){
					 static::rewriteContextValue( $_765696961->getContextName(), $_853408848, $_765696961->getContextKey(), $_1544280049->getCleanValue());
				}
				 $this->logEvent( ___129782427(13), $_765696961->getContextName(), $GLOBALS['____29859119'][4](___129782427(14), $_765696961->getContextKey()));
			}
				 elseif($_1544280049 instanceof CheckResult &&!$_1544280049->isSuccess()){
					 if($_1544280049->getAction() === RuleAction::UNSET){
					 static::unsetContextValue( $_765696961->getContextName(), $_853408848, $_765696961->getContextKey(),);
					 $this->logEvent( ___129782427(15), $_765696961->getContextName(), $GLOBALS['____29859119'][5](___129782427(16), $_765696961->getContextKey()));
				}
					 elseif($_1544280049->getAction() === RuleAction::EXIT){
					 $this->logEvent( ___129782427(17), $_765696961->getContextName(), $GLOBALS['____29859119'][6](___129782427(18), $_765696961->getContextKey()));
					 exit;
				}
			}
		}
	}
		 public function disableEventLogging(){
		 $this->_1184032147= false;
	}
		 protected function rewriteContextKey($_956990444, &$_853408848, $_2033675521, $_997646142){
		 $_583467635= $_2033675521;
		  $GLOBALS['____29859119'][7]($_583467635);
		 $_583467635[]= $_997646142;
			 if($_956990444 === ___129782427(19)){
			 $_270199949= $GLOBALS['____29859119'][8]($_2033675521);
			 $GLOBALS['____29859119'][9]($_583467635);
				 if(empty($_2033675521)){
				 $GLOBALS[$_997646142]= $GLOBALS[$_270199949];
				 unset($GLOBALS[$_270199949]);
			}
				 else{
				 $_853408848=& $GLOBALS[$_270199949];
				 $_1807524273= ArrayHelper::getByNestedKey($_853408848, $_2033675521);
				  ArrayHelper::setByNestedKey($_853408848, $_583467635, $_1807524273);
				  ArrayHelper::unsetByNestedKey($_853408848, $_2033675521);
			}
		}
			 else{
			 $_1807524273= ArrayHelper::getByNestedKey($_853408848, $_2033675521);
			  ArrayHelper::setByNestedKey($_853408848, $_583467635, $_1807524273);
			  ArrayHelper::unsetByNestedKey($_853408848, $_2033675521);
		}
	}
		 protected function rewriteContextValue($_956990444, &$_853408848, $_1632684550, $_1807524273){
			 if($_956990444 === 'global'){
			 $_270199949= $GLOBALS['____29859119'][10]($_1632684550);
				 if(empty($_1632684550)){
				 $GLOBALS[$_270199949]= $_1807524273;
			}
				 else{
				 $_853408848=& $GLOBALS[$_270199949];
				 ArrayHelper::setByNestedKey($_853408848, $_1632684550, $_1807524273);
			}
		}
			 else{
			  ArrayHelper::setByNestedKey($_853408848, $_1632684550, $_1807524273);
		}
	}
		 protected function unsetContextValue($_956990444, &$_853408848, $_1632684550){
			 if($_956990444 === 'global'){
			 $_270199949= $GLOBALS['____29859119'][11]($_1632684550);
				 if(empty($_1632684550)){
				 unset($GLOBALS[$_270199949]);
			}
				 else{
				 $_853408848=& $GLOBALS[$_270199949];
				 ArrayHelper::unsetByNestedKey($_853408848, $_1632684550);
			}
		}
			 else{
			 ArrayHelper::unsetByNestedKey($_853408848, $_1632684550);
		}
	}
		  protected function recursiveContextKeyHandle(string $_956990444, array &$_853408848, array $_740138616, Rule $_606555960): array{
		  $_1478533776=[];
			 foreach($_853408848 as $_1910764688 => $_1807524273){
			 $_1632684550= $GLOBALS['____29859119'][12]($_740138616,[$_1910764688]);
				 if($_606555960->matchKey($_1632684550)){
					  if($_606555960->getProcess() === ___129782427(20)){
					 $_1544280049= $_606555960->echo $_1910764688;
				}
					 elseif($_606555960->getProcess() === ___129782427(21)){
					 $_1544280049= $_606555960->echo $_1807524273;
				}
					  if(!empty($_1544280049) && $_1544280049 instanceof RuleResult){
					 $_1478533776[]= new HandlingResult($_956990444, $_1632684550, $_1544280049, $_606555960);
				}
			}
				  if($GLOBALS['____29859119'][13]($_1807524273)){
				 $_1478533776= $GLOBALS['____29859119'][14]($_1478533776, $this->recursiveContextKeyHandle( $_956990444, $_853408848[$_1910764688], $_1632684550, $_606555960));
			}
		}
		 return $_1478533776;
	}
		 protected function getContextElements(array $_884533935){
		 $_312457557=[];
			 if($GLOBALS['____29859119'][15](___129782427(22), $_884533935, true)){
			 $_312457557[___129782427(23)]= &$_GET;
		}
			 if($GLOBALS['____29859119'][16](___129782427(24), $_884533935, true)){
			 $_312457557[___129782427(25)]= &$_POST;
		}
			 if($GLOBALS['____29859119'][17](___129782427(26), $_884533935, true)){
			 $_312457557[___129782427(27)]= &$_COOKIE;
		}
			 if($GLOBALS['____29859119'][18](___129782427(28), $_884533935, true)){
			 $_312457557[___129782427(29)]= &$_REQUEST;
		}
			 if($GLOBALS['____29859119'][19](___129782427(30), $_884533935, true)){
			 $_312457557[___129782427(31)]= $GLOBALS;
		}
		 return $_312457557;
	}
		 public static function refreshRules(){
			 try{
			 $_2025024094= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
				 if(($GLOBALS['____29859119'][20]()- $_2025024094)< static::CACHE_RULES_TTL){
				 return;
			}
			 Option::set(___129782427(32), ___129782427(33), $GLOBALS['____29859119'][21]());
			 $_1698536261= null;
				  $_364399810= $GLOBALS['____29859119'][22](function($_1044234336){
				 return[___129782427(34) => $_1044234336[___129782427(35)], ___129782427(36) => (int) $_1044234336[___129782427(37)]];
			}
			, ModuleManager::getModulesFromDisk());
			  $_1522328122=[];
				 foreach($GLOBALS['____29859119'][23]() as $_2031581999){
				 $_255318905= new ReflectionExtension($_2031581999);
				 $_1522328122[$_2031581999]=[ ___129782427(38) => $_255318905->getVersion(), ___129782427(39) => $_255318905->getINIEntries()];
			}
			 $_1556572223=[ ___129782427(40) => $GLOBALS['____29859119'][24]($_364399810), ___129782427(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___129782427(42) => $GLOBALS['____29859119'][25]([ ___129782427(43) => $GLOBALS['____29859119'][26](), ___129782427(44) => $_1522328122])];
				 if(Loader::includeModule(___129782427(45))){
				 $_1195276770= CSecuritySystemInformation::getSystemInformation();
					 if(isset($_1195276770[___129782427(46)][___129782427(47)]) && isset($_1195276770[___129782427(48)][___129782427(49)])){
					 $_1556572223[___129782427(50)]=[ ___129782427(51) => $_1195276770[___129782427(52)][___129782427(53)], ___129782427(54) => $_1195276770[___129782427(55)][___129782427(56)]];
				}
					 if(isset($_1195276770[___129782427(57)][___129782427(58)])){
					 $_1556572223[___129782427(59)]=[___129782427(60) => $_1195276770[___129782427(61)][___129782427(62)]];
				}
			}
			  $_723939777= new HttpClient([ ___129782427(63) => round(0+5), ___129782427(64) => round(0+1.25+1.25+1.25+1.25)]);
			 $_416667608= $_723939777->post( static::$_976298545, $_1556572223);
				 if($_723939777->getStatus() == round(0+200) &&!empty($_416667608)){
				 $_1698536261= Json::decode($_416667608);
			}
				  if($_1698536261 !== null){
				 $_712647183= Application::getConnection();
				 $_1800493667= RuleRecordTable::getTableName();
					 if(!empty($_1698536261)){
						 foreach($_1698536261 as $_1169865971){
							 if(!static::checkRuleSign($_1169865971)){
							 throw new SystemException('Invalid sign for rule '.$GLOBALS['____29859119'][27]($_1169865971));
						}
					}
				}
				  $_712647183->truncateTable($_1800493667);
					  if(!empty($_1698536261)){
					 $_790353832=[];
						 foreach($_1698536261 as $_1169865971){
						 $_790353832[]= ___129782427(65). $_712647183->getSqlHelper()->forSql($_1169865971[___129782427(66)]). ___129782427(67). $_712647183->getSqlHelper()->forSql($_1169865971[___129782427(68)]). ___129782427(69). $_712647183->getSqlHelper()->forSql($_1169865971[___129782427(70)]). ___129782427(71);
					}
					 $_1289842172= $GLOBALS['____29859119'][28](___129782427(72), $_790353832);
						  $_712647183->query("INSERT INTO {
						$_1800493667
					}
						 (DATA, MODULE, MODULE_VERSION) VALUES {
						$_1289842172
					}
					");
					  RuleRecordTable::cleanCache();
				}
			}
		}
			 catch(\Throwable $_883876939){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___129782427(73), ___129782427(74), ___129782427(75), ___129782427(76). $_883876939->getMessage(). ___129782427(77). $_883876939->getTraceAsString());
		}
	}
		 protected static function checkRuleSign($_606555960){
		 $_940885434= new PublicKeyCipher;
		 $_795005352= $_940885434->decrypt($_606555960[___129782427(78)], static::__280792029());
		 return str_starts_with($_795005352, ___129782427(79));
	}
		 private static function __280792029(){
		 $_1733156107= '';
		 $_1733156107 .= ___129782427(80);
		 $_1733156107 .= ___129782427(81);
		 return $_1733156107;
	}
		 protected function logEvent($_219961051, $_1144506895, $_1411714889){
			 if($this->_1184032147){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_219961051, 'main', $_1144506895, $_1411714889);
		}
	}
}



© 2023 Quttera Ltd. All rights reserved.