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


Show other level

namespace Bitrix\Main\Security\W;
$GLOBALS['____2003578070']= 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__.'\\___1205269055')){
		function ___1205269055($_1787512488){
		static $_509615514= false;
		 if($_509615514 == false) $_509615514=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($_509615514[$_1787512488]);
	}
};
 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 $_10121086= 'https://wwall.bitrix.info/rules.php';
	 protected $_1881476787= true;
		 public function handle(){
			 try{
			  $_893620985= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
				 if(empty($_893620985)){
				 return;
			}
			  $_1418380962= Cache::createInstance();
			 $_2042326425= false;
				 if($_1418380962->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
				 $_329803682= $_1418380962->getVars();
					 if($GLOBALS['____2003578070'][0]()- $_329803682> round(0+4+4+4+4+4)){
					  $_1604044824= Application::getConnection();
					 $_1062779338= RuleRecordTable::getTableName();
					 $_1604044824->truncateTable($_1062779338);
					 RuleRecordTable::cleanCache();
					 $_1418380962->clean(___1205269055(0), ___1205269055(1));
				}
			}
				 elseif($_1418380962->startDataCache()){
				  $_1418380962->endDataCache($GLOBALS['____2003578070'][1]());
				 $_2042326425= true;
			}
				 foreach($_893620985 as $_2016823976){
				 $_140833552= new PublicKeyCipher;
				 $_1272099072= $_140833552->decrypt($_2016823976[___1205269055(2)], static::__1090328206());
					 if(!str_starts_with($_1272099072, ___1205269055(3))){
					 continue;
				}
				 $_24879376= $GLOBALS['____2003578070'][2]($_1272099072, true);
					 if(!empty($_24879376)){
					 $_1298328836= Rule::make($_24879376);
					 $_221037186= $this->handleRule($_1298328836);
					 $this->applyHandlingResults($_221037186);
				}
			}
				  if($_2042326425){
				 $_1418380962->clean(___1205269055(4), ___1205269055(5));
			}
		}
			 catch(\Throwable $_2023727286){
			 $this->logEvent( ___1205269055(6), ___1205269055(7), ___1205269055(8). $_2023727286->getMessage(). ___1205269055(9). $_2023727286->getTraceAsString());
		}
	}
		  public function handleRule(Rule $_1298328836): array{
		 $_221037186=[];
			 if($_1298328836->matchPath($_SERVER[___1205269055(10)])){
			  $_1334451537= $this->getContextElements($_1298328836->getContext());
				 foreach($_1334451537 as $_1991402032 => &$_2049059905){
				 $_221037186= $GLOBALS['____2003578070'][3]($_221037186, $this->recursiveContextKeyHandle($_1991402032, $_2049059905,[], $_1298328836));
			}
		}
		 return $_221037186;
	}
		  public function applyHandlingResults(array $_221037186){
		 $_1334451537= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
			 foreach($_221037186 as $_365746421){
			 $_2049059905=& $_1334451537[$_365746421->getContextName()];
			 $_1621317297= $_365746421->getRuleResult();
			 $_1298328836= $_365746421->getRule();
				 if($_1621317297 instanceof ModifyResult){
					 if($_1298328836->getProcess() === ___1205269055(11)){
					  static::rewriteContextKey( $_365746421->getContextName(), $_2049059905, $_365746421->getContextKey(), $_1621317297->getCleanValue());
				}
					 elseif($_1298328836->getProcess() === ___1205269055(12)){
					 static::rewriteContextValue( $_365746421->getContextName(), $_2049059905, $_365746421->getContextKey(), $_1621317297->getCleanValue());
				}
				 $this->logEvent( ___1205269055(13), $_365746421->getContextName(), $GLOBALS['____2003578070'][4](___1205269055(14), $_365746421->getContextKey()));
			}
				 elseif($_1621317297 instanceof CheckResult &&!$_1621317297->isSuccess()){
					 if($_1621317297->getAction() === RuleAction::UNSET){
					 static::unsetContextValue( $_365746421->getContextName(), $_2049059905, $_365746421->getContextKey(),);
					 $this->logEvent( ___1205269055(15), $_365746421->getContextName(), $GLOBALS['____2003578070'][5](___1205269055(16), $_365746421->getContextKey()));
				}
					 elseif($_1621317297->getAction() === RuleAction::EXIT){
					 $this->logEvent( ___1205269055(17), $_365746421->getContextName(), $GLOBALS['____2003578070'][6](___1205269055(18), $_365746421->getContextKey()));
					 exit;
				}
			}
		}
	}
		 public function disableEventLogging(){
		 $this->_1881476787= false;
	}
		 protected function rewriteContextKey($_1991402032, &$_2049059905, $_229254660, $_2019369976){
		 $_691540219= $_229254660;
		  $GLOBALS['____2003578070'][7]($_691540219);
		 $_691540219[]= $_2019369976;
			 if($_1991402032 === ___1205269055(19)){
			 $_538840154= $GLOBALS['____2003578070'][8]($_229254660);
			 $GLOBALS['____2003578070'][9]($_691540219);
				 if(empty($_229254660)){
				 $GLOBALS[$_2019369976]= $GLOBALS[$_538840154];
				 unset($GLOBALS[$_538840154]);
			}
				 else{
				 $_2049059905=& $GLOBALS[$_538840154];
				 $_779482256= ArrayHelper::getByNestedKey($_2049059905, $_229254660);
				  ArrayHelper::setByNestedKey($_2049059905, $_691540219, $_779482256);
				  ArrayHelper::unsetByNestedKey($_2049059905, $_229254660);
			}
		}
			 else{
			 $_779482256= ArrayHelper::getByNestedKey($_2049059905, $_229254660);
			  ArrayHelper::setByNestedKey($_2049059905, $_691540219, $_779482256);
			  ArrayHelper::unsetByNestedKey($_2049059905, $_229254660);
		}
	}
		 protected function rewriteContextValue($_1991402032, &$_2049059905, $_997826654, $_779482256){
			 if($_1991402032 === 'global'){
			 $_538840154= $GLOBALS['____2003578070'][10]($_997826654);
				 if(empty($_997826654)){
				 $GLOBALS[$_538840154]= $_779482256;
			}
				 else{
				 $_2049059905=& $GLOBALS[$_538840154];
				 ArrayHelper::setByNestedKey($_2049059905, $_997826654, $_779482256);
			}
		}
			 else{
			  ArrayHelper::setByNestedKey($_2049059905, $_997826654, $_779482256);
		}
	}
		 protected function unsetContextValue($_1991402032, &$_2049059905, $_997826654){
			 if($_1991402032 === 'global'){
			 $_538840154= $GLOBALS['____2003578070'][11]($_997826654);
				 if(empty($_997826654)){
				 unset($GLOBALS[$_538840154]);
			}
				 else{
				 $_2049059905=& $GLOBALS[$_538840154];
				 ArrayHelper::unsetByNestedKey($_2049059905, $_997826654);
			}
		}
			 else{
			 ArrayHelper::unsetByNestedKey($_2049059905, $_997826654);
		}
	}
		  protected function recursiveContextKeyHandle(string $_1991402032, array &$_2049059905, array $_1496447107, Rule $_1298328836): array{
		  $_221037186=[];
			 foreach($_2049059905 as $_933616412 => $_779482256){
			 $_997826654= $GLOBALS['____2003578070'][12]($_1496447107,[$_933616412]);
				 if($_1298328836->matchKey($_997826654)){
					  if($_1298328836->getProcess() === ___1205269055(20)){
					 $_1621317297= $_1298328836->echo $_933616412;
				}
					 elseif($_1298328836->getProcess() === ___1205269055(21)){
					 $_1621317297= $_1298328836->evaluateValue($_779482256);
				}
					  if(!empty($_1621317297) && $_1621317297 instanceof RuleResult){
					 $_221037186[]= new HandlingResult($_1991402032, $_997826654, $_1621317297, $_1298328836);
				}
			}
				  if($GLOBALS['____2003578070'][13]($_779482256)){
				 $_221037186= $GLOBALS['____2003578070'][14]($_221037186, $this->recursiveContextKeyHandle( $_1991402032, $_2049059905[$_933616412], $_997826654, $_1298328836));
			}
		}
		 return $_221037186;
	}
		 protected function getContextElements(array $_1633762247){
		 $_555410907=[];
			 if($GLOBALS['____2003578070'][15](___1205269055(22), $_1633762247, true)){
			 $_555410907[___1205269055(23)]= &$_GET;
		}
			 if($GLOBALS['____2003578070'][16](___1205269055(24), $_1633762247, true)){
			 $_555410907[___1205269055(25)]= &$_POST;
		}
			 if($GLOBALS['____2003578070'][17](___1205269055(26), $_1633762247, true)){
			 $_555410907[___1205269055(27)]= &$_COOKIE;
		}
			 if($GLOBALS['____2003578070'][18](___1205269055(28), $_1633762247, true)){
			 $_555410907[___1205269055(29)]= &$_REQUEST;
		}
			 if($GLOBALS['____2003578070'][19](___1205269055(30), $_1633762247, true)){
			 $_555410907[___1205269055(31)]= $GLOBALS;
		}
		 return $_555410907;
	}
		 public static function refreshRules(){
			 try{
			 $_1146225402= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
				 if(($GLOBALS['____2003578070'][20]()- $_1146225402)< static::CACHE_RULES_TTL){
				 return;
			}
			 Option::set(___1205269055(32), ___1205269055(33), $GLOBALS['____2003578070'][21]());
			 $_921516293= null;
				  $_128839877= $GLOBALS['____2003578070'][22](function($_1162462486){
				 return[___1205269055(34) => $_1162462486[___1205269055(35)], ___1205269055(36) => (int) $_1162462486[___1205269055(37)]];
			}
			, ModuleManager::getModulesFromDisk());
			  $_81636526=[];
				 foreach($GLOBALS['____2003578070'][23]() as $_1206058892){
				 $_1705979686= new ReflectionExtension($_1206058892);
				 $_81636526[$_1206058892]=[ ___1205269055(38) => $_1705979686->getVersion(), ___1205269055(39) => $_1705979686->getINIEntries()];
			}
			 $_213464069=[ ___1205269055(40) => $GLOBALS['____2003578070'][24]($_128839877), ___1205269055(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___1205269055(42) => $GLOBALS['____2003578070'][25]([ ___1205269055(43) => $GLOBALS['____2003578070'][26](), ___1205269055(44) => $_81636526])];
				 if(Loader::includeModule(___1205269055(45))){
				 $_1450886519= CSecuritySystemInformation::getSystemInformation();
					 if(isset($_1450886519[___1205269055(46)][___1205269055(47)]) && isset($_1450886519[___1205269055(48)][___1205269055(49)])){
					 $_213464069[___1205269055(50)]=[ ___1205269055(51) => $_1450886519[___1205269055(52)][___1205269055(53)], ___1205269055(54) => $_1450886519[___1205269055(55)][___1205269055(56)]];
				}
					 if(isset($_1450886519[___1205269055(57)][___1205269055(58)])){
					 $_213464069[___1205269055(59)]=[___1205269055(60) => $_1450886519[___1205269055(61)][___1205269055(62)]];
				}
			}
			  $_688600468= new HttpClient([ ___1205269055(63) => round(0+1+1+1+1+1), ___1205269055(64) => round(0+5)]);
			 $_2074999447= $_688600468->post( static::$_10121086, $_213464069);
				 if($_688600468->getStatus() == round(0+66.666666666667+66.666666666667+66.666666666667) &&!empty($_2074999447)){
				 $_921516293= Json::decode($_2074999447);
			}
				  if($_921516293 !== null){
				 $_1604044824= Application::getConnection();
				 $_1062779338= RuleRecordTable::getTableName();
					 if(!empty($_921516293)){
						 foreach($_921516293 as $_442001199){
							 if(!static::checkRuleSign($_442001199)){
							 throw new SystemException('Invalid sign for rule '.$GLOBALS['____2003578070'][27]($_442001199));
						}
					}
				}
				  $_1604044824->truncateTable($_1062779338);
					  if(!empty($_921516293)){
					 $_1950055113=[];
						 foreach($_921516293 as $_442001199){
						 $_1950055113[]= ___1205269055(65). $_1604044824->getSqlHelper()->forSql($_442001199[___1205269055(66)]). ___1205269055(67). $_1604044824->getSqlHelper()->forSql($_442001199[___1205269055(68)]). ___1205269055(69). $_1604044824->getSqlHelper()->forSql($_442001199[___1205269055(70)]). ___1205269055(71);
					}
					 $_848614692= $GLOBALS['____2003578070'][28](___1205269055(72), $_1950055113);
						  $_1604044824->query("INSERT INTO {
						$_1062779338
					}
						 (DATA, MODULE, MODULE_VERSION) VALUES {
						$_848614692
					}
					");
					  RuleRecordTable::cleanCache();
				}
			}
		}
			 catch(\Throwable $_2023727286){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___1205269055(73), ___1205269055(74), ___1205269055(75), ___1205269055(76). $_2023727286->getMessage(). ___1205269055(77). $_2023727286->getTraceAsString());
		}
	}
		 protected static function checkRuleSign($_1298328836){
		 $_140833552= new PublicKeyCipher;
		 $_24879376= $_140833552->decrypt($_1298328836[___1205269055(78)], static::__1090328206());
		 return str_starts_with($_24879376, ___1205269055(79));
	}
		 private static function __1090328206(){
		 $_762277239= '';
		 $_762277239 .= ___1205269055(80);
		 $_762277239 .= ___1205269055(81);
		 return $_762277239;
	}
		 protected function logEvent($_995627869, $_654404018, $_885429573){
			 if($this->_1881476787){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_995627869, 'main', $_654404018, $_885429573);
		}
	}
}

