From dd7a5d3ab2458a783c787172b3fe71c48375e578 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 2 Oct 2019 18:33:32 +0100 Subject: [PATCH] Updates to nmap and urlsnarf (#79) * nmap: Check internal space available to avoid confusion with large depends. * arpspoof: fix accidental recursion. --- nmap/api/module.php | 5 +- nmap/js/module.js | 2 + nmap/module.html | 562 +++++++++++++++++++++++----------------- nmap/module.info | 2 +- urlsnarf/api/module.php | 8 +- urlsnarf/module.info | 2 +- 6 files changed, 337 insertions(+), 244 deletions(-) diff --git a/nmap/api/module.php b/nmap/api/module.php index ff94358..790c6fd 100644 --- a/nmap/api/module.php +++ b/nmap/api/module.php @@ -142,7 +142,10 @@ class nmap extends Module $device = $this->getDevice(); $sdAvailable = $this->isSDAvailable(); - $this->response = array("device" => $device, "sdAvailable" => $sdAvailable, "status" => $status, "statusLabel" => $statusLabel, "installed" => $installed, "install" => $install, "installLabel" => $installLabel, "processing" => $processing); + // 2143000 is the installed size of nmap. + $internalAvailable = (disk_free_space("/") - 64000) > 2143000; + + $this->response = array("device" => $device, "internalAvailable" => $internalAvailable, "sdAvailable" => $sdAvailable, "status" => $status, "statusLabel" => $statusLabel, "installed" => $installed, "install" => $install, "installLabel" => $installLabel, "processing" => $processing); } private function refreshOutput() diff --git a/nmap/js/module.js b/nmap/js/module.js index 5b29fdf..02369a5 100644 --- a/nmap/js/module.js +++ b/nmap/js/module.js @@ -27,6 +27,7 @@ registerController('nmap_ControlsController', ['$api', '$scope', '$rootScope', ' $scope.device = ''; $scope.sdAvailable = false; + $scope.internalAvailable = false; $rootScope.status = { installed: false, @@ -45,6 +46,7 @@ registerController('nmap_ControlsController', ['$api', '$scope', '$rootScope', ' $rootScope.status.installed = response.installed; $scope.device = response.device; $scope.sdAvailable = response.sdAvailable; + $scope.internalAvailable = response.internalAvailable; if (response.processing) $scope.processing = true; $scope.install = response.install; $scope.installLabel = response.installLabel; diff --git a/nmap/module.html b/nmap/module.html index 4c62e4e..12d85fc 100644 --- a/nmap/module.html +++ b/nmap/module.html @@ -1,62 +1,100 @@ -

{{title}}

{{version}}
+
+

{{title}}

{{version}} +
+
+
-

Controls

+

Controls

+
+
+ + + + + + + + + + +
Dependencies + + + +
nmap + +
-
- - - - - - - - - - -
Dependencies
nmap
-
- + @@ -67,169 +105,210 @@

Options

-
+
-
-
- Command - -
-
- -
-
- Target - -
-
- -
-
- Profile - -
-
- -
-
Scan
-
-
- -
-
- Timing - -
-
- -
-
- TCP scan - -
-
- -
-
- Non-TCP scan - -
-
- -
-
-
-
-
-
-
-
-
+
+
+ Command +
-
-
+
-
-
Ping
-
-
-
-
-
-
-
-
-
-
+
+
+ Target +
-
-
+
-
-
Target
-
-
-
-
-
-
-
+
+
+ Profile +
-
-
+
-
-
Other
-
-
-
-
-
-
-
-
-
-
+
+
Scan
+
+
+ +
+
+ Timing + +
+
+ +
+
+ TCP scan + +
+
+ +
+
+ Non-TCP scan + +
+
+ +
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
+
+
Ping
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
Target
+
+
+
+
+
+
+
+
+
+
+ +
+
Other
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
-
+

Output

-
- Auto-refresh
- - -
-
-
+
+ Auto-refresh +
+ + +
+
+
-
-
{{output}}
+ +
+
{{output}}
@@ -239,48 +318,57 @@
-
-
- - - - - - - - - - - - - -
DateAction
{{entry[0]}} -
- - - -
-
-
-
No history...
+ +
+
+ + + + + + + + + + + + + +
DateAction
{{entry[0]}} +
+ + + +
+
+
+
No history...
- +
diff --git a/nmap/module.info b/nmap/module.info index 8c66da3..79d035c 100644 --- a/nmap/module.info +++ b/nmap/module.info @@ -6,5 +6,5 @@ "tetra" ], "title": "nmap", - "version": "1.8" + "version": "1.9" } \ No newline at end of file diff --git a/urlsnarf/api/module.php b/urlsnarf/api/module.php index c0b66f6..5b1c8a9 100644 --- a/urlsnarf/api/module.php +++ b/urlsnarf/api/module.php @@ -49,7 +49,7 @@ class urlsnarf extends Module } } - protected function checkDependency($dependencyName) + protected function checkDep($dependencyName) { return ($this->checkDependency($dependencyName) && ($this->uciGet("urlsnarf.module.installed"))); } @@ -67,7 +67,7 @@ class urlsnarf extends Module private function handleDependencies() { - if (!$this->checkDependency("urlsnarf")) { + if (!$this->checkDep("urlsnarf")) { $this->execBackground("/pineapple/modules/urlsnarf/scripts/dependencies.sh install ".$this->request->destination); $this->response = array('success' => true); } else { @@ -119,7 +119,7 @@ class urlsnarf extends Module private function refreshStatus() { if (!file_exists('/tmp/urlsnarf.progress')) { - if (!$this->checkDependency("urlsnarf")) { + if (!$this->checkDep("urlsnarf")) { $installed = false; $install = "Not installed"; $installLabel = "danger"; @@ -173,7 +173,7 @@ class urlsnarf extends Module private function refreshOutput() { - if ($this->checkDependency("urlsnarf")) { + if ($this->checkDep("urlsnarf")) { if ($this->checkRunning("urlsnarf")) { $path = "/pineapple/modules/urlsnarf/log"; diff --git a/urlsnarf/module.info b/urlsnarf/module.info index 216f69e..f783c13 100644 --- a/urlsnarf/module.info +++ b/urlsnarf/module.info @@ -6,5 +6,5 @@ "tetra" ], "title": "urlsnarf", - "version": "1.7" + "version": "1.8" }