initial commit
This commit is contained in:
commit
b65642cd0a
18 changed files with 1543 additions and 0 deletions
10
modules/date/date.php
Normal file
10
modules/date/date.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
$format = $_GET['format'] ?? 'full';
|
||||
|
||||
date_default_timezone_set($_GET['timezone'] ?? 'UTC');
|
||||
|
||||
echo date(match ($format) {
|
||||
'full' => 'Y-m-d H:i:s',
|
||||
'unix' => 'U'
|
||||
});
|
||||
1073
modules/date/date_help.php
Normal file
1073
modules/date/date_help.php
Normal file
File diff suppressed because it is too large
Load diff
9
modules/httpbin/httpbin.php
Normal file
9
modules/httpbin/httpbin.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
$data = resumeRequest();
|
||||
|
||||
header("Content-Type: application/json");
|
||||
|
||||
$str = json_encode($data);
|
||||
|
||||
echo $str;
|
||||
112
modules/logator/logator.php
Normal file
112
modules/logator/logator.php
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
function getFilesAsArray($path) {
|
||||
$dirs = array_filter(glob($path . '/*'), 'is_file');
|
||||
$dirs = array_map(function ($dirName) {
|
||||
$compo = explode('/', $dirName);
|
||||
return $compo[count($compo)-1];
|
||||
}, $dirs);
|
||||
return array_values($dirs);
|
||||
}
|
||||
|
||||
function getDirsAsArray($path) {
|
||||
$dirs = array_filter(glob($path . '/*'), 'is_dir');
|
||||
$dirs = array_map(function ($dirName) {
|
||||
$compo = explode('/', $dirName);
|
||||
return $compo[count($compo)-1];
|
||||
}, $dirs);
|
||||
return array_values($dirs);
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$logAt = __DIR__ . '/../../tmp/requests';
|
||||
|
||||
if (!file_exists($logAt)) {
|
||||
mkdir($logAt, 0770, true);
|
||||
}
|
||||
$logAt = realpath($logAt);
|
||||
|
||||
if ($_SERVER['REQUEST_URI'] === '/') {
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => 'Welcome to the logator app!'
|
||||
]);
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_URI'] === '/loggers') {
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'data' => getDirsAsArray($logAt)
|
||||
]);
|
||||
exit();
|
||||
}
|
||||
|
||||
if (strpos($_SERVER['REQUEST_URI'], '/logger-details') === 0) {
|
||||
if (!isset($_GET['id']) || $_GET['id'] === '') {
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => 'Bro, I need an ID bro. Why are you doing that to me?'
|
||||
]);
|
||||
}
|
||||
$id = preg_replace('/[^0-9a-zA-Z]/', '', $_GET['id']);
|
||||
$path = $logAt . '/' . $id;
|
||||
if (!file_exists($path)) {
|
||||
http_response_code(404);
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => 'Bruh id did not find'
|
||||
]);
|
||||
exit();
|
||||
}
|
||||
|
||||
$data = [];
|
||||
foreach (getFilesAsArray($path) as $file) {
|
||||
$data[] = json_decode(file_get_contents($path . '/' . $file), true);
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'data' => $data
|
||||
]);
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_URI'] === '/create') {
|
||||
$id = generateRandomString(6, ['upper', 'digit']);
|
||||
|
||||
mkdir($logAt . '/' . $id, 0770);
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => 'Created a logger with id: ' . $id,
|
||||
'id' => $id
|
||||
]);
|
||||
exit();
|
||||
}
|
||||
|
||||
$id = parse_url($_SERVER['REQUEST_URI'])['path'];
|
||||
$id = preg_replace('/[^0-9a-zA-Z]/', '', $id);
|
||||
|
||||
if (!file_exists($logAt . '/' . $id)) {
|
||||
http_response_code(404);
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => "This logger doesn't exist, this incident will be reported (of course not, your dumbass who will think that something so uninteresting as that is worth to log in a file that no one will read anyways. You fools.)"
|
||||
]);
|
||||
exit();
|
||||
}
|
||||
|
||||
$resume = resumeRequest();
|
||||
|
||||
$requestId = substr(hash('sha256', json_encode($resume)), 0, 16);
|
||||
|
||||
$resume['id'] = $requestId;
|
||||
|
||||
$path = $logAt . '/' . $id . '/' . $requestId . '.json';
|
||||
|
||||
file_put_contents($path, json_encode($resume));
|
||||
|
||||
echo json_encode(['success' => true, 'requestId' => $requestId]);
|
||||
18
modules/logator/logator_help.php
Normal file
18
modules/logator/logator_help.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'actions' => [
|
||||
[
|
||||
'name' => 'List all loggers',
|
||||
'path' => '/loggers'
|
||||
],
|
||||
[
|
||||
'name' => 'Get details about a logger',
|
||||
'path' => '/logger-details?id=YOURID'
|
||||
],
|
||||
[
|
||||
'name' => 'Execute a logger',
|
||||
'path' => '/YOURID'
|
||||
]
|
||||
]
|
||||
];
|
||||
3
modules/printip/printip.php
Normal file
3
modules/printip/printip.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
echo $_SERVER['REMOTE_ADDRESS'];
|
||||
31
modules/quicknote/quicknote.php
Normal file
31
modules/quicknote/quicknote.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
$path = __DIR__ . '/../../tmp/quicknotes';
|
||||
|
||||
if (!file_exists($path)) {
|
||||
mkdir($path);
|
||||
}
|
||||
|
||||
$path = realpath($path);
|
||||
|
||||
$message = '';
|
||||
|
||||
if (isset($_GET['m'])) {
|
||||
$message = $_GET['m'];
|
||||
}
|
||||
|
||||
if (isset($_GET['message'])) {
|
||||
$message = $_GET['message'];
|
||||
}
|
||||
|
||||
if (strlen($message) === 0) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$data = '[' . date('Y-m-d H:i:s') . ']';
|
||||
$data .= ' - ' . $message;
|
||||
$data .= "\n";
|
||||
|
||||
file_put_contents($path . '/logs.txt', $data, FILE_APPEND);
|
||||
|
||||
echo 'OK';
|
||||
29
modules/quickupload/quickupload.php
Normal file
29
modules/quickupload/quickupload.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
$path = __DIR__ . '/../../tmp/quickupload';
|
||||
|
||||
if (!file_exists($path)) {
|
||||
mkdir($path);
|
||||
}
|
||||
$path = realpath($path);
|
||||
|
||||
function slugify($string){
|
||||
return strtolower(trim(preg_replace('/[^.A-Za-z0-9-]+/', '-', $string), '-'));
|
||||
}
|
||||
|
||||
if (isset($_FILES['file'])) {
|
||||
$f = $_FILES['file'];
|
||||
copy($f['tmp_name'], $path . '/' . uniqid() . '_' . slugify($f['name']));
|
||||
?>
|
||||
<div style="padding: 20px; border: 1px solid green; background: green; color: white">
|
||||
File uploaded!
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<h3>QuickUpload</h3>
|
||||
<form enctype="multipart/form-data" method="POST">
|
||||
<input type="hidden" name="name" value="wow" />
|
||||
<input type="file" name="file" />
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
9
modules/random/random.php
Normal file
9
modules/random/random.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
$len = $_GET['length'] ?? 32;
|
||||
|
||||
$contains = isset($_GET['contains']) ? explode(',', $_GET['contains']) : ['digit', 'upper', 'lower', 'special'];
|
||||
|
||||
header('Content-Type: text/plain');
|
||||
|
||||
echo generateRandomString($len, $contains);
|
||||
23
modules/random/random_help.php
Normal file
23
modules/random/random_help.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'actions' => [
|
||||
[
|
||||
'name' => 'Generate alphanumerics',
|
||||
'path' => '/?contains=digit,lower,upper'
|
||||
],
|
||||
[
|
||||
'name' => 'More complex',
|
||||
'path' => '/?contains=digit,lower,upper,special'
|
||||
],
|
||||
[
|
||||
'name' => 'Change length',
|
||||
'path' => '/?length=20'
|
||||
]
|
||||
],
|
||||
'append' => function () {
|
||||
?>
|
||||
Of course, you can combine many parameters into one query.
|
||||
<?php
|
||||
}
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue