added official hacktheboo2024 writeups
This commit is contained in:
parent
1f7a9b0566
commit
e3c46450f7
327 changed files with 14303 additions and 0 deletions
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
class IndexController
|
||||
{
|
||||
private $configFile = 'config.json';
|
||||
private $config;
|
||||
|
||||
public function __construct() {
|
||||
if (file_exists($this->configFile)) {
|
||||
$this->config = json_decode(file_get_contents($this->configFile), true);
|
||||
} else {
|
||||
$this->config = array(
|
||||
'from' => 'Ghostly Support',
|
||||
'email' => 'support@void-whispers.htb',
|
||||
'sendMailPath' => '/usr/sbin/sendmail',
|
||||
'mailProgram' => 'sendmail',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function index($router)
|
||||
{
|
||||
$router->view('index', ['config' => $this->config]);
|
||||
}
|
||||
|
||||
public function updateSetting($router)
|
||||
{
|
||||
$from = $_POST['from'];
|
||||
$mailProgram = $_POST['mailProgram'];
|
||||
$sendMailPath = $_POST['sendMailPath'];
|
||||
$email = $_POST['email'];
|
||||
|
||||
if (empty($from) || empty($mailProgram) || empty($sendMailPath) || empty($email)) {
|
||||
return $router->jsonify(['message' => 'All fields required!', 'status' => 'danger'], 400);
|
||||
}
|
||||
|
||||
if (preg_match('/\s/', $sendMailPath)) {
|
||||
return $router->jsonify(['message' => 'Sendmail path should not contain spaces!', 'status' => 'danger'], 400);
|
||||
}
|
||||
|
||||
$whichOutput = shell_exec("which $sendMailPath");
|
||||
if (empty($whichOutput)) {
|
||||
return $router->jsonify(['message' => 'Binary does not exist!', 'status' => 'danger'], 400);
|
||||
}
|
||||
|
||||
$this->config['from'] = $from;
|
||||
$this->config['mailProgram'] = $mailProgram;
|
||||
$this->config['sendMailPath'] = $sendMailPath;
|
||||
$this->config['email'] = $email;
|
||||
|
||||
file_put_contents($this->configFile, json_encode($this->config));
|
||||
|
||||
return $router->jsonify(['message' => 'Config updated successfully!', 'status' => 'success'], 200);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue