Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SMAPPER committed Nov 29, 2018
1 parent 013f31f commit 4f8e527
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions Binaries/readme.txt
@@ -0,0 +1 @@
This folder needs to contain any binaries necessary for specific Campaigns. As an example, the ARPCache module requires autorunsc.exe and autorunsc64.exe.
21 changes: 21 additions & 0 deletions Modules/ARPCache.ps1
@@ -0,0 +1,21 @@
# Identifies changes to the default gateway's ARP cache [Forces: diff]
function Campaign-ARPCache {
if(Test-Path -Path "$OutputDirectory\arpcache.txt"){
$previous_mac = Get-Content -Path "$OutputDirectory\arpcache.txt"
$previous_mac = [regex]::match($previous_mac,'([0-9a-fA-F]{2}[:-]){5}([0-9a-fA-F]{2})').Groups[0].Value
} else {
$previous_mac = ""
}
$gateway = Get-Gateway
$output = (arp -a | findstr $gateway) | Out-String
$mac = [regex]::match($output,'([0-9a-fA-F]{2}[:-]){5}([0-9a-fA-F]{2})').Groups[0].Value
if($previous_mac -eq ""){
$mac | Out-File "$OutputDirectory\arpcache.txt"
} else {
if($mac -ne $previous_mac){
Generate-Log $Campaign 1 "MAC address of default gateway has changed - Possible ARP Cache Poisoning attack"
} elseif ($AlwaysOutput){
Generate-Log $Campaign 0 "Gateway MAC address has not changed"
}
}
}
39 changes: 39 additions & 0 deletions Modules/Autoruns.ps1
@@ -0,0 +1,39 @@
# Runs Microsoft Sysinternals Autoruns and logs results [Supports: diff]. Has prerequisite
# Prerequisite - You must have autorunsc.exe downloaded and in the binary folder
function Campaign-Autoruns {
if($script:Architecture -eq "AMD64"){
$path = "$script:LogCampaignDirectory\Binaries\autorunsc64.exe"
} else {
$path = "$script:LogCampaignDirectory\Binaries\autorunsc.exe"
}
$script:OutputDirectory = "E:\Dropbox\Dropbox\SEC555\scripts\log_campaign"
if(Test-Path -Path $path){
#Remove-Item -Force -Path "$script:OutputDirectory\autoruns.csv.old" -ErrorAction SilentlyContinue | Out-Null
if(Test-Path -Path "$script:OutputDirectory\autoruns.csv"){
Move-Item -Force -Path "$script:OutputDirectory\autoruns.csv" -Destination "$script:OutputDirectory\autoruns.csv.old"
$PreviousAutoruns = Import-Csv -Path "$script:OutputDirectory\autoruns.csv.old" -Delimiter "`t"
}
& $path "-ct" "-o" "$script:OutputDirectory\autoruns.csv" "-h" "-s" "-t"
$CurrentAutoruns = Import-Csv -Path "$script:OutputDirectory\autoruns.csv" -Delimiter "`t"
if($script:Diff){
$content = Compare-Object -ReferenceObject $CurrentAutoruns -DifferenceObject $PreviousAutoruns -PassThru | Where-Object { $_.SideIndicator -eq '<=' }
} else {
$content = $CurrentAutoruns
}
foreach($record in $content){
$record.PSObject.Properties.Remove('SideIndicator')
if($script:LogType -eq "text"){
$Log = $record | ConvertTo-Csv -Delimiter "`t"
}
if($script:LogType -eq "json"){
$Log = $record | ConvertTo-Json -Compress
}
if($Debug){
$Log
}
Generate-Log "Autoruns" 0 $Log
}
} else {
Write-Host "autorunsc.exe not found in Binaries folder. Unable to run campaign"
}
}
8 changes: 8 additions & 0 deletions Modules/MultipleGateways.ps1
@@ -0,0 +1,8 @@
# Identifies if a device has more than one gateway
function Campaign-MultipleGateways {
if((Get-Gateway).Count -ge 2){
Generate-Log $Campaign 1 "Multiple default routes found - Possible dual-homed device found"
} elseif ($AlwaysOutput){
Generate-Log $Campaign 0 "Device does not have multiple default routes"
}
}

0 comments on commit 4f8e527

Please sign in to comment.