1
0
Fork 0
mirror of https://github.com/GTFOBins/GTFOBins.github.io.git synced 2024-06-03 13:06:02 +02:00
GTFOBins.github.io/_includes/bin_table.html
2018-05-23 21:43:23 +02:00

67 lines
1.9 KiB
HTML

<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">
<table id="bin-table">
<thead>
<tr>
<th>Binary</th>
<th>Functions</th>
</tr>
</thead>
<tbody>
{% for file in site.gtfobins %}
<tr>
<td><a href="{{ file.url }}" class="bin-name">{% include get_bin_name path=file.path %}</a></td>
<td>{% include function_list.html bin=file %}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr><td id="search-message" colspan="2">No binary matches...</td></tr>
</tfoot>
</table>
</div>
<script>
var searchBox = document.querySelector('#bin-search');
var searchMessage = document.querySelector('#search-message');
searchMessage.style.display = 'none';
// ensure height during filtering
var binTableWrapper = document.querySelector('#bin-table-wrapper');
binTableWrapper.style.height = binTableWrapper.clientHeight + 'px';
searchBox.addEventListener('input', function () {
var query = searchBox.value.toLowerCase().trim();
var queryType = query[0];
var noResults = true;
if (queryType === '/') {
query = query.slice(1);
}
document.querySelectorAll('#bin-table tbody tr').forEach(function (row) {
var binName = row.children[0].firstElementChild.innerText.toLowerCase();
var functions = row.children[1].firstElementChild.innerText.toLowerCase();
var against = (queryType === '/' ? functions : binName);
if (against.indexOf(query) !== -1) {
row.style.display = '';
noResults = false;
} else {
row.style.display = 'none';
}
});
searchMessage.style.display = noResults ? '' : 'none';
});
addEventListener('keydown', function (event) {
if (event.key.toLowerCase().match(/^[\/a-z]$/) &&
!(event.ctrlKey || event.altKey || event.metaKey)) {
searchBox.focus();
}
});
</script>