Pārlūkot izejas kodu

[MODULES][PMKIDAttack] Release v3.1

DSR! 2 gadi atpakaļ
vecāks
revīzija
6d6c397d31

BIN
modules/build/PMKIDAttack.tar.gz


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
modules/build/modules.json


+ 21 - 19
modules/src/PMKIDAttack/api/module.php

@@ -162,38 +162,45 @@ class PMKIDAttack extends Module
         return $this->uciGet("pineap.@config[0].pineap_interface");
     }
 
+    protected function getBSSID($clean = false)
+    {
+        $bssid = $this->uciGet("pmkidattack.@config[0].bssid");
+
+        return $clean ? str_replace(":", "", $bssid) : $bssid;
+    }
+
+    protected function getProcessStatus()
+    {
+        return \helper\checkRunning($this->getToolPath("hcxdumptool"));
+    }
+
     protected function startAttack()
     {
         $ssid = $this->request->ssid;
         $bssid = $this->request->bssid;
-        $cleanStart = $this->request->cleanStart === "true";
 
         //$this->execBackground("{$this->moduleFolder}/scripts/PMKIDAttack.sh start " . $this->request->bssid);
         $this->uciSet("pmkidattack.@config[0].ssid", $ssid);
         $this->uciSet("pmkidattack.@config[0].bssid", $bssid);
         $this->uciSet("pmkidattack.@config[0].attack", "1");
 
+        $pineAPHelper = new PineAPHelper();
+        $pineAPHelper->disablePineAP();
+
         $cleanBSSID = $this->getBSSID(true);
         $interface = $this->getMonitorInterface();
         $capPath = $this->getCapPath();
         $hcxdumptoolPath = $this->getToolPath("hcxdumptool");
         $filterPath = self::MODULE_PATH . "/scripts/filter.txt";
 
-        if ($cleanStart) {
+        exec("ifconfig -a | grep {$interface}", $interfaceCheck);
+        if (empty($interfaceCheck)) {
             $originalInterface = str_replace('mon', '', $interface);
             exec("airmon-ng start {$originalInterface}");
         }
 
-        $pineAPHelper = new PineAPHelper();
-        $pineAPHelper->disablePineAP();
-
         exec("echo {$cleanBSSID} > {$filterPath}");
-        $command = "{$hcxdumptoolPath} " . 
-            "-o {$capPath} " .
-            "-i {$interface} " .
-            "--filterlist_ap={$filterPath} " .
-            "--filtermode=2 " .
-            "--enable_status=1 &> /dev/null &";
+        $command = "{$hcxdumptoolPath} -o {$capPath} -i {$interface} --filterlist_ap={$filterPath} --filtermode=2 --enable_status=1";
         $this->execBackground($command);
         $this->addLog("Start attack {$bssid}");
         //$this->addLog($command);
@@ -239,17 +246,11 @@ class PMKIDAttack extends Module
 
         $this->response = [
             "pmkidLog" => $check['log'],
+            "process" => $check['process'],
             "success" => $check['status'],
         ];
     }
 
-    protected function getBSSID($clean = false)
-    {
-        $bssid = $this->uciGet("pmkidattack.@config[0].bssid");
-
-        return $clean ? str_replace(":", "", $bssid) : $bssid;
-    }
-
     protected function checkPMKID()
     {
         $capPath = $this->getCapPath();
@@ -267,6 +268,7 @@ class PMKIDAttack extends Module
 
         return [
             'log' => $log,
+            'process' => $this->getProcessStatus(),
 
             // on hcxpcaptool 6.0
             //'status' => strpos($log, " handshake(s) written to") !== false && strpos($log, "0 handshake(s) written to") === false,
@@ -340,10 +342,10 @@ class PMKIDAttack extends Module
     protected function getStatusAttack()
     {
         $this->response = [
+            "process" => $this->getProcessStatus(),
             "ssid" => $this->uciGet("pmkidattack.@config[0].ssid"),
             "bssid" => $this->uciGet("pmkidattack.@config[0].bssid"),
             "attack" => $this->uciGet("pmkidattack.@config[0].attack") === true,
-            "process" => \helper\checkRunning($this->getToolPath("hcxdumptool")),
         ];
     }
 }

+ 6 - 9
modules/src/PMKIDAttack/js/module.js

@@ -206,7 +206,7 @@ registerController('PMKIDAttack_AttackResults', ['$api', '$scope', '$rootScope',
                 $rootScope.pmkid_bssid = response.bssid;
                 $scope.checkPMKID();
             } else if (!response.process && response.attack) {
-                $rootScope.pmkid_startAttack(response.ssid, response.bssid, "true");
+                $rootScope.pmkid_startAttack(response.ssid, response.bssid);
             }
         });
     };
@@ -215,11 +215,7 @@ registerController('PMKIDAttack_AttackResults', ['$api', '$scope', '$rootScope',
         $rootScope.pmkid_captureRunning = true;
         if (!$rootScope.pmkid_intervalCheckHash) {
             $rootScope.pmkid_intervalCheckHash = $interval(function () {
-                if ($rootScope.pmkid_captureRunning) {
-                    $scope.catchPMKID();
-                } else {
-                    $rootScope.pmkid_stopAttack();
-                }
+                $scope.catchPMKID();
             }, 30000);
         }
     };
@@ -231,7 +227,9 @@ registerController('PMKIDAttack_AttackResults', ['$api', '$scope', '$rootScope',
         }, function (response) {
             $rootScope.pmkid_pmkidLog = response.pmkidLog;
             if (response.success) {
-                $rootScope.pmkid_captureRunning = false;
+                $rootScope.pmkid_stopAttack();
+            } else if (!response.process) {
+                $rootScope.pmkid_startAttack($scope.ssid, $rootScope.pmkid_bssid);
             }
         });
     };
@@ -280,7 +278,7 @@ registerController('PMKIDAttack_AttackResults', ['$api', '$scope', '$rootScope',
         });
     };
 
-    $rootScope.pmkid_startAttack = function (ssid, bssid, cleanStart) {
+    $rootScope.pmkid_startAttack = function (ssid, bssid) {
         $scope.ssid = ssid;
         $rootScope.pmkid_bssid = bssid;
         $rootScope.pmkid_pmkidLog = '';
@@ -290,7 +288,6 @@ registerController('PMKIDAttack_AttackResults', ['$api', '$scope', '$rootScope',
             module: 'PMKIDAttack',
             ssid: ssid,
             bssid: bssid,
-            cleanStart: cleanStart
         }, function (response) {
             if (response.success) {
                 $scope.checkPMKID();

+ 1 - 1
modules/src/PMKIDAttack/module.info

@@ -6,5 +6,5 @@
         "tetra"
     ],
     "title": "PMKIDAttack",
-    "version": "3.0"
+    "version": "3.1"
 }

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels