mirror of
https://github.com/GTFOBins/GTFOBins.github.io
synced 2024-12-26 14:59:44 +01:00
Allow to filter by function
This commit is contained in:
parent
344209b99c
commit
13ec00ddb5
@ -1,4 +1,4 @@
|
|||||||
<input id="bin-search" type="text" placeholder="Filter by name, just start typing..."/>
|
<input id="bin-search" type="text" placeholder="Filter binaries by name (e.g., 'ftp') or by function (e.g., '/shell')"/>
|
||||||
|
|
||||||
<div id="bin-table-wrapper">
|
<div id="bin-table-wrapper">
|
||||||
<table id="bin-table">
|
<table id="bin-table">
|
||||||
@ -33,11 +33,19 @@
|
|||||||
|
|
||||||
searchBox.addEventListener('input', function () {
|
searchBox.addEventListener('input', function () {
|
||||||
var query = searchBox.value.toLowerCase().trim();
|
var query = searchBox.value.toLowerCase().trim();
|
||||||
|
var queryType = query[0];
|
||||||
var noResults = true;
|
var noResults = true;
|
||||||
|
|
||||||
|
if (queryType === '/') {
|
||||||
|
query = query.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
document.querySelectorAll('#bin-table tbody tr').forEach(function (row) {
|
document.querySelectorAll('#bin-table tbody tr').forEach(function (row) {
|
||||||
var binName = row.firstElementChild.firstElementChild.innerText;
|
var binName = row.children[0].firstElementChild.innerText.toLowerCase();
|
||||||
if (binName.indexOf(query) !== -1) {
|
var functions = row.children[1].firstElementChild.innerText.toLowerCase();
|
||||||
|
var against = (queryType === '/' ? functions : binName);
|
||||||
|
|
||||||
|
if (against.indexOf(query) !== -1) {
|
||||||
row.style.display = '';
|
row.style.display = '';
|
||||||
noResults = false;
|
noResults = false;
|
||||||
} else {
|
} else {
|
||||||
@ -49,7 +57,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
addEventListener('keydown', function (event) {
|
addEventListener('keydown', function (event) {
|
||||||
if (event.key.toLowerCase().match(/^[a-z]$/)) {
|
if (event.key.toLowerCase().match(/^[\/a-z]$/)) {
|
||||||
searchBox.focus();
|
searchBox.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user