Update public source
This commit is contained in:
+16
@@ -1856,6 +1856,14 @@ def reports_search_data():
|
|||||||
vendor=request.args.get(
|
vendor=request.args.get(
|
||||||
"vendor",
|
"vendor",
|
||||||
""
|
""
|
||||||
|
),
|
||||||
|
essid=request.args.get(
|
||||||
|
"essid",
|
||||||
|
""
|
||||||
|
),
|
||||||
|
bssid=request.args.get(
|
||||||
|
"bssid",
|
||||||
|
""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1904,6 +1912,14 @@ def reports_search_cracklab():
|
|||||||
vendor=request.form.get(
|
vendor=request.form.get(
|
||||||
"vendor",
|
"vendor",
|
||||||
""
|
""
|
||||||
|
),
|
||||||
|
essid=request.form.get(
|
||||||
|
"essid",
|
||||||
|
""
|
||||||
|
),
|
||||||
|
bssid=request.form.get(
|
||||||
|
"bssid",
|
||||||
|
""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+149
-27
@@ -27,14 +27,21 @@ MAP_STYLE_URL = (
|
|||||||
|
|
||||||
def normalize_criteria(
|
def normalize_criteria(
|
||||||
vendor=None,
|
vendor=None,
|
||||||
|
essid=None,
|
||||||
|
bssid=None,
|
||||||
):
|
):
|
||||||
criteria = {}
|
criteria = {}
|
||||||
|
|
||||||
if vendor is not None:
|
for key, value in (
|
||||||
vendor = str(vendor).strip()
|
("vendor", vendor),
|
||||||
|
("essid", essid),
|
||||||
|
("bssid", bssid),
|
||||||
|
):
|
||||||
|
if value is not None:
|
||||||
|
value = str(value).strip()
|
||||||
|
|
||||||
if vendor:
|
if value:
|
||||||
criteria["vendor"] = vendor
|
criteria[key] = value
|
||||||
|
|
||||||
return criteria
|
return criteria
|
||||||
|
|
||||||
@@ -103,6 +110,56 @@ def build_where_clause(criteria):
|
|||||||
vendor
|
vendor
|
||||||
)
|
)
|
||||||
|
|
||||||
|
essid = criteria.get("essid")
|
||||||
|
|
||||||
|
if essid:
|
||||||
|
conditions.append(
|
||||||
|
"""
|
||||||
|
LOWER(
|
||||||
|
COALESCE(ap.essid, '')
|
||||||
|
) LIKE '%' || LOWER(?) || '%'
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
parameters.append(
|
||||||
|
essid
|
||||||
|
)
|
||||||
|
|
||||||
|
bssid = criteria.get("bssid")
|
||||||
|
|
||||||
|
if bssid:
|
||||||
|
conditions.append(
|
||||||
|
"""
|
||||||
|
LOWER(
|
||||||
|
REPLACE(
|
||||||
|
REPLACE(
|
||||||
|
COALESCE(ap.bssid, ''),
|
||||||
|
':',
|
||||||
|
''
|
||||||
|
),
|
||||||
|
'-',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) LIKE '%' ||
|
||||||
|
LOWER(
|
||||||
|
REPLACE(
|
||||||
|
REPLACE(
|
||||||
|
?,
|
||||||
|
':',
|
||||||
|
''
|
||||||
|
),
|
||||||
|
'-',
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) ||
|
||||||
|
'%'
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
parameters.append(
|
||||||
|
bssid
|
||||||
|
)
|
||||||
|
|
||||||
if not conditions:
|
if not conditions:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"At least one search criterion is required."
|
"At least one search criterion is required."
|
||||||
@@ -1138,7 +1195,7 @@ def render_search_page(
|
|||||||
<section class="card search-card">
|
<section class="card search-card">
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
Search by Vendor
|
Search Access Points
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
@@ -1146,6 +1203,10 @@ def render_search_page(
|
|||||||
class="search-form"
|
class="search-form"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<div class="search-fields">
|
||||||
|
|
||||||
|
<div class="search-field">
|
||||||
|
|
||||||
<label
|
<label
|
||||||
for="search-vendor"
|
for="search-vendor"
|
||||||
class="search-label"
|
class="search-label"
|
||||||
@@ -1153,8 +1214,6 @@ def render_search_page(
|
|||||||
Vendor
|
Vendor
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="search-input-row">
|
|
||||||
|
|
||||||
<input
|
<input
|
||||||
id="search-vendor"
|
id="search-vendor"
|
||||||
name="vendor"
|
name="vendor"
|
||||||
@@ -1164,6 +1223,52 @@ def render_search_page(
|
|||||||
placeholder="e.g. Intel Corporation"
|
placeholder="e.g. Intel Corporation"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="search-field">
|
||||||
|
|
||||||
|
<label
|
||||||
|
for="search-essid"
|
||||||
|
class="search-label"
|
||||||
|
>
|
||||||
|
ESSID
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input
|
||||||
|
id="search-essid"
|
||||||
|
name="essid"
|
||||||
|
type="text"
|
||||||
|
class="search-input"
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder="e.g. MyWiFi"
|
||||||
|
>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="search-field">
|
||||||
|
|
||||||
|
<label
|
||||||
|
for="search-bssid"
|
||||||
|
class="search-label"
|
||||||
|
>
|
||||||
|
BSSID
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input
|
||||||
|
id="search-bssid"
|
||||||
|
name="bssid"
|
||||||
|
type="text"
|
||||||
|
class="search-input"
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder="e.g. 00:11:22:33:44:55"
|
||||||
|
>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="search-input-row">
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="button"
|
class="button"
|
||||||
@@ -1192,19 +1297,6 @@ def render_search_page(
|
|||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="card search-card search-future">
|
|
||||||
|
|
||||||
<h2>
|
|
||||||
Search by Access Point
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<div class="search-future-content">
|
|
||||||
Reserved for future search criteria:
|
|
||||||
ESSID, BSSID and other access point attributes.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section
|
<section
|
||||||
id="search-results"
|
id="search-results"
|
||||||
class="card search-card search-results"
|
class="card search-card search-results"
|
||||||
@@ -1336,6 +1428,14 @@ def render_search_page(
|
|||||||
"search-vendor"
|
"search-vendor"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const essidInput = document.getElementById(
|
||||||
|
"search-essid"
|
||||||
|
);
|
||||||
|
|
||||||
|
const bssidInput = document.getElementById(
|
||||||
|
"search-bssid"
|
||||||
|
);
|
||||||
|
|
||||||
const results = document.getElementById(
|
const results = document.getElementById(
|
||||||
"search-results"
|
"search-results"
|
||||||
);
|
);
|
||||||
@@ -1890,13 +1990,22 @@ def render_search_page(
|
|||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
const vendor =
|
const criteria = {
|
||||||
vendorInput.value.trim();
|
vendor: vendorInput.value.trim(),
|
||||||
|
essid: essidInput.value.trim(),
|
||||||
|
bssid: bssidInput.value.trim()
|
||||||
|
};
|
||||||
|
|
||||||
if (!vendor) {
|
const activeCriteria = Object.entries(
|
||||||
|
criteria
|
||||||
|
).filter(
|
||||||
|
([key, value]) => value
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!activeCriteria.length) {
|
||||||
|
|
||||||
setStatus(
|
setStatus(
|
||||||
"Enter a vendor name."
|
"Enter at least one search criterion."
|
||||||
);
|
);
|
||||||
|
|
||||||
query.textContent = "";
|
query.textContent = "";
|
||||||
@@ -1908,6 +2017,8 @@ def render_search_page(
|
|||||||
|
|
||||||
exportButton.disabled = true;
|
exportButton.disabled = true;
|
||||||
|
|
||||||
|
searchParams = null;
|
||||||
|
|
||||||
if (map) {
|
if (map) {
|
||||||
map.remove();
|
map.remove();
|
||||||
map = null;
|
map = null;
|
||||||
@@ -1923,10 +2034,21 @@ def render_search_page(
|
|||||||
searchParams =
|
searchParams =
|
||||||
new URLSearchParams();
|
new URLSearchParams();
|
||||||
|
|
||||||
|
activeCriteria.forEach(
|
||||||
|
([key, value]) => {
|
||||||
searchParams.set(
|
searchParams.set(
|
||||||
"vendor",
|
key,
|
||||||
vendor
|
value
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const queryDescription = activeCriteria
|
||||||
|
.map(
|
||||||
|
([key, value]) =>
|
||||||
|
key.toUpperCase() + ": " + value
|
||||||
|
)
|
||||||
|
.join(" | ");
|
||||||
|
|
||||||
results.hidden = false;
|
results.hidden = false;
|
||||||
|
|
||||||
@@ -1960,7 +2082,7 @@ def render_search_page(
|
|||||||
|
|
||||||
query.textContent =
|
query.textContent =
|
||||||
"Query: " +
|
"Query: " +
|
||||||
vendor;
|
queryDescription;
|
||||||
|
|
||||||
setStatus(
|
setStatus(
|
||||||
"Matched "
|
"Matched "
|
||||||
|
|||||||
@@ -972,6 +972,28 @@ code {
|
|||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-fields {
|
||||||
|
display: grid;
|
||||||
|
|
||||||
|
grid-template-columns:
|
||||||
|
repeat(3, minmax(0, 1fr));
|
||||||
|
|
||||||
|
gap: 16px;
|
||||||
|
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.search-field {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.search-field .search-input {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
.search-label {
|
.search-label {
|
||||||
display: block;
|
display: block;
|
||||||
@@ -1455,6 +1477,10 @@ code {
|
|||||||
|
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
|
|
||||||
|
.search-fields {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
.search-input-row {
|
.search-input-row {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user