Update public source
This commit is contained in:
+47
-8
@@ -1018,6 +1018,11 @@ def build_search_data(
|
||||
)
|
||||
)
|
||||
|
||||
handshake_count = sum(
|
||||
len(items)
|
||||
for items in handshakes.values()
|
||||
)
|
||||
|
||||
matching_vendors = (
|
||||
get_matching_vendors(
|
||||
conn,
|
||||
@@ -1037,6 +1042,7 @@ def build_search_data(
|
||||
password_access_points,
|
||||
"handshake_access_points":
|
||||
handshake_access_points,
|
||||
"handshake_count": handshake_count,
|
||||
"hash_count": len(hashes),
|
||||
"matching_vendors":
|
||||
matching_vendors,
|
||||
@@ -1231,7 +1237,7 @@ def render_search_page(
|
||||
class="button"
|
||||
disabled
|
||||
>
|
||||
Export hashes
|
||||
Экспорт в CrackLab
|
||||
</button>
|
||||
|
||||
</div>
|
||||
@@ -1828,18 +1834,51 @@ def render_search_page(
|
||||
|
||||
exportButton.addEventListener(
|
||||
"click",
|
||||
() => {
|
||||
async () => {
|
||||
|
||||
if (!searchParams) {
|
||||
return;
|
||||
}
|
||||
|
||||
const url =
|
||||
"/reports/search/export?"
|
||||
+
|
||||
searchParams.toString();
|
||||
exportButton.disabled = true;
|
||||
|
||||
window.location.href = url;
|
||||
try {
|
||||
|
||||
const response = await fetch(
|
||||
"/reports/search/cracklab",
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type":
|
||||
"application/x-www-form-urlencoded"
|
||||
},
|
||||
body: searchParams.toString()
|
||||
}
|
||||
);
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
data.error || "CrackLab export failed."
|
||||
);
|
||||
}
|
||||
|
||||
if (!data.redirect_url) {
|
||||
throw new Error(
|
||||
"CrackLab did not return a destination URL."
|
||||
);
|
||||
}
|
||||
|
||||
window.location.href = data.redirect_url;
|
||||
|
||||
} catch (error) {
|
||||
|
||||
setStatus(error.message);
|
||||
|
||||
exportButton.disabled = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
@@ -2041,7 +2080,7 @@ def render_search_page(
|
||||
}
|
||||
|
||||
exportButton.disabled =
|
||||
data.hash_count === 0;
|
||||
data.handshake_count === 0;
|
||||
|
||||
createMap(
|
||||
data.geojson
|
||||
|
||||
Reference in New Issue
Block a user