mirror of
https://github.com/NetSPI/PowerHuntShares.git
synced 2025-05-05 03:38:42 +02:00
Update Analyze-HuntSMBShares.ps1
Keeping in sync with the primary script.
This commit is contained in:
parent
efc57d864c
commit
b47607e6cd
@ -5,7 +5,7 @@
|
|||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
# Author: Scott Sutherland, 2024 NetSPI
|
# Author: Scott Sutherland, 2024 NetSPI
|
||||||
# License: 3-clause BSD
|
# License: 3-clause BSD
|
||||||
# Version: v1.30
|
# Version: v1.31
|
||||||
# References: This script includes custom code and code taken and modified from the open source projects PowerView, Invoke-Ping, and Invoke-Parrell.
|
# References: This script includes custom code and code taken and modified from the open source projects PowerView, Invoke-Ping, and Invoke-Parrell.
|
||||||
function Analyze-HuntSMBShares
|
function Analyze-HuntSMBShares
|
||||||
{
|
{
|
||||||
@ -5547,14 +5547,21 @@ function updateChart() {
|
|||||||
|
|
||||||
|
|
||||||
// --------------------------
|
// --------------------------
|
||||||
// Bar Chart Code - Interesting Files
|
// Interesting Files - Bar Chart
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
|
||||||
// Initialize ApexCharts
|
// Initialize ApexCharts
|
||||||
const chartOptions = {
|
const chartOptions = {
|
||||||
chart: {
|
chart: {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
height: 150
|
height: 150,
|
||||||
|
events: {
|
||||||
|
dataPointSelection: function(event, chartContext, config) {
|
||||||
|
// Get the clicked category
|
||||||
|
var category = config.w.config.xaxis.categories[config.dataPointIndex];
|
||||||
|
handleCategoryClick(category);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
series: [{
|
series: [{
|
||||||
name: 'Count',
|
name: 'Count',
|
||||||
@ -5626,6 +5633,13 @@ const chartOptions = {
|
|||||||
const chart = new ApexCharts(document.querySelector("#chart"), chartOptions);
|
const chart = new ApexCharts(document.querySelector("#chart"), chartOptions);
|
||||||
chart.render();
|
chart.render();
|
||||||
|
|
||||||
|
// apply category filter to interestiong table rows
|
||||||
|
function handleCategoryClick(category) {
|
||||||
|
//alert("Category clicked: " + category);
|
||||||
|
document.getElementById('filterInputIF').value = category;
|
||||||
|
applyFiltersAndSort('InterestingFileTable', 'filterInputIF', 'filterCounterIF', 'paginationIF',2);
|
||||||
|
}
|
||||||
|
|
||||||
// --------------------------
|
// --------------------------
|
||||||
// Sorting Functions
|
// Sorting Functions
|
||||||
// --------------------------
|
// --------------------------
|
||||||
@ -5684,7 +5698,7 @@ function updateSortIndicators(tableId, columnIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Filtering Function
|
// Filtering Function
|
||||||
function applyFiltersAndSort(tableId, searchInputId, filterCounterId, paginationId) {
|
function applyFiltersAndSort(tableId, searchInputId, filterCounterId, paginationId, columnId = null) {
|
||||||
const table = document.getElementById(tableId);
|
const table = document.getElementById(tableId);
|
||||||
const tbody = table.querySelector('tbody');
|
const tbody = table.querySelector('tbody');
|
||||||
const rows = Array.from(tbody.rows);
|
const rows = Array.from(tbody.rows);
|
||||||
@ -5699,7 +5713,9 @@ function applyFiltersAndSort(tableId, searchInputId, filterCounterId, pagination
|
|||||||
|
|
||||||
currentFilteredRows = rows.filter(row => { // Update filtered rows
|
currentFilteredRows = rows.filter(row => { // Update filtered rows
|
||||||
const cells = Array.from(row.cells);
|
const cells = Array.from(row.cells);
|
||||||
const matchesTextFilter = cells.some(cell => cell.innerText.toLowerCase().includes(filterInputValue));
|
const matchesTextFilter = columnId !== null
|
||||||
|
? cells[columnId].innerText.toLowerCase().includes(filterInputValue)
|
||||||
|
: cells.some(cell => cell.innerText.toLowerCase().includes(filterInputValue));
|
||||||
const matchesCheckboxFilter = checkedFilters.every(filter => row.getAttribute(filter) === "Yes");
|
const matchesCheckboxFilter = checkedFilters.every(filter => row.getAttribute(filter) === "Yes");
|
||||||
|
|
||||||
return matchesTextFilter && matchesCheckboxFilter;
|
return matchesTextFilter && matchesCheckboxFilter;
|
||||||
@ -5841,6 +5857,7 @@ applyFiltersAndSort('foldergrouptable', 'filterInputTwo', 'filterCounterTwo', 'p
|
|||||||
document.getElementById('filterInputIF').addEventListener("keyup", () => applyFiltersAndSort('InterestingFileTable', 'filterInputIF', 'filterCounterIF', 'paginationIF'));
|
document.getElementById('filterInputIF').addEventListener("keyup", () => applyFiltersAndSort('InterestingFileTable', 'filterInputIF', 'filterCounterIF', 'paginationIF'));
|
||||||
applyFiltersAndSort('InterestingFileTable', 'filterInputIF', 'filterCounterIF', 'paginationIF');
|
applyFiltersAndSort('InterestingFileTable', 'filterInputIF', 'filterCounterIF', 'paginationIF');
|
||||||
|
|
||||||
|
// CSV export function
|
||||||
function extractAndDownloadCSV(tableId, columnIndex) {
|
function extractAndDownloadCSV(tableId, columnIndex) {
|
||||||
const regex = /\\\\[^\s\\]+\\[^\s\\]+\\[^\s\\]+/g; // UNC path regex
|
const regex = /\\\\[^\s\\]+\\[^\s\\]+\\[^\s\\]+/g; // UNC path regex
|
||||||
const uncPaths = [];
|
const uncPaths = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user