Skip to content

Instantly share code, notes, and snippets.

View alexverboon's full-sized avatar

Alex Verboon alexverboon

View GitHub Profile
@alexverboon
alexverboon / T1053 - Scheduled Tasks.kql
Last active July 24, 2020 06:37
KQL - Scheduled Tasks
// define known tasks
let knowntasks = dynamic (["Windows Defender Cleanup",
"Windows Defender Scheduled Scan",
"Windows Defender Verification",
"Windows Defender Cache Maintenance",
@"\MicrosoftEdgeUpdateBrowserReplacementTask",
@"\MicrosoftEdgeUpdateTaskMachineUA",
@"\MicrosoftEdgeUpdateBrowserReplacementTask",
@"\MicrosoftEdgeUpdateTaskMachineCore",
@"\Microsoft\Windows\UpdateOrchestrator\MusUx_LogonUpdateResults",
@alexverboon
alexverboon / New-KQPSModuleFunctions.ps1
Created July 10, 2020 22:50
Generate KQL with PowerShell
function New-KQPSModuleFunctions
{
<#
.Synopsis
New-KQPSModulecmdlets
.DESCRIPTION
New-KQPSModulecmdlets creates kusto query to search for PowerShell commands
included in the specified PowerShell module name
.PARAMETER ModuleName
The name of the PowerShell module
@alexverboon
alexverboon / T1089 - Disabling Security Tools - sc.kql
Created May 31, 2020 11:13
T1089 - Disabling Security Tools - using sc
// T1089 - Disabling Security Tools
// https://attack.mitre.org/techniques/T1089/
search in (DeviceProcessEvents)
FileName == "sc.exe"
| where ProcessCommandLine has_any ("stop Wuauserv","stop WinDefend","stop wscsvc","stop mpssvc" ,"stop Sense","stop WdNisSvc","stop DiagTrack","stop gpsvc")
| extend SecurityTool = iff(ProcessCommandLine contains "stop wuauserv","Windows Update"
,iff(ProcessCommandLine contains "stop WinDefend","Windows Defender",iff(ProcessCommandLine contains "stop wscsvc", "Defender Security Center"
,iff(ProcessCommandLine contains "stop mpssvc","Defender Firewall",iff(ProcessCommandLine contains "stop WdNisSvc","Defender Antivirus Network Inspection"
,iff(ProcessCommandLine contains "stop diagtrack","Telemetry",iff(ProcessCommandLine contains "stop gpsvc","Group Policy"
# Check if Hawk is installed
If(!(Get-Module "Hawk"))
{
Install-Module -Name "Hawk" -scope CurrentUser
}
Else
{
Write-Output "Hawk Module is already installed"
}
Write-host "I was just downloaded"
Function RunMe{
Param(
$Param1
)
write-host "And executed with $Param1"
pause
}
Write-host "I was just downloaded"
Param(
$Param1
)
write-host "And executed with $Param1"
pause
Write-host "I was just downloaded"
@alexverboon
alexverboon / Start-MDATPAnalyzer.ps1
Created March 23, 2020 21:23
Start-MDATPAnalyzer
Function Start-MDATPAnalyzer{
<#
.Synopsis
Start-MDATPAnalyzer
.DESCRIPTION
Start-MDATPAnalyzer downloads and then runs the Microsoft Defender Connectivity Analyzer tool referenced here:
https://docs.microsoft.com/en-us/windows/security/threat-protection/microsoft-defender-atp/configure-proxy-internet#verify-client-connectivity-to-microsoft-defender-atp-service-urls
.PARAMETER TargetPath
Location where MDATP Analyzer will be downloaded and executed from.
.NOTES
@alexverboon
alexverboon / Validate-DkimConfig.ps1
Created March 23, 2020 19:56
Validate-DkimConfig
function Validate-DkimConfig
{
[cmdletbinding()]
Param(
[parameter(Mandatory=$false)]
[string]$domain,
[parameter(Mandatory=$false)]
[switch]$showAll
)
@alexverboon
alexverboon / Get-AzMFADeploymentStats.ps1
Created March 17, 2020 17:41
Get-AzMFADeploymentStats
function Get-AzMFADeploymentStats
<#
.Synopsis
Get-AzMFADeploymentStats
.DESCRIPTION
Get-AzMFADeploymentStats retrieves the MFA registration information from all users in the
Tenant and summarizes the results by MFA Authentication mode.
.EXAMPLE
Get-AzMFADeploymentStats