Skip to content

Commit

Permalink
Feature: #56: Combine CSVs in catagories
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedKamal1432 committed Oct 27, 2021
1 parent d47dbd3 commit 5ff6f7f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions Evilize.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ function Evilize {
else{
. .\LogParser\Logparser.ps1
}
merge_csvs
}
Evilize
38 changes: 38 additions & 0 deletions Helper/helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,41 @@ function GetStats {
Return 0
}
}


function __merge_csvs {
param (
[Parameter(Mandatory=$true)]
[string]$csvs_path,
[Parameter(Mandatory=$true)]
[string]$xlsx_name
)

$csvs = Get-ChildItem -Path $csvs_path\* -Include *.csv
$excelFileName = $Destination_Path + "\" + $xlsx_name
Remove-Item $excelFileName -ErrorAction Ignore
Write-Host "Creating: $excelFileName" -ForegroundColor Green

foreach ($csv in $csvs) {
$worksheetName = $csv.Name.Replace(".csv","")
Import-Csv -Path $csv.FullName| Export-Excel -Path $excelFileName -WorkSheetname $worksheetName
}
}

function merge_csvs {

if (Get-Module -ListAvailable -Name ImportExcel) {
Write-Host "Module exists"
}
else {
Write-Host "Module does not exist"
Install-Module ImportExcel -scope CurrentUser -Force
}
__merge_csvs $RemoteDesktop_Path "RemoteDesktop.xlsx"
__merge_csvs $MapNetworkShares_Path "MapNetworkShares.xlsx"
__merge_csvs $PsExec_Path "PsExec.xlsx"
__merge_csvs $ScheduledTasks_Path "ScheduledTasks.xlsx"
__merge_csvs $Services_Path "Services.xlsx"
__merge_csvs $WMIOut_Path "WMI.xlsx"
__merge_csvs $ExtraEvents_Path "ExtraEvents.xlsx"
}

0 comments on commit 5ff6f7f

Please sign in to comment.