diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-24 15:37:01 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-08-24 15:37:01 +0200 |
commit | e3298dbeaae79bb1d384fa8cd78a67be89819720 (patch) | |
tree | 871560e330f6c7225fb50ae86e3586776d81356a /telemetry | |
download | kartik-net-e3298dbeaae79bb1d384fa8cd78a67be89819720.tar.gz kartik-net-e3298dbeaae79bb1d384fa8cd78a67be89819720.tar.bz2 kartik-net-e3298dbeaae79bb1d384fa8cd78a67be89819720.zip |
Initial commit
Diffstat (limited to 'telemetry')
-rw-r--r-- | telemetry/private/.htaccess | 0 | ||||
-rw-r--r-- | telemetry/private/dom.php | 30 | ||||
-rw-r--r-- | telemetry/report/index.php | 44 |
3 files changed, 74 insertions, 0 deletions
diff --git a/telemetry/private/.htaccess b/telemetry/private/.htaccess new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/telemetry/private/.htaccess diff --git a/telemetry/private/dom.php b/telemetry/private/dom.php new file mode 100644 index 0000000..4519e79 --- /dev/null +++ b/telemetry/private/dom.php @@ -0,0 +1,30 @@ +<?php + +$db = json_decode(file_get_contents("/mnt/minteckrolt-main/includes/telemetry.json"), true); + +$ip = md5($_SERVER['REMOTE_ADDR']); +$day = date('d'); +$month = date('m'); +$year = date('y'); +$url = "kartik:" .explode("?", $_SERVER['REQUEST_URI'])[0]; + +if (!isset($db[$year]) && $_SERVER['PHP_SELF'] !== "/error.php") { + $db[$year] = []; +} +if (!isset($db[$year][$month]) && $_SERVER['PHP_SELF'] !== "/error.php") { + $db[$year][$month] = []; +} +if (!isset($db[$year][$month][$day]) && $_SERVER['PHP_SELF'] !== "/error.php") { + $db[$year][$month][$day] = []; +} +if (!isset($db[$year][$month][$day][$url]) && $_SERVER['PHP_SELF'] !== "/error.php") { + $db[$year][$month][$day][$url] = []; +} + +if (!in_array($ip, $db[$year][$month][$day][$url]) && $_SERVER['PHP_SELF'] !== "/error.php") { + array_push($db[$year][$month][$day][$url], $ip); +} + +if (trim(json_encode($db, JSON_PRETTY_PRINT)) !== "null") { + file_put_contents("/mnt/minteckrolt-main/includes/telemetry.json", json_encode($db, JSON_PRETTY_PRINT)); +}
\ No newline at end of file diff --git a/telemetry/report/index.php b/telemetry/report/index.php new file mode 100644 index 0000000..442d53a --- /dev/null +++ b/telemetry/report/index.php @@ -0,0 +1,44 @@ +<?php + +class UUID { + public static function v4() { + return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', + mt_rand(0, 0xffff), mt_rand(0, 0xffff), + mt_rand(0, 0xffff), + mt_rand(0, 0x0fff) | 0x4000, + mt_rand(0, 0x3fff) | 0x8000, + mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) + ); + } +} + +if (isset($_GET['report'])) { + $d = utf8_encode(base64_decode($_GET['report'])); +} else { + echo("Not set"); + die(); +} + +$ch = curl_init(); +curl_setopt($ch, CURLOPT_URL, "https://familine.jetbrains.space/api/http/projects/id:cUW7s1nHBNd/planning/issues"); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +curl_setopt($ch, CURLOPT_USERPWD, "kos:yc2c\VT<6T.?`h43p$[ttyD,4(VqDKM<F)hXxdCP72a~ghXJe@4CLF8P3K.;r+XAr;n6(*\a4[J>!{t<WA4=&EpZ!pgnA}W#8\"UfqN9Vs,-rPW;C!?a_94%SPrRH~Rm>"); +curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); +curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type: application/json', + 'Accept: application/json', +)); +curl_setopt($ch, CURLOPT_POST, 1); +$j = "{\"title\":\"Rapport de bug automatique (" . UUID::v4() . ")\",\"description\":\"\",\"assignee\":\"id:3hh9iS36gW9p\",\"status\":\"458T9x3wM0zN\",\"tags\":[\"3XhWk14WX0Jj\"]}"; +$a = json_decode($j, true); +$a["description"] = "```" . str_replace("`", "'", $d) . "```"; +curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($a)); +var_dump(json_encode($a)); +$output = curl_exec($ch); +$info = curl_getinfo($ch); +curl_close($ch); + +echo("Done!"); +var_dump($output); +var_dump($info); +die(); |