} shell_exec("killall airodump-ng 2> /dev/null"); } // List Clients shell_exec("cat " . $dumpPath . "-01.csv | tail -n +\$((\$(cat " . $dumpPath . "-01.csv | grep -n \"Station MAC\" | cut -f1 -d:)+1)) | tr '\r' '\n' > " . $dumpPath . "-01.tmp"); shell_exec("sed '/^\$/d' < " . $dumpPath . "-01.tmp > " . $dumpPath . "-01.clients"); $file_handle = fopen($dumpPath . "-01.clients", "r"); while (!feof($file_handle)) { $line = fgets($file_handle); $line = str_replace(" ", "", $line); #$clients[] = split(",", $line); $clients[] = explode(",", $line); } fclose($file_handle); // List APs $iwlistparse = new iwlist_parser(); $p = $iwlistparse->parseScanDev($interface); if (!empty($p)) { echo '<table id="survey-grid" class="grid" cellspacing="0">'; echo '<tr class="header">'; echo '<td>SSID</td>'; echo '<td>BSSID</td>'; echo '<td>Signal level</td>'; echo '<td colspan="2">Quality level</td>'; echo '<td>Ch</td>'; echo '<td>Encryption</td>'; echo '<td>Cipher</td>'; echo '<td>Auth</td>'; echo '<td>Deauth</td>'; echo '<td>Capture</td>'; echo '<td>Custom</td>';
function getAPList($interface) { $iwlistparse = new iwlist_parser(); $p = $iwlistparse->parseScanDev($interface); $str = ""; if (!empty($p)) { $str .= '<em>Click on a row to select the target AP</em> <table id="survey-grid" class="grid" cellspacing="0"> <tr class="header"> <td>SSID</td> <td>BSSID</td> <td>Signal level</td> <td colspan="2">Quality level</td> <td>Ch</td> <td>Encryption</td> <td>Cipher</td> <td>Auth</td> </tr>'; } else { $str .= "<em>No access-point found, please retry or change the wifi interface used (in left panel)...</em>"; } for ($i = 1; $i <= count($p[$interface]); $i++) { $quality = $p[$interface][$i]["Quality"]; if ($quality <= 25) { $graph = "red"; } else { if ($quality <= 50) { $graph = "yellow"; } else { if ($quality <= 100) { $graph = "green"; } } } $str .= '<tr class="odd" name="' . $p[$interface][$i]["ESSID"] . ',' . $p[$interface][$i]["Address"] . ',' . $p[$interface][$i]["Channel"] . '"> <td>' . $p[$interface][$i]["ESSID"] . '</td> <td>' . $p[$interface][$i]["Address"] . '</td> <td>' . $p[$interface][$i]["Signal level"] . '</td> <td>' . $quality . '%</td> <td width="150"> <div class="graph-border"> <div class="graph-bar" style="width: ' . $quality . '%; background: ' . $graph . ';"></div> </div> </td> <td>' . $p[$interface][$i]["Channel"] . '</td>'; if ($p[$interface][$i]["Encryption key"] == "on") { $WPA = strstr($p[$interface][$i]["IE"], "WPA Version 1"); $WPA2 = strstr($p[$interface][$i]["IE"], "802.11i/WPA2 Version 1"); $auth_type = str_replace("\n", " ", $p[$interface][$i]["Authentication Suites (1)"]); $auth_type = implode(' ', array_unique(explode(' ', $auth_type))); $cipher = $p[$interface][$i]["Pairwise Ciphers (2)"] ? $p[$interface][$i]["Pairwise Ciphers (2)"] : $p[$interface][$i]["Pairwise Ciphers (1)"]; $cipher = str_replace("\n", " ", $cipher); $cipher = implode(',', array_unique(explode(' ', $cipher))); if ($WPA2 != "" && $WPA != "") { $str .= '<td>WPA,WPA2</td>'; } else { if ($WPA2 != "") { $str .= '<td>WPA2</td>'; } else { if ($WPA != "") { $str .= '<td>WPA</td>'; } else { $str .= '<td>WEP</td>'; } } } $str .= '<td>' . $cipher . '</td><td>' . $auth_type . '</td>'; } else { $str .= '<td>None</td><td> </td><td> </td>'; } $str .= '</tr>'; } return $str; }