1<?
namespace Bitrix\Main\Security\W;
$GLOBALS[
'____432640195']=
array(base64_decode(
'dGltZ'.
'Q=='),base64_decode(
'dGltZQ=='),base64_decode(
'anNv'.
'bl9k'.
'ZWNvZ'.
'GU='),base64_decode(
'YXJ'.
'yY'.
'XlfbWVyZ'.
'2U='),base64_decode(
'am'.
'9pbg='.
'='),base64_decode(
''.
'am9pbg'.
'=='),base64_decode(
''.
'am'.
'9pbg=='),base64_decode(
''.
'YXJyYX'.
'lfcG9w'),base64_decode(
'YX'.
'Jy'.
'YXlf'.
'c2hpZ'.
'nQ'.
'='),base64_decode(
'Y'.
'XJyYXlfc2hp'.
'Z'.
'n'.
'Q='),base64_decode(
'YXJ'.
'yYXlfc2hpZ'.
'nQ='),base64_decode(
'YXJ'.
'y'.
'Y'.
'Xlfc2hpZnQ='),base64_decode(
'YXJyYXl'.
'fbWVyZ2U='),base64_decode(
'a'.
'XNfYXJ'.
'yYXk='),base64_decode(
'YXJyYXlfb'.
'W'.
'Vy'.
'Z2U='),base64_decode(
'aW5fYXJyYXk='),base64_decode(
'aW5'.
'f'.
'YXJy'.
'YXk'.
'='),base64_decode(
'aW5'.
'fYXJyY'.
'Xk='),base64_decode(
'aW5f'.
'Y'.
'XJyYXk='),base64_decode(
''.
'a'.
'W'.
'5'.
'fYXJyY'.
'Xk='),base64_decode(
'dGltZ'.
'Q=='),base64_decode(
''.
'dGl'.
'tZQ'.
'=='),base64_decode(
'YXJy'.
'Y'.
'Xlf'.
'bWF'.
'w'),base64_decode(
'Z2V0X2xv'.
'YWRlZF9le'.
'HRl'.
'bnNpb25z'),base64_decode(
'anNvbl9lbmNvZGU='),base64_decode(
'an'.
'Nvbl9lb'.
'm'.
'NvZGU'.
'='),base64_decode(
'cGh'.
'wdmVyc2lvbg=='),base64_decode(
'a'.
'n'.
'Nv'.
'b'.
'l9lbmN'.
'vZ'.
'GU='),base64_decode(
'am9pbg'.
'=='));
if(!function_exists(__NAMESPACE__.
'\\___351228942')){
function ___351228942($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icKeyCipher; 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 $_1085498528=
true;
public function handle(){
try{ $_423765613= RuleRecordTable::getList([
'cache' =>[
'ttl' => 3600* 24* 7]])->fetchAll();
if(empty($_423765613)){
return;} $_48067608= Cache::createInstance(); $_1939854112=
false;
if($_48067608->initCache(static::CACHE_RULES_TTL,
'WWALL_LOCK',
'security')){ $_847780549= $_48067608->getVars();
if(
$GLOBALS[
'____432640195'][0]()- $_847780549> round(0+10+10)){ $_598355972=
Application::getConnection(); $_116520269= RuleRecordTable::getTableName(); $_598355972->truncateTable($_116520269); RuleRecordTable::cleanCache(); $_48067608->clean(___351228942(0), ___351228942(1));}}
elseif($_48067608->startDataCache()){ $_48067608->endDataCache(
$GLOBALS[
'____432640195'][1]()); $_1939854112=
true;}
foreach($_423765613 as $_1628041218){ $_298854609=
new PublicKeyCipher; $_1550088759= $_298854609->decrypt($_1628041218[___351228942(2)], static::__2113021679());
if(!str_starts_with($_1550088759, ___351228942(3))){
continue;} $_1328823883=
$GLOBALS[
'____432640195'][2]($_1550088759,
true);
if(!empty($_1328823883)){ $_1448459762= Rule::make($_1328823883); $_784570825= $this->
handleRule($_1448459762); $this->
applyHandlingResults($_784570825);}}
if($_1939854112){ $_48067608->clean(___351228942(4), ___351228942(5));}}
catch(\Throwable $_1911598223){ $this->
logEvent( ___351228942(6), ___351228942(7), ___351228942(8). $_1911598223->getMessage(). ___351228942(9). $_1911598223->getTraceAsString());}}
public function handleRule(Rule $_1448459762):
array{ $_784570825=[];
if($_1448459762->matchPath(
$_SERVER[___351228942(10)])){ $_1873492170= $this->
getContextElements($_1448459762->getContext());
foreach($_1873492170 as $_1053311487 => &$_1423776340){ $_784570825=
$GLOBALS[
'____432640195'][3]($_784570825, $this->
recursiveContextKeyHandle($_1053311487, $_1423776340,[], $_1448459762));}}
return $_784570825;}
public function applyHandlingResults(
array $_784570825){ $_1873492170= $this->getContextElements([
'get',
'post',
'cookie',
'request',
'global']);
foreach($_784570825 as $_870108958){ $_1423776340=& $_1873492170[$_870108958->getContextName()]; $_623030792= $_870108958->getRuleResult(); $_1448459762= $_870108958->getRule();
if($_623030792 instanceof
ModifyResult){
if($_1448459762->getProcess() === ___351228942(11)){ static::rewriteContextKey( $_870108958->getContextName(), $_1423776340, $_870108958->getContextKey(), $_623030792->getCleanValue());}
elseif($_1448459762->getProcess() === ___351228942(12)){ static::rewriteContextValue( $_870108958->getContextName(), $_1423776340, $_870108958->getContextKey(), $_623030792->getCleanValue());} $this->logEvent( ___351228942(13), $_870108958->getContextName(),
$GLOBALS[
'____432640195'][4](___351228942(14), $_870108958->getContextKey()));}
elseif($_623030792 instanceof
CheckResult &&!$_623030792->
isSuccess()){
if($_623030792->getAction() === RuleAction::UNSET){ static::unsetContextValue( $_870108958->getContextName(), $_1423776340, $_870108958->getContextKey(),); $this->logEvent( ___351228942(15), $_870108958->getContextName(),
$GLOBALS[
'____432640195'][5](___351228942(16), $_870108958->getContextKey()));}
elseif($_623030792->getAction() === RuleAction::EXIT){ $this->logEvent( ___351228942(17), $_870108958->getContextName(),
$GLOBALS[
'____432640195'][6](___351228942(18), $_870108958->getContextKey())); exit;}}}}
public function disableEventLogging(){ $this->_1085498528=
false;}
protected function rewriteContextKey($_1053311487, &$_1423776340, $_1922562403, $_2089517706){ $_1464624056= $_1922562403;
$GLOBALS[
'____432640195'][7]($_1464624056); $_1464624056[]= $_2089517706;
if($_1053311487 === ___351228942(19)){ $_1872568263=
$GLOBALS[
'____432640195'][8]($_1922562403);
$GLOBALS[
'____432640195'][9]($_1464624056);
if(empty($_1922562403)){
$GLOBALS[$_2089517706]=
$GLOBALS[$_1872568263]; unset(
$GLOBALS[$_1872568263]);}
else{ $_1423776340=&
$GLOBALS[$_1872568263]; $_454252404= ArrayHelper::getByNestedKey($_1423776340, $_1922562403); ArrayHelper::setByNestedKey($_1423776340, $_1464624056, $_454252404); ArrayHelper::unsetByNestedKey($_1423776340, $_1922562403);}}
else{ $_454252404= ArrayHelper::getByNestedKey($_1423776340, $_1922562403); ArrayHelper::setByNestedKey($_1423776340, $_1464624056, $_454252404); ArrayHelper::unsetByNestedKey($_1423776340, $_1922562403);}}
protected function rewriteContextValue($_1053311487, &$_1423776340, $_1794251644, $_454252404){
if($_1053311487 ===
'global'){ $_1872568263=
$GLOBALS[
'____432640195'][10]($_1794251644);
if(empty($_1794251644)){
$GLOBALS[$_1872568263]= $_454252404;}
else{ $_1423776340=&
$GLOBALS[$_1872568263]; ArrayHelper::setByNestedKey($_1423776340, $_1794251644, $_454252404);}}
else{ ArrayHelper::setByNestedKey($_1423776340, $_1794251644, $_454252404);}}
protected function unsetContextValue($_1053311487, &$_1423776340, $_1794251644){
if($_1053311487 ===
'global'){ $_1872568263=
$GLOBALS[
'____432640195'][11]($_1794251644);
if(empty($_1794251644)){ unset(
$GLOBALS[$_1872568263]);}
else{ $_1423776340=&
$GLOBALS[$_1872568263]; ArrayHelper::unsetByNestedKey($_1423776340, $_1794251644);}}
else{ ArrayHelper::unsetByNestedKey($_1423776340, $_1794251644);}}
protected function recursiveContextKeyHandle(
string $_1053311487,
array &$_1423776340,
array $_275113030,
Rule $_1448459762):
array{ $_784570825=[];
foreach($_1423776340 as $_2098750933 => $_454252404){ $_1794251644=
$GLOBALS[
'____432640195'][12]($_275113030,[$_2098750933]);
if($_1448459762->matchKey($_1794251644)){
if($_1448459762->getProcess() === ___351228942(20)){ $_623030792= $_1448459762->evaluate($_2098750933);}
elseif($_1448459762->getProcess() === ___351228942(21)){ $_623030792= $_1448459762->evaluateValue($_454252404);}
if(!empty($_623030792) && $_623030792 instanceof
RuleResult){ $_784570825[]=
new HandlingResult($_1053311487, $_1794251644, $_623030792, $_1448459762);}}
if(
$GLOBALS[
'____432640195'][13]($_454252404)){ $_784570825=
$GLOBALS[
'____432640195'][14]($_784570825, $this->recursiveContextKeyHandle( $_1053311487, $_1423776340[$_2098750933], $_1794251644, $_1448459762));}}
return $_784570825;}
protected function getContextElements(
array $_749843214){ $_630843216=[];
if(
$GLOBALS[
'____432640195'][15](___351228942(22), $_749843214,
true)){ $_630843216[___351228942(23)]= &$_GET;}
if(
$GLOBALS[
'____432640195'][16](___351228942(24), $_749843214,
true)){ $_630843216[___351228942(25)]= &$_POST;}
if(
$GLOBALS[
'____432640195'][17](___351228942(26), $_749843214,
true)){ $_630843216[___351228942(27)]= &$_COOKIE;}
if(
$GLOBALS[
'____432640195'][18](___351228942(28), $_749843214,
true)){ $_630843216[___351228942(29)]= &
$_REQUEST;}
if(
$GLOBALS[
'____432640195'][19](___351228942(30), $_749843214,
true)){ $_630843216[___351228942(31)]=
$GLOBALS;}
return $_630843216;}
public static function refreshRules(){
try{ $_481820400= Option::get(
'main_sec',
'WWALL_ACTUALIZE_RULES', 0);
if((
$GLOBALS[
'____432640195'][20]()- $_481820400)< static::CACHE_RULES_TTL){
return;} Option::set(___351228942(32), ___351228942(33),
$GLOBALS[
'____432640195'][21]()); $_1628894769=
null; $_1486754612=
$GLOBALS[
'____432640195'][22](
function($_1405399708){
return[___351228942(34) => $_1405399708[___351228942(35)], ___351228942(36) => (int) $_1405399708[___351228942(37)]];}, ModuleManager::getModulesFromDisk()); $_987870130=[];
foreach(
$GLOBALS[
'____432640195'][23]() as $_330025299){ $_302906022=
new ReflectionExtension($_330025299); $_987870130[$_330025299]=[ ___351228942(38) => $_302906022->getVersion(), ___351228942(39) => $_302906022->getINIEntries()];} $_270076818=[ ___351228942(40) =>
$GLOBALS[
'____432640195'][24]($_1486754612), ___351228942(41) => Application::getInstance()->getLicense()->getHashLicenseKey(), ___351228942(42) =>
$GLOBALS[
'____432640195'][25]([ ___351228942(43) =>
$GLOBALS[
'____432640195'][26](), ___351228942(44) => $_987870130])];
if(Loader::includeModule(___351228942(45))){ $_664209086=
CSecuritySystemInformation::getSystemInformation();
if(isset($_664209086[___351228942(46)][___351228942(47)]) && isset($_664209086[___351228942(48)][___351228942(49)])){ $_270076818[___351228942(50)]=[ ___351228942(51) => $_664209086[___351228942(52)][___351228942(53)], ___351228942(54) => $_664209086[___351228942(55)][___351228942(56)]];}
if(isset($_664209086[___351228942(57)][___351228942(58)])){ $_270076818[___351228942(59)]=[___351228942(60) => $_664209086[___351228942(61)][___351228942(62)]];}} $_272465123=
new HttpClient([ ___351228942(63) => round(0+5), ___351228942(64) => round(0+2.5+2.5)]); $_1646740783=(
new UrlProvider())->getTechDomain(); $_1404496712=
"https://wwall.{$_1646740783}/rules.php"; $_1411817434= $_272465123->post($_1404496712, $_270076818);
if($_272465123->getStatus() == round(0+40+40+40+40+40) &&!empty($_1411817434)){ $_1628894769= Json::decode($_1411817434);}
if($_1628894769 !==
null){ $_598355972= Application::getConnection(); $_116520269= RuleRecordTable::getTableName();
if(!empty($_1628894769)){
foreach($_1628894769 as $_1889674870){
if(!static::checkRuleSign($_1889674870)){
throw new SystemException(
'Invalid sign for rule '.
$GLOBALS[
'____432640195'][27]($_1889674870));}}} $_598355972->truncateTable($_116520269);
if(!empty($_1628894769)){ $_522600736=[];
foreach($_1628894769 as $_1889674870){ $_522600736[]= ___351228942(65). $_598355972->getSqlHelper()->forSql($_1889674870[___351228942(66)]). ___351228942(67). $_598355972->getSqlHelper()->forSql($_1889674870[___351228942(68)]). ___351228942(69). $_598355972->getSqlHelper()->forSql($_1889674870[___351228942(70)]). ___351228942(71);} $_668894888=
$GLOBALS[
'____432640195'][28](___351228942(72), $_522600736); $_598355972->query(
"INSERT INTO {$_116520269} (DATA, MODULE, MODULE_VERSION) VALUES {$_668894888}"); RuleRecordTable::cleanCache();}}}
catch(\Throwable $_1911598223){ \CEventLog::log( \
CEventLog::SEVERITY_SECURITY, ___351228942(73), ___351228942(74), ___351228942(75), ___351228942(76). $_1911598223->getMessage(). ___351228942(77). $_1911598223->getTraceAsString());}}
protected static function checkRuleSign($_1448459762){ $_298854609=
new PublicKeyCipher; $_1328823883= $_298854609->decrypt($_1448459762[___351228942(78)], static::__2113021679());
return str_starts_with($_1328823883, ___351228942(79));}
private static function __2113021679(){ $_1855582778=
''; $_1855582778 .= ___351228942(80); $_1855582778 .= ___351228942(81);
return $_1855582778;}
protected function logEvent($_314112744, $_1340656447, $_1654609851){
if($this->_1085498528){ \CEventLog::log( \
CEventLog::SEVERITY_SECURITY, $_314112744,
'main', $_1340656447, $_1654609851);}}}?>