diff --git a/api_FTL.php b/api_FTL.php index 85ee3f8a..85227dd7 100644 --- a/api_FTL.php +++ b/api_FTL.php @@ -288,6 +288,11 @@ else // Get specific domain only sendRequestFTL("getallqueries-domain ".$_GET['domain']); } + else if(isset($_GET['client']) && (isset($_GET['type']) && $_GET['type'] === "blocked")) + { + // Get specific client only + sendRequestFTL("getallqueries-client-blocked ".$_GET['client']); + } else if(isset($_GET['client'])) { // Get specific client only @@ -411,6 +416,13 @@ else $data = array_merge($data, $result); } + if (isset($_GET['delete_lease']) && $auth) + { + sendRequestFTL("delete-lease ".$_GET['delete_lease']); + $return = getResponseFTL(); + $data["delete_lease"] = $return[0]; + } + disconnectFTL(); } ?> diff --git a/api_db.php b/api_db.php index 6203d5d1..49270671 100644 --- a/api_db.php +++ b/api_db.php @@ -62,18 +62,27 @@ if(isset($_GET["network"]) && $auth) while($results !== false && $res = $results->fetchArray(SQLITE3_ASSOC)) { - $id = $res["id"]; - // Empty array for holding the IP addresses + $id = intval($res["id"]); + + // Get IP addresses and host names for this device $res["ip"] = array(); - // Get IP addresses for this device - $network_addresses = $db->query("SELECT ip FROM network_addresses WHERE network_id = $id ORDER BY lastSeen DESC"); - while($network_addresses !== false && $ip = $network_addresses->fetchArray(SQLITE3_ASSOC)) - array_push($res["ip"],$ip["ip"]); - // UTF-8 encode host name and vendor - $res["name"] = utf8_encode($res["name"]); + $res["name"] = array(); + $network_addresses = $db->query("SELECT ip,name FROM network_addresses WHERE network_id = $id ORDER BY lastSeen DESC"); + while($network_addresses !== false && $network_address = $network_addresses->fetchArray(SQLITE3_ASSOC)) + { + array_push($res["ip"],$network_address["ip"]); + if($network_address["name"] !== null) + array_push($res["name"],utf8_encode($network_address["name"])); + else + array_push($res["name"],""); + } + $network_addresses->finalize(); + + // UTF-8 encode vendor $res["macVendor"] = utf8_encode($res["macVendor"]); array_push($network, $res); } + $results->finalize(); $data = array_merge($data, array('network' => $network)); } @@ -85,7 +94,7 @@ if (isset($_GET['getAllQueries']) && $auth) { $from = intval($_GET["from"]); $until = intval($_GET["until"]); - $dbquery = "SELECT timestamp, type, domain, client, status FROM queries WHERE timestamp >= :from AND timestamp <= :until "; + $dbquery = "SELECT timestamp, type, domain, client, status, forward FROM queries WHERE timestamp >= :from AND timestamp <= :until "; if(isset($_GET["types"])) { $types = $_GET["types"]; @@ -144,8 +153,8 @@ if (isset($_GET['getAllQueries']) && $auth) $query_type = "UNKN"; break; } - // array: time type domain client status - $allQueries[] = [$row[0], $query_type, utf8_encode($row[2]), utf8_encode($c), $row[4]]; + // array: time type domain client status upstream destination + $allQueries[] = [$row[0], $query_type, utf8_encode($row[2]), utf8_encode($c), $row[4], utf8_encode($row[5])]; } } $result = array('data' => $allQueries); diff --git a/auditlog.php b/auditlog.php index 64bf3efb..895dc581 100644 --- a/auditlog.php +++ b/auditlog.php @@ -72,8 +72,8 @@ - - + + + + +
+
+
| Domain | +Target | +Action | +
|---|
You can select an existing client or add a custom one by typing into the field above and confirming your entry with ⏎.
+Clients may be described either by their IP addresses (IPv4 and IPv6 are supported),
+ IP subnets (CIDR notation, like 192.168.2.0/24),
+ their MAC addresses (like 12:34:56:78:9A:BC),
+ by their hostnames (like localhost), or by the interface they are connected to (prefaced with a colon, like :eth0).
Note that client recognition by IP addresses (incl. subnet ranges) are prefered over MAC address, host name or interface recognition as + the two latter will only be available after some time. + Furthermore, MAC address recognition only works for devices at most one networking hop away from your Pi-hole.
+