Last active
October 24, 2024 15:02
-
-
Save aplneto/433d265c70a160373c52ae2362a52136 to your computer and use it in GitHub Desktop.
Revisions
-
aplneto renamed this gist
Oct 24, 2024 . 1 changed file with 7 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,29 +1,17 @@ <?php // Returns the content of HTTP Requests received // Set content-type to plaintext to avoid XSS problems header("Content-Type: text/plain"); // Request Method, URL and Protocol echo "{$_SERVER['REQUEST_METHOD']} {$_SERVER['REQUEST_URI']} {$_SERVER['SERVER_PROTOCOL']}\n"; // Request Headers foreach (apache_request_headers() as $header => $value) { echo "$header: $value\n"; } // x-www-form-urlencoded post data if ($_SERVER['REQUEST_METHOD'] === 'POST') { $post_data_array = []; foreach ($_POST as $key => $value) { @@ -32,10 +20,10 @@ function file_callback($buffer) echo "\n\n" . join("&", $post_data_array); } // other post data $json = file_get_contents('php://input'); if ($json) { echo $json; } // TODO add multipart/form-data support -
aplneto revised this gist
Oct 24, 2024 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ RewriteEngine On RewriteRule ^ index.php [L] RewriteRule ^\.htaccess$ - [F] RewriteRule ^config\.php$ - [F] -
aplneto revised this gist
Oct 24, 2024 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ RewriteEngine On RewriteRule ^grpc grpc.php [L] RewriteRule ^ index.php [L] RewriteRule ^\.htaccess$ - [F] RewriteRule ^config\.php$ - [F] RewriteRule .* - [e=HTTP_AUTHORIZATION:%{HTTP:Authorization}] -
aplneto renamed this gist
Oct 24, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
aplneto created this gist
Oct 24, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ <?php // put output into file function file_callback($buffer) { $fh = fopen("/var/www/html/logs/" . $_SERVER['REMOTE_ADDR']. "_" . time() . ".txt", "w"); fwrite($fh, $buffer); fclose($fh); return $buffer; } ob_start("file_callback"); // Retorna o conteúdo da requisição em formato HTTP // Define o tipo de conteúdo como texto simples header("Content-Type: text/plain"); // Imprime as informações da requisição echo "{$_SERVER['REQUEST_METHOD']} {$_SERVER['REQUEST_URI']} {$_SERVER['SERVER_PROTOCOL']}\n"; foreach (apache_request_headers() as $header => $value) { echo "$header: $value\n"; } // Se houver dados de POST, imprime também if ($_SERVER['REQUEST_METHOD'] === 'POST') { $post_data_array = []; foreach ($_POST as $key => $value) { array_push($post_data_array, "$key=$value"); } echo "\n\n" . join("&", $post_data_array); } // Se houver dados de JSON, imprime também $json = file_get_contents('php://input'); if ($json) { echo $json; } ob_end_flush();