public static function newClient($scan, $ap, $mac, $first, $last, $power, $packets, $bssid, $probed) { global $wicker; $instance = new self(); $instance->connectToDatabase(); $statement = $instance->db->con()->prepare("INSERT INTO `clients` (`scan_id`, `ap_id`, `mac`, `first_seen`, `last_seen`, `power`, `packets`, `bssid`, `probed`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); $statement->execute(array($scan, $ap, $mac, $first, $last, $power, $packets, $bssid, $probed)); return Client::fromDB($scan, $ap, $mac); }
$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 getClients($sort = "id", $order = "DESC") { $statement = $this->db->con()->prepare("SELECT * FROM `clients` WHERE `scan_id` = ? ORDER BY {$sort} {$order}"); $statement->execute(array($this->getID())); while ($info = $statement->fetchObject()) { $clients[] = Client::fromDB($info->scan_id, $info->ap_id, $info->mac); } return $clients; }