public static function newAP($scan, $bssid, $first, $last, $channel, $privacy, $cipher, $authentication, $power, $beacons, $ivs, $essid, $latitude, $longitude) { global $wicker; $instance = new self(); $instance->connectToDatabase(); $statement = $instance->db->con()->prepare("INSERT INTO `aps` (`scan_id`, `bssid`, `first_seen`, `last_seen`, `channel`, `privacy`, `cipher`, `authentication`, `power`, `beacons`, `ivs`, `essid`, `latitude`, `longitude`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $statement->execute(array($scan, $bssid, $first, $last, $channel, $privacy, $cipher, $authentication, $power, $beacons, $ivs, $essid, $latitude, $longitude)); return AP::fromDB($scan, $bssid); }
<?php require_once "Wicker.php"; require_once "Scan.class.php"; require_once "AP.class.php"; $parent_ap = AP::fromDB($_GET['parent_scan'], $_GET['bssid']); $ind_ap = AP::fromDB($_GET['scanid'], $_GET['bssid']); $parent_scan = Scan::fromDB($_GET['parent_scan']); $ind_scan = Scan::fromDB($_GET['scanid']); if ($_GET['do'] == "terminate") { $scan = Scan::fromDB($_GET['scanid']); if ($scan->getPID() != 0 && $scan->getStatus() == 1) { $scan->setStatus(2); system("sudo kill " . $scan->getPID()); header('Location: apview.php?parent_scan=' . $_GET['parent_scan'] . '&scanid=' . $_GET['scanid'] . '&bssid=' . $_GET['bssid']); die; } } else { if ($_GET['do'] == "terminatenstart") { // Terminate parent scan $previous = Scan::fromDB($_GET['parent_scan']); if ($previous->getPID() != 0 && $previous->getStatus() == 1) { $previous->setStatus(2); system("sudo kill " . $previous->getPID()); } // Start new individual scan $scan = Scan::newScan(); $scan->setStatus(1); $scan->startIndScan($parent_ap->getBSSID(), $parent_ap->getChannel()); $parent_ap->setIndScanID($scan->getID()); header('Location: apview.php?parent_scan=' . $_GET['parent_scan'] . '&scanid=' . $scan->getID() . '&bssid=' . $_GET['bssid']);
</span></td> <td><?php echo $client->getProbed(); ?> </td> </tr> <?php } } ?> </tbody> </table> <?php } else { if ($type == "apview") { $data = AP::fromDB($_GET['id'], $_GET['bssid']); if ($_GET['id'] == 0 || $data->getESSID() == null) { ?> <h1 class="page-header"></h1> <div class="row placeholders"> <div class="col-xs-6 col-sm-4 placeholder"> <h2>--:--:--:--:--:--</h2> <span class="text-muted">BSSID/AP MAC</span> </div> <div class="col-xs-6 col-sm-4 placeholder"> <h2>---</h2> <span class="text-muted">First Seen</span> </div> <div class="col-xs-6 col-sm-3 placeholder"> <h2>---</h2>
$scan->setWEP(1); $scan->startAircrackWEP(); } // If scan has started, than check to see if key has been recovered yet. if ($scan->getWEP() == 1) { // Key recovered $key = $scan->checkKey(); if ($key !== false) { $check->setKey($key); } } } } } // Add Clients to DB if they aren't already there foreach ($clients as $client) { $ap = AP::fromDB($scan->getID(), $client["bssid"]); $check = Client::fromDB($scan->getID(), $ap->getID(), $client["mac"]); // Add Client if not found if ($check->getID() == null) { Client::newClient($scan->getID(), $ap->getID(), $client["mac"], strtotime($client["first_seen"]), strtotime($client["last_seen"]), $client["power"], $client["packets"], $client["bssid"], $client["probed"]); // Update Client in DB } else { $check->setLastSeen(strtotime($client["last_seen"])); $check->setPackets($client["packets"]); $check->setProbed($client["probed"]); } } } } }
public function getAPs($sort = "id", $order = "DESC") { $statement = $this->db->con()->prepare("SELECT * FROM `aps` WHERE `scan_id` = ? ORDER BY {$sort} {$order}"); $statement->execute(array($this->getID())); while ($info = $statement->fetchObject()) { $aps[] = AP::fromDB($info->scan_id, $info->bssid); } return $aps; }