From c79084ac1dee3a4f8a3c8e1908c2a455986623bb Mon Sep 17 00:00:00 2001 From: Mark Unwin Date: Thu, 21 Mar 2024 11:22:07 +1000 Subject: [PATCH] Enable Audit My PC on the login page --- app/Controllers/Scripts.php | 4 +++- app/Models/ScriptsModel.php | 7 ++++++- app/Views/logon.php | 7 ++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/Controllers/Scripts.php b/app/Controllers/Scripts.php index 4a74c15fe..c05933ec1 100644 --- a/app/Controllers/Scripts.php +++ b/app/Controllers/Scripts.php @@ -32,13 +32,15 @@ class Scripts extends BaseController { public function download($id) { - $id = intval($id); if (empty($this->scriptsModel)) { $this->scriptsModel = model('App\Models\ScriptsModel'); } if (!is_numeric($id)) { $id = $this->scriptsModel->getByOs($id); } + if (is_numeric($id)) { + $id = intval($id); + } if (empty($id)) { return; } diff --git a/app/Models/ScriptsModel.php b/app/Models/ScriptsModel.php index da24073b1..1ebb60296 100644 --- a/app/Models/ScriptsModel.php +++ b/app/Models/ScriptsModel.php @@ -358,7 +358,12 @@ public function download(int $id = 0): ?string if (!empty($instance->config->default_network_address)) { $options->url = $instance->config->default_network_address . 'index.php/input/devices'; } else { - unset($options->url); + $baseURL = base_url(); + if (!empty($baseURL)) { + $options->url = $baseURL . 'index.php/input/devices'; + } else { + unset($options->url); + } } } $find = 'Configuration from web UI here'; diff --git a/app/Views/logon.php b/app/Views/logon.php index 88dcf72f8..a339f3f22 100644 --- a/app/Views/logon.php +++ b/app/Views/logon.php @@ -133,7 +133,6 @@

Don't forget about the Open-AudIT wiki for all your documentation.
https://community.opmantek.com/display/OA/Home
- default_network_address) and strpos($config->default_network_address, '127.0.0.1') === false and strpos($config->default_network_address, 'localhost') === false and !empty($config->default_network_address)) { ?>
@@ -157,11 +156,13 @@
-
#
+  #
+
NOTE - You are accessing this URL from the local Open-AudIT server. The downloaded script will not be able to submit when run on any other machine.
If you need to audit other machines, please download the script from a remote machine, not the Open-AudIT server itself.'); + } ?>
-