namespace Bitrix\Main\Security\W;
$GLOBALS['____2003578070']= 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__.'\\___1205269055')){
		function ___1205269055($_1787512488){
		static $_509615514= false;
		 if($_509615514 == false) $_509615514=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($_509615514[$_1787512488]);
	}
};
 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 $_10121086= 'https://wwall.bitrix.info/rules.php';
	 protected $_1881476787= true;
		 public function handle(){
			 try{
			  $_893620985= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
				 if(empty($_893620985)){
				 return;
			}
			  $_1418380962= Cache::createInstance();
			 $_2042326425= false;
				 if($_1418380962->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
				 $_329803682= $_1418380962->getVars();
					 if($GLOBALS['____2003578070'][0]()- $_329803682> round(0+4+4+4+4+4)){
					  $_1604044824= Application::getConnection();
					 $_1062779338= RuleRecordTable::getTableName();
					 $_1604044824->truncateTable($_1062779338);
					 RuleRecordTable::cleanCache();
					 $_1418380962->clean(___1205269055(0), ___1205269055(1));
				}
			}
				 elseif($_1418380962->startDataCache()){
				  $_1418380962->endDataCache($GLOBALS['____2003578070'][1]());
				 $_2042326425= true;
			}
				 foreach($_893620985 as $_2016823976){
				 $_140833552= new PublicKeyCipher;
				 $_1272099072= $_140833552->decrypt($_2016823976[___1205269055(2)], static::__1090328206());
					 if(!str_starts_with($_1272099072, ___1205269055(3))){
					 continue;
				}
				 $_24879376= $GLOBALS['____2003578070'][2]($_1272099072, true);
					 if(!empty($_24879376)){
					 $_1298328836= Rule::make($_24879376);
					 $_221037186= $this->handleRule($_1298328836);
					 $this->applyHandlingResults($_221037186);
				}
			}
				  if($_2042326425){
				 $_1418380962->clean(___1205269055(4), ___1205269055(5));
			}
		}
			 catch(\Throwable $_2023727286){
			 $this->logEvent( ___1205269055(6), ___1205269055(7), ___1205269055(8). $_2023727286->getMessage(). ___1205269055(9). $_2023727286->getTraceAsString());
		}
	}
		  public function handleRule(Rule $_1298328836): array{
		 $_221037186=[];
			 if($_1298328836->matchPath($_SERVER[___1205269055(10)])){
			  $_1334451537= $this->getContextElements($_1298328836->getContext());
				 foreach($_1334451537 as $_1991402032 => &$_2049059905){
				 $_221037186= $GLOBALS['____2003578070'][3]($_221037186, $this->recursiveContextKeyHandle($_1991402032, $_2049059905,[], $_1298328836));
			}
		}
		 return $_221037186;
	}
		  public function applyHandlingResults(array $_221037186){
		 $_1334451537= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
			 foreach($_221037186 as $_365746421){
			 $_2049059905=& $_1334451537[$_365746421->getContextName()];
			 $_1621317297= $_365746421->getRuleResult();
			 $_1298328836= $_365746421->getRule();
				 if($_1621317297 instanceof ModifyResult){
					 if($_1298328836->getProcess() === ___1205269055(11)){
					  static::rewriteContextKey( $_365746421->getContextName(), $_2049059905, $_365746421->getContextKey(), $_1621317297->getCleanValue());
				}
					 elseif($_1298328836->getProcess() === ___1205269055(12)){
					 static::rewriteContextValue( $_365746421->getContextName(), $_2049059905, $_365746421->getContextKey(), $_1621317297->getCleanValue());
				}
				 $this->logEvent( ___1205269055(13), $_365746421->getContextName(), $GLOBALS['____2003578070'][4](___1205269055(14), $_365746421->getContextKey()));
			}
				 elseif($_1621317297 instanceof CheckResult &&!$_1621317297->isSuccess()){
					 if($_1621317297->getAction() === RuleAction::UNSET){
					 static::unsetContextValue( $_365746421->getContextName(), $_2049059905, $_365746421->getContextKey(),);
					 $this->logEvent( ___1205269055(15), $_365746421->getContextName(), $GLOBALS['____2003578070'][5](___1205269055(16), $_365746421->getContextKey()));
				}
					 elseif($_1621317297->getAction() === RuleAction::EXIT){
					 $this->logEvent( ___1205269055(17), $_365746421->getContextName(), $GLOBALS['____2003578070'][6](___1205269055(18), $_365746421->getContextKey()));
					 exit;
				}
			}
		}
	}
		 public function disableEventLogging(){
		 $this->_1881476787= false;
	}
		 protected function rewriteContextKey($_1991402032, &$_2049059905, $_229254660, $_2019369976){
		 $_691540219= $_229254660;
		  $GLOBALS['____2003578070'][7]($_691540219);
		 $_691540219[]= $_2019369976;
			 if($_1991402032 === ___1205269055(19)){
			 $_538840154= $GLOBALS['____2003578070'][8]($_229254660);
			 $GLOBALS['____2003578070'][9]($_691540219);
				 if(empty($_229254660)){
				 $GLOBALS[$_2019369976]= $GLOBALS[$_538840154];
				 unset($GLOBALS[$_538840154]);
			}
				 else{
				 $_2049059905=& $GLOBALS[$_538840154];
				 $_779482256= ArrayHelper::getByNestedKey($_2049059905, $_229254660);
				  ArrayHelper::setByNestedKey($_2049059905, $_691540219, $_779482256);
				  ArrayHelper::unsetByNestedKey($_2049059905, $_229254660);
			}
		}
			 else{
			 $_779482256= ArrayHelper::getByNestedKey($_2049059905, $_229254660);
			  ArrayHelper::setByNestedKey($_2049059905, $_691540219, $_779482256);
			  ArrayHelper::unsetByNestedKey($_2049059905, $_229254660);
		}
	}
		 protected function rewriteContextValue($_1991402032, &$_2049059905, $_997826654, $_779482256){
			 if($_1991402032 === 'global'){
			 $_538840154= $GLOBALS['____2003578070'][10]($_997826654);
				 if(empty($_997826654)){
				 $GLOBALS[$_538840154]= $_779482256;
			}
				 else{
				 $_2049059905=& $GLOBALS[$_538840154];
				 ArrayHelper::setByNestedKey($_2049059905, $_997826654, $_779482256);
			}
		}
			 else{
			  ArrayHelper::setByNestedKey($_2049059905, $_997826654, $_779482256);
		}
	}
		 protected function unsetContextValue($_1991402032, &$_2049059905, $_997826654){
			 if($_1991402032 === 'global'){
			 $_538840154= $GLOBALS['____2003578070'][11]($_997826654);
				 if(empty($_997826654)){
				 unset($GLOBALS[$_538840154]);
			}
				 else{
				 $_2049059905=& $GLOBALS[$_538840154];
				 ArrayHelper::unsetByNestedKey($_2049059905, $_997826654);
			}
		}
			 else{
			 ArrayHelper::unsetByNestedKey($_2049059905, $_997826654);
		}
	}
		  protected function recursiveContextKeyHandle(string $_1991402032, array &$_2049059905, array $_1496447107, Rule $_1298328836): array{
		  $_221037186=[];
			 foreach($_2049059905 as $_933616412 => $_779482256){
			 $_997826654= $GLOBALS['____2003578070'][12]($_1496447107,[$_933616412]);
				 if($_1298328836->matchKey($_997826654)){
					  if($_1298328836->getProcess() === ___1205269055(20)){
					 $_1621317297= $_1298328836->echo $_933616412;
				}
					 elseif($_1298328836->getProcess() === ___1205269055(21)){
					 $_1621317297= $_1298328836->echo $_779482256;
				}
					  if(!empty($_1621317297) && $_1621317297 instanceof RuleResult){
					 $_221037186[]= new HandlingResult($_1991402032, $_997826654, $_1621317297, $_1298328836);
				}
			}
				  if($GLOBALS['____2003578070'][13]($_779482256)){
				 $_221037186= $GLOBALS['____2003578070'][14]($_221037186, $this->recursiveContextKeyHandle( $_1991402032, $_2049059905[$_933616412], $_997826654, $_1298328836));
			}
		}
		 return $_221037186;
	}
		 protected function getContextElements(array $_1633762247){
		 $_555410907=[];
			 if($GLOBALS['____2003578070'][15](___1205269055(22), $_1633762247, true)){
			 $_555410907[___1205269055(23)]= &$_GET;
		}
			 if($GLOBALS['____2003578070'][16](___1205269055(24), $_1633762247, true)){
			 $_555410907[___1205269055(25)]= &$_POST;
		}
			 if($GLOBALS['____2003578070'][17](___1205269055(26), $_1633762247, true)){
			 $_555410907[___1205269055(27)]= &$_COOKIE;
		}
			 if($GLOBALS['____2003578070'][18](___1205269055(28), $_1633762247, true)){
			 $_555410907[___1205269055(29)]= &$_REQUEST;
		}
			 if($GLOBALS['____2003578070'][19](___1205269055(30), $_1633762247, true)){
			 $_555410907[___1205269055(31)]= $GLOBALS;
		}
		 return $_555410907;
	}
		 public static function refreshRules(){
			 try{
			 $_1146225402= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
				 if(($GLOBALS['____2003578070'][20]()- $_1146225402)< static::CACHE_RULES_TTL){
				 return;
			}
			 Option::set(___1205269055(32), ___1205269055(33), $GLOBALS['____2003578070'][21]());
			 $_921516293= null;
				  $_128839877= $GLOBALS['____2003578070'][22](function($_1162462486){
				 return[___1205269055(34) => $_1162462486[___1205269055(35)], ___1205269055(36) => (int) $_1162462486[___1205269055(37)]];
			}
			, ModuleManager::getModulesFromDisk());
			  $_81636526=[];
				 foreach($GLOBALS['____2003578070'][23]() as $_1206058892){
				 $_1705979686= new ReflectionExtension($_1206058892);
				 $_81636526[$_1206058892]=[ ___1205269055(38) => $_1705979686->getVersion(), ___1205269055(39) => $_1705979686->getINIEntries()];
			}
			 $_213464069=[ ___1205269055(40) => $GLOBALS['____2003578070'][24]($_128839877), ___1205269055(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___1205269055(42) => $GLOBALS['____2003578070'][25]([ ___1205269055(43) => $GLOBALS['____2003578070'][26](), ___1205269055(44) => $_81636526])];
				 if(Loader::includeModule(___1205269055(45))){
				 $_1450886519= CSecuritySystemInformation::getSystemInformation();
					 if(isset($_1450886519[___1205269055(46)][___1205269055(47)]) && isset($_1450886519[___1205269055(48)][___1205269055(49)])){
					 $_213464069[___1205269055(50)]=[ ___1205269055(51) => $_1450886519[___1205269055(52)][___1205269055(53)], ___1205269055(54) => $_1450886519[___1205269055(55)][___1205269055(56)]];
				}
					 if(isset($_1450886519[___1205269055(57)][___1205269055(58)])){
					 $_213464069[___1205269055(59)]=[___1205269055(60) => $_1450886519[___1205269055(61)][___1205269055(62)]];
				}
			}
			  $_688600468= new HttpClient([ ___1205269055(63) => round(0+1+1+1+1+1), ___1205269055(64) => round(0+5)]);
			 $_2074999447= $_688600468->post( static::$_10121086, $_213464069);
				 if($_688600468->getStatus() == round(0+66.666666666667+66.666666666667+66.666666666667) &&!empty($_2074999447)){
				 $_921516293= Json::decode($_2074999447);
			}
				  if($_921516293 !== null){
				 $_1604044824= Application::getConnection();
				 $_1062779338= RuleRecordTable::getTableName();
					 if(!empty($_921516293)){
						 foreach($_921516293 as $_442001199){
							 if(!static::checkRuleSign($_442001199)){
							 throw new SystemException('Invalid sign for rule '.$GLOBALS['____2003578070'][27]($_442001199));
						}
					}
				}
				  $_1604044824->truncateTable($_1062779338);
					  if(!empty($_921516293)){
					 $_1950055113=[];
						 foreach($_921516293 as $_442001199){
						 $_1950055113[]= ___1205269055(65). $_1604044824->getSqlHelper()->forSql($_442001199[___1205269055(66)]). ___1205269055(67). $_1604044824->getSqlHelper()->forSql($_442001199[___1205269055(68)]). ___1205269055(69). $_1604044824->getSqlHelper()->forSql($_442001199[___1205269055(70)]). ___1205269055(71);
					}
					 $_848614692= $GLOBALS['____2003578070'][28](___1205269055(72), $_1950055113);
						  $_1604044824->query("INSERT INTO {
						$_1062779338
					}
						 (DATA, MODULE, MODULE_VERSION) VALUES {
						$_848614692
					}
					");
					  RuleRecordTable::cleanCache();
				}
			}
		}
			 catch(\Throwable $_2023727286){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___1205269055(73), ___1205269055(74), ___1205269055(75), ___1205269055(76). $_2023727286->getMessage(). ___1205269055(77). $_2023727286->getTraceAsString());
		}
	}
		 protected static function checkRuleSign($_1298328836){
		 $_140833552= new PublicKeyCipher;
		 $_24879376= $_140833552->decrypt($_1298328836[___1205269055(78)], static::__1090328206());
		 return str_starts_with($_24879376, ___1205269055(79));
	}
		 private static function __1090328206(){
		 $_762277239= '';
		 $_762277239 .= ___1205269055(80);
		 $_762277239 .= ___1205269055(81);
		 return $_762277239;
	}
		 protected function logEvent($_995627869, $_654404018, $_885429573){
			 if($this->_1881476787){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_995627869, 'main', $_654404018, $_885429573);
		}
	}
}

namespace Bitrix\Main\Security\W;
$GLOBALS['____2003578070']= 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__.'\\___1205269055')){
		function ___1205269055($_1787512488){
		static $_509615514= false;
		 if($_509615514 == false) $_509615514=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 $_10121086= 'https://wwall.bitrix.info/rules.php';
	 protected $_1881476787= true;
		 public function handle(){
			 try{
			  $_893620985= RuleRecordTable::getList([ 'cache' =>['ttl' => 3600* 24* 7]])->fetchAll();
				 if(empty($_893620985)){
				 return;
			}
			  $_1418380962= Cache::createInstance();
			 $_2042326425= false;
				 if($_1418380962->initCache(static::CACHE_RULES_TTL, 'WWALL_LOCK', 'security')){
				 $_329803682= $_1418380962->getVars();
					 if($GLOBALS['____2003578070'][0]()- $_329803682> round(0+4+4+4+4+4)){
					  $_1604044824= Application::getConnection();
					 $_1062779338= RuleRecordTable::getTableName();
					 $_1604044824->truncateTable($_1062779338);
					 RuleRecordTable::cleanCache();
					 $_1418380962->clean(___1205269055(0), ___1205269055(1));
				}
			}
				 elseif($_1418380962->startDataCache()){
				  $_1418380962->endDataCache($GLOBALS['____2003578070'][1]());
				 $_2042326425= true;
			}
				 foreach($_893620985 as $_2016823976){
				 $_140833552= new PublicKeyCipher;
				 $_1272099072= $_140833552->decrypt($_2016823976[___1205269055(2)], static::__1090328206());
					 if(!str_starts_with($_1272099072, ___1205269055(3))){
					 continue;
				}
				 $_24879376= $GLOBALS['____2003578070'][2]($_1272099072, true);
					 if(!empty($_24879376)){
					 $_1298328836= Rule::make($_24879376);
					 $_221037186= $this->handleRule($_1298328836);
					 $this->applyHandlingResults($_221037186);
				}
			}
				  if($_2042326425){
				 $_1418380962->clean(___1205269055(4), ___1205269055(5));
			}
		}
			 catch(\Throwable $_2023727286){
			 $this->logEvent( ___1205269055(6), ___1205269055(7), ___1205269055(8). $_2023727286->getMessage(). ___1205269055(9). $_2023727286->getTraceAsString());
		}
	}
		  public function handleRule(Rule $_1298328836): array{
		 $_221037186=[];
			 if($_1298328836->matchPath($_SERVER[___1205269055(10)])){
			  $_1334451537= $this->getContextElements($_1298328836->getContext());
				 foreach($_1334451537 as $_1991402032 => &$_2049059905){
				 $_221037186= $GLOBALS['____2003578070'][3]($_221037186, $this->recursiveContextKeyHandle($_1991402032, $_2049059905,[], $_1298328836));
			}
		}
		 return $_221037186;
	}
		  public function applyHandlingResults(array $_221037186){
		 $_1334451537= $this->getContextElements([ 'get', 'post', 'cookie', 'request', 'global']);
			 foreach($_221037186 as $_365746421){
			 $_2049059905=& $_1334451537[$_365746421->getContextName()];
			 $_1621317297= $_365746421->getRuleResult();
			 $_1298328836= $_365746421->getRule();
				 if($_1621317297 instanceof ModifyResult){
					 if($_1298328836->getProcess() === ___1205269055(11)){
					  static::rewriteContextKey( $_365746421->getContextName(), $_2049059905, $_365746421->getContextKey(), $_1621317297->getCleanValue());
				}
					 elseif($_1298328836->getProcess() === ___1205269055(12)){
					 static::rewriteContextValue( $_365746421->getContextName(), $_2049059905, $_365746421->getContextKey(), $_1621317297->getCleanValue());
				}
				 $this->logEvent( ___1205269055(13), $_365746421->getContextName(), $GLOBALS['____2003578070'][4](___1205269055(14), $_365746421->getContextKey()));
			}
				 elseif($_1621317297 instanceof CheckResult &&!$_1621317297->isSuccess()){
					 if($_1621317297->getAction() === RuleAction::UNSET){
					 static::unsetContextValue( $_365746421->getContextName(), $_2049059905, $_365746421->getContextKey(),);
					 $this->logEvent( ___1205269055(15), $_365746421->getContextName(), $GLOBALS['____2003578070'][5](___1205269055(16), $_365746421->getContextKey()));
				}
					 elseif($_1621317297->getAction() === RuleAction::EXIT){
					 $this->logEvent( ___1205269055(17), $_365746421->getContextName(), $GLOBALS['____2003578070'][6](___1205269055(18), $_365746421->getContextKey()));
					 exit;
				}
			}
		}
	}
		 public function disableEventLogging(){
		 $this->_1881476787= false;
	}
		 protected function rewriteContextKey($_1991402032, &$_2049059905, $_229254660, $_2019369976){
		 $_691540219= $_229254660;
		  $GLOBALS['____2003578070'][7]($_691540219);
		 $_691540219[]= $_2019369976;
			 if($_1991402032 === ___1205269055(19)){
			 $_538840154= $GLOBALS['____2003578070'][8]($_229254660);
			 $GLOBALS['____2003578070'][9]($_691540219);
				 if(empty($_229254660)){
				 $GLOBALS[$_2019369976]= $GLOBALS[$_538840154];
				 unset($GLOBALS[$_538840154]);
			}
				 else{
				 $_2049059905=& $GLOBALS[$_538840154];
				 $_779482256= ArrayHelper::getByNestedKey($_2049059905, $_229254660);
				  ArrayHelper::setByNestedKey($_2049059905, $_691540219, $_779482256);
				  ArrayHelper::unsetByNestedKey($_2049059905, $_229254660);
			}
		}
			 else{
			 $_779482256= ArrayHelper::getByNestedKey($_2049059905, $_229254660);
			  ArrayHelper::setByNestedKey($_2049059905, $_691540219, $_779482256);
			  ArrayHelper::unsetByNestedKey($_2049059905, $_229254660);
		}
	}
		 protected function rewriteContextValue($_1991402032, &$_2049059905, $_997826654, $_779482256){
			 if($_1991402032 === 'global'){
			 $_538840154= $GLOBALS['____2003578070'][10]($_997826654);
				 if(empty($_997826654)){
				 $GLOBALS[$_538840154]= $_779482256;
			}
				 else{
				 $_2049059905=& $GLOBALS[$_538840154];
				 ArrayHelper::setByNestedKey($_2049059905, $_997826654, $_779482256);
			}
		}
			 else{
			  ArrayHelper::setByNestedKey($_2049059905, $_997826654, $_779482256);
		}
	}
		 protected function unsetContextValue($_1991402032, &$_2049059905, $_997826654){
			 if($_1991402032 === 'global'){
			 $_538840154= $GLOBALS['____2003578070'][11]($_997826654);
				 if(empty($_997826654)){
				 unset($GLOBALS[$_538840154]);
			}
				 else{
				 $_2049059905=& $GLOBALS[$_538840154];
				 ArrayHelper::unsetByNestedKey($_2049059905, $_997826654);
			}
		}
			 else{
			 ArrayHelper::unsetByNestedKey($_2049059905, $_997826654);
		}
	}
		  protected function recursiveContextKeyHandle(string $_1991402032, array &$_2049059905, array $_1496447107, Rule $_1298328836): array{
		  $_221037186=[];
			 foreach($_2049059905 as $_933616412 => $_779482256){
			 $_997826654= $GLOBALS['____2003578070'][12]($_1496447107,[$_933616412]);
				 if($_1298328836->matchKey($_997826654)){
					  if($_1298328836->getProcess() === ___1205269055(20)){
					 $_1621317297= $_1298328836->echo $_933616412;
				}
					 elseif($_1298328836->getProcess() === ___1205269055(21)){
					 $_1621317297= $_1298328836->echo $_779482256;
				}
					  if(!empty($_1621317297) && $_1621317297 instanceof RuleResult){
					 $_221037186[]= new HandlingResult($_1991402032, $_997826654, $_1621317297, $_1298328836);
				}
			}
				  if($GLOBALS['____2003578070'][13]($_779482256)){
				 $_221037186= $GLOBALS['____2003578070'][14]($_221037186, $this->recursiveContextKeyHandle( $_1991402032, $_2049059905[$_933616412], $_997826654, $_1298328836));
			}
		}
		 return $_221037186;
	}
		 protected function getContextElements(array $_1633762247){
		 $_555410907=[];
			 if($GLOBALS['____2003578070'][15](___1205269055(22), $_1633762247, true)){
			 $_555410907[___1205269055(23)]= &$_GET;
		}
			 if($GLOBALS['____2003578070'][16](___1205269055(24), $_1633762247, true)){
			 $_555410907[___1205269055(25)]= &$_POST;
		}
			 if($GLOBALS['____2003578070'][17](___1205269055(26), $_1633762247, true)){
			 $_555410907[___1205269055(27)]= &$_COOKIE;
		}
			 if($GLOBALS['____2003578070'][18](___1205269055(28), $_1633762247, true)){
			 $_555410907[___1205269055(29)]= &$_REQUEST;
		}
			 if($GLOBALS['____2003578070'][19](___1205269055(30), $_1633762247, true)){
			 $_555410907[___1205269055(31)]= $GLOBALS;
		}
		 return $_555410907;
	}
		 public static function refreshRules(){
			 try{
			 $_1146225402= Option::get('main_sec', 'WWALL_ACTUALIZE_RULES', 0);
				 if(($GLOBALS['____2003578070'][20]()- $_1146225402)< static::CACHE_RULES_TTL){
				 return;
			}
			 Option::set(___1205269055(32), ___1205269055(33), $GLOBALS['____2003578070'][21]());
			 $_921516293= null;
				  $_128839877= $GLOBALS['____2003578070'][22](function($_1162462486){
				 return[___1205269055(34) => $_1162462486[___1205269055(35)], ___1205269055(36) => (int) $_1162462486[___1205269055(37)]];
			}
			, ModuleManager::getModulesFromDisk());
			  $_81636526=[];
				 foreach($GLOBALS['____2003578070'][23]() as $_1206058892){
				 $_1705979686= new ReflectionExtension($_1206058892);
				 $_81636526[$_1206058892]=[ ___1205269055(38) => $_1705979686->getVersion(), ___1205269055(39) => $_1705979686->getINIEntries()];
			}
			 $_213464069=[ ___1205269055(40) => $GLOBALS['____2003578070'][24]($_128839877), ___1205269055(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___1205269055(42) => $GLOBALS['____2003578070'][25]([ ___1205269055(43) => $GLOBALS['____2003578070'][26](), ___1205269055(44) => $_81636526])];
				 if(Loader::includeModule(___1205269055(45))){
				 $_1450886519= CSecuritySystemInformation::getSystemInformation();
					 if(isset($_1450886519[___1205269055(46)][___1205269055(47)]) && isset($_1450886519[___1205269055(48)][___1205269055(49)])){
					 $_213464069[___1205269055(50)]=[ ___1205269055(51) => $_1450886519[___1205269055(52)][___1205269055(53)], ___1205269055(54) => $_1450886519[___1205269055(55)][___1205269055(56)]];
				}
					 if(isset($_1450886519[___1205269055(57)][___1205269055(58)])){
					 $_213464069[___1205269055(59)]=[___1205269055(60) => $_1450886519[___1205269055(61)][___1205269055(62)]];
				}
			}
			  $_688600468= new HttpClient([ ___1205269055(63) => round(0+1+1+1+1+1), ___1205269055(64) => round(0+5)]);
			 $_2074999447= $_688600468->post( static::$_10121086, $_213464069);
				 if($_688600468->getStatus() == round(0+66.666666666667+66.666666666667+66.666666666667) &&!empty($_2074999447)){
				 $_921516293= Json::decode($_2074999447);
			}
				  if($_921516293 !== null){
				 $_1604044824= Application::getConnection();
				 $_1062779338= RuleRecordTable::getTableName();
					 if(!empty($_921516293)){
						 foreach($_921516293 as $_442001199){
							 if(!static::checkRuleSign($_442001199)){
							 throw new SystemException('Invalid sign for rule '.$GLOBALS['____2003578070'][27]($_442001199));
						}
					}
				}
				  $_1604044824->truncateTable($_1062779338);
					  if(!empty($_921516293)){
					 $_1950055113=[];
						 foreach($_921516293 as $_442001199){
						 $_1950055113[]= ___1205269055(65). $_1604044824->getSqlHelper()->forSql($_442001199[___1205269055(66)]). ___1205269055(67). $_1604044824->getSqlHelper()->forSql($_442001199[___1205269055(68)]). ___1205269055(69). $_1604044824->getSqlHelper()->forSql($_442001199[___1205269055(70)]). ___1205269055(71);
					}
					 $_848614692= $GLOBALS['____2003578070'][28](___1205269055(72), $_1950055113);
						  $_1604044824->query("INSERT INTO {
						$_1062779338
					}
						 (DATA, MODULE, MODULE_VERSION) VALUES {
						$_848614692
					}
					");
					  RuleRecordTable::cleanCache();
				}
			}
		}
			 catch(\Throwable $_2023727286){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, ___1205269055(73), ___1205269055(74), ___1205269055(75), ___1205269055(76). $_2023727286->getMessage(). ___1205269055(77). $_2023727286->getTraceAsString());
		}
	}
		 protected static function checkRuleSign($_1298328836){
		 $_140833552= new PublicKeyCipher;
		 $_24879376= $_140833552->decrypt($_1298328836[___1205269055(78)], static::__1090328206());
		 return str_starts_with($_24879376, ___1205269055(79));
	}
		 private static function __1090328206(){
		 $_762277239= '';
		 $_762277239 .= ___1205269055(80);
		 $_762277239 .= ___1205269055(81);
		 return $_762277239;
	}
		 protected function logEvent($_995627869, $_654404018, $_885429573){
			 if($this->_1881476787){
			 \CEventLog::log( \CEventLog::SEVERITY_SECURITY, $_995627869, 'main', $_654404018, $_885429573);
		}
	}
}



© 2023 Quttera Ltd. All rights reserved.