diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2024-07-04 13:02:59 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2024-07-04 13:02:59 +0200 |
commit | 27bf644d5809be63e439484a3f8ffee81b9d367b (patch) | |
tree | 37a31ded0cc54c8d7a54ebf57ad27cdbe5043311 /src/process-request.php | |
parent | 257269474f4c8b5327d2a4a63129b5c329092059 (diff) | |
download | volse-webtrap-27bf644d5809be63e439484a3f8ffee81b9d367b.tar.gz volse-webtrap-27bf644d5809be63e439484a3f8ffee81b9d367b.tar.bz2 volse-webtrap-27bf644d5809be63e439484a3f8ffee81b9d367b.zip |
Rename trap-post-payload.php and call it from index.php.
Diffstat (limited to 'src/process-request.php')
-rw-r--r-- | src/process-request.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/process-request.php b/src/process-request.php new file mode 100644 index 0000000..0df43d9 --- /dev/null +++ b/src/process-request.php @@ -0,0 +1,25 @@ +<?php + +// SPDX-FileCopyrightText: 2024 Eilertsens Kodeknekkeri +// SPDX-FileCopyrightText: 2024 Harald Eilertsen +// +// SPDX-License-Identifier: AGPL-3.0-or-later + +$data = [ + 'SERVER_NAME' => $_SERVER['SERVER_NAME'], + 'REMOTE_ADDR' => $_SERVER['REMOTE_ADDR'], + 'REMOTE_PORT' => $_SERVER['REMOTE_PORT'], + 'REQUEST_METHOD' => $_SERVER['REQUEST_METHOD'], + 'REQUEST_URI' => $_SERVER['REQUEST_URI'], + 'QUERY_STRING' => $_SERVER['QUERY_STRING'], + 'REQUEST_TIME' => $_SERVER['REQUEST_TIME'], + 'REQUEST_HEADERS' => getallheaders(), + 'POST' => $_POST, + 'COOKIES' => $_COOKIE, + 'BODY' => file_get_contents('php://input'), +]; + +$file_name = dirname(__DIR__) . "/payloads/{$data['REQUEST_TIME']}-{$data['SERVER_NAME']}.json"; +error_log("Trapped request, saving to {$file_name}"); +file_put_contents($file_name, json_encode($data)); +header("HTTP/1.1 404 Not Found"); |