Skip to content

vetementsvmnts/Powershell-Automation

Repository files navigation

β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—    β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—  β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—     β–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘    β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•  β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•  β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•‘     β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β•šβ•β•      β•šβ•β•β•β•β•β•  β•šβ•β•β•β•šβ•β•β• β•šβ•β•β•β•β•β•β•β•šβ•β•  β•šβ•β•β•šβ•β•β•β•β•β•β•β•šβ•β•  β•šβ•β•β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β•

⚑ Cybersecurity Automation β€” From Hardening to Hunting

PowerShell Platform License Maintenance PRs Welcome

Blue Team Red Team MITRE ATT&CK CIS Benchmarks


PowerShell automation toolkit for cybersecurity operations, built for technical and non-technical users. Automates security hardening, incident response, log analysis, and compliance checks. Includes beginner-friendly documentation and advanced scripting modules for blue-team and red-team tasks. Strengthen your security posture with confidence.


πŸ“‹ Table of Contents


✨ Overview

Powershell-Automation is a modular, extensible cybersecurity automation framework built entirely in PowerShell. Whether you're a seasoned penetration tester, a blue-team analyst, or an IT administrator stepping into security for the first time β€” this toolkit gives you the scripts, documentation, and workflows to operate with speed and precision.

Every module is built with two audiences in mind:

πŸ‘€ Non-Technical Users πŸ§‘β€πŸ’» Security Professionals
Plain-English step-by-step guides Full parameter control & pipeline support
Safe read-only modes by default SIEM integration & API hooks
Auto-generated HTML reports Custom rule sets & advanced filters
No prior PowerShell knowledge needed Extendable modular architecture

πŸš€ Features at a Glance

Module Capability Standards
πŸ”’ Security Hardening CIS Benchmark & STIG automated audits CIS L1/L2, STIG
🚨 Incident Response Containment, eradication & recovery workflows NIST SP 800-61
πŸ“Š Log Analysis Windows Event Logs, Sysmon, PowerShell transcript parsing MITRE ATT&CK
βœ… Compliance Checks Baseline audits with exportable reports NIST, PCI-DSS, ISO 27001
πŸ”΄ Red Team Enumeration, lateral movement simulation, password auditing MITRE ATT&CK TTPs
πŸ”΅ Blue Team Threat hunting, anomaly detection, IOC searching MITRE D3FEND
πŸ“ Reporting Auto-generate HTML/CSV/JSON security audit reports β€”
🧩 Modular Design Import only the modules you need β€”

βš™οΈ Prerequisites

Ensure the following before getting started:

βœ” PowerShell 5.1+  OR  PowerShell Core 7.x  (recommended)
βœ” Windows 10 / 11  OR  Windows Server 2016 / 2019 / 2022
βœ” Administrator / Elevated Privileges  (required for most modules)

Optional dependencies:

Check your PowerShell version:

$PSVersionTable.PSVersion

πŸ“¦ Installation

Option 1 β€” Clone via Git (Recommended)

git clone https://github.com/YourUsername/Powershell-Automation.git
cd Powershell-Automation

Option 2 β€” Download ZIP

  1. Click Code β†’ Download ZIP on this page
  2. Extract to a folder of your choice
  3. Open PowerShell as Administrator and navigate to the folder

Set Execution Policy

⚠️ Only apply this in a trusted, controlled environment.

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Import the Toolkit

Import-Module .\CyberSecToolkit.psm1

# Verify loaded modules
Get-Module CyberSecToolkit

πŸ—‚οΈ Module Structure

Powershell-Automation/
β”‚
β”œβ”€β”€ πŸ“ BlueTeam/                   # Detection, hunting & monitoring
β”‚   β”œβ”€β”€ Invoke-ThreatHunt.ps1
β”‚   β”œβ”€β”€ Get-SuspiciousProcesses.ps1
β”‚   β”œβ”€β”€ Watch-NetworkConnections.ps1
β”‚   └── Get-FailedLogons.ps1
β”‚
β”œβ”€β”€ πŸ“ RedTeam/                    # Authorized offensive testing
β”‚   β”œβ”€β”€ Invoke-Enumeration.ps1
β”‚   β”œβ”€β”€ Test-LateralMovement.ps1
β”‚   β”œβ”€β”€ Get-LocalPrivileges.ps1
β”‚   └── Invoke-PasswordAudit.ps1
β”‚
β”œβ”€β”€ πŸ“ Hardening/                  # System & policy hardening
β”‚   β”œβ”€β”€ Invoke-CISBenchmark.ps1
β”‚   β”œβ”€β”€ Set-SecureBaseline.ps1
β”‚   β”œβ”€β”€ Disable-LegacyProtocols.ps1
β”‚   └── Enable-AuditPolicies.ps1
β”‚
β”œβ”€β”€ πŸ“ IncidentResponse/           # IR workflows & forensics
β”‚   β”œβ”€β”€ Start-IRWorkflow.ps1
β”‚   β”œβ”€β”€ Invoke-Containment.ps1
β”‚   β”œβ”€β”€ Collect-ForensicData.ps1
β”‚   └── Export-IRReport.ps1
β”‚
β”œβ”€β”€ πŸ“ LogAnalysis/                # Log parsing & IOC detection
β”‚   β”œβ”€β”€ Parse-EventLogs.ps1
β”‚   β”œβ”€β”€ Analyze-SysmonLogs.ps1
β”‚   β”œβ”€β”€ Get-PowerShellHistory.ps1
β”‚   └── Find-IOCs.ps1
β”‚
β”œβ”€β”€ πŸ“ Compliance/                 # Regulatory baseline checks
β”‚   β”œβ”€β”€ Test-NISTBaseline.ps1
β”‚   β”œβ”€β”€ Test-PCIDSSControls.ps1
β”‚   └── Export-ComplianceReport.ps1
β”‚
β”œβ”€β”€ πŸ“ Docs/                       # Guides & references
β”‚   β”œβ”€β”€ BeginnerGuide.md
β”‚   β”œβ”€β”€ AdvancedScripting.md
β”‚   └── ModuleReference.md
β”‚
β”œβ”€β”€ πŸ“ Reports/                    # Auto-generated output reports
β”œβ”€β”€ CyberSecToolkit.psm1           # Main module manifest
└── README.md

🟒 Beginner Quick Start

No PowerShell experience? Follow these 5 steps and you'll be running your first security check in under 2 minutes.

Step 1 β€” Open PowerShell as Administrator

Start Menu β†’ Search "PowerShell" β†’ Right-click β†’ Run as Administrator

Step 2 β€” Navigate to the toolkit folder

cd C:\Path\To\Powershell-Automation

Step 3 β€” Import the toolkit

Import-Module .\CyberSecToolkit.psm1

Step 4 β€” Run your first check (safe, read-only)

# Check for failed login attempts in the last 24 hours
.\BlueTeam\Get-FailedLogons.ps1 -Hours 24

Step 5 β€” View your report

Results display in the terminal and are saved to .\Reports\ as an HTML file you can open in any browser.

πŸ’‘ Every script has built-in help. Just add -Help to any command:

.\BlueTeam\Get-FailedLogons.ps1 -Help

πŸ”§ Advanced Usage

All modules support pipeline input, custom parameters, verbose logging, and SIEM/API integration.

# Full CIS Level 1 Benchmark audit β€” exported as HTML
.\Hardening\Invoke-CISBenchmark.ps1 -Level 1 -ExportHTML -OutputPath "C:\Reports\CIS_Audit.html"

# Threat hunt mapped to MITRE ATT&CK T1059 (Command & Scripting Interpreter)
.\BlueTeam\Invoke-ThreatHunt.ps1 -IOC "mimikatz" -Scope EventLog,ProcessList,Network -MITREMap

# Full ransomware IR workflow with forensic collection
.\IncidentResponse\Start-IRWorkflow.ps1 -IncidentType Ransomware -AffectedHost WORKSTATION-01 -CollectForensics

# Pipeline: get suspicious processes and pipe results to IOC finder
.\BlueTeam\Get-SuspiciousProcesses.ps1 | .\LogAnalysis\Find-IOCs.ps1 -SearchScope All

πŸ”΅ Blue Team Modules

Get-FailedLogons.ps1

Queries Windows Security Event Log (Event ID 4625) for failed authentication attempts. Useful for detecting brute-force and password spray attacks.

.\BlueTeam\Get-FailedLogons.ps1 -Hours 48 -ExportCSV -Threshold 5

Get-SuspiciousProcesses.ps1

Identifies processes with anomalous parent-child relationships, unsigned binaries, or names matching known malicious patterns.

.\BlueTeam\Get-SuspiciousProcesses.ps1 -CheckSignatures -CompareBaseline

Watch-NetworkConnections.ps1

Monitors live network connections and flags traffic to known malicious IPs using a local or remote threat intel feed.

.\BlueTeam\Watch-NetworkConnections.ps1 -ThreatFeed .\Data\malicious_ips.txt -Interval 30

Invoke-ThreatHunt.ps1

Structured threat hunting across event logs, processes, registry keys, and network artifacts β€” mapped to MITRE ATT&CK playbooks.

.\BlueTeam\Invoke-ThreatHunt.ps1 -Playbook MITRE_T1059 -Verbose

πŸ”΄ Red Team Modules

🚨 AUTHORIZED USE ONLY. These modules must only be run on systems you own or have explicit written permission to test. Unauthorized use is illegal. See Disclaimer.

Invoke-Enumeration.ps1

Local and domain enumeration β€” users, groups, shares, services, and scheduled tasks.

.\RedTeam\Invoke-Enumeration.ps1 -Target localhost -Scope Full

Test-LateralMovement.ps1

Simulates lateral movement paths via WMI, PsExec, and WinRM to identify over-permissioned accounts and exposed attack paths.

.\RedTeam\Test-LateralMovement.ps1 -TargetHost 192.168.1.50 -Method WinRM

Get-LocalPrivileges.ps1

Identifies local privilege escalation vectors including weak service permissions, unquoted paths, and token abuse opportunities.

.\RedTeam\Get-LocalPrivileges.ps1 -CheckAll

Invoke-PasswordAudit.ps1

Tests password policies and checks active accounts against configurable wordlists to identify weak credentials.

.\RedTeam\Invoke-PasswordAudit.ps1 -WordList .\Data\common_passwords.txt -Domain CORP

πŸ›‘οΈ Compliance & Hardening

Run a CIS Benchmark Audit

# Level 1 β€” Basic (most environments)
.\Hardening\Invoke-CISBenchmark.ps1 -Level 1

# Level 2 β€” Strict (high-security environments)
.\Hardening\Invoke-CISBenchmark.ps1 -Level 2 -ExportHTML

Apply Secure Baseline

# Always preview with -WhatIf first
.\Hardening\Set-SecureBaseline.ps1 -WhatIf

# Apply after review
.\Hardening\Set-SecureBaseline.ps1 -Confirm

Disable Legacy Protocols

# Disables SMBv1, TLS 1.0/1.1, RC4, and weak cipher suites
.\Hardening\Disable-LegacyProtocols.ps1 -All

Enable Recommended Audit Policies

.\Hardening\Enable-AuditPolicies.ps1 -Preset Recommended

🚨 Incident Response

Launch a Full IR Workflow

.\IncidentResponse\Start-IRWorkflow.ps1 -IncidentType Malware -AffectedHost WORKSTATION-01

The workflow automatically executes:

[1] Notify analyst via console prompt
[2] Isolate affected host          ← requires confirmation
[3] Collect volatile data          (processes, connections, memory artifacts)
[4] Pull Windows Event Logs        (Security, System, Application)
[5] Package all evidence           β†’ timestamped ZIP
[6] Generate IR report             β†’ HTML + JSON

Collect Forensic Data Only

.\IncidentResponse\Collect-ForensicData.ps1 -Host WORKSTATION-01 -OutputPath C:\IR\Evidence\

Isolate a Host (Containment)

.\IncidentResponse\Invoke-Containment.ps1 -Host WORKSTATION-01 -Method NetworkIsolation

πŸ“Š Log Analysis

Parse Windows Event Logs

# Logon events + failures over 7 days
.\LogAnalysis\Parse-EventLogs.ps1 -EventID 4624,4625,4648 -Days 7 -ExportCSV

Analyze Sysmon Logs

# Filter for suspicious network connections and process creations
.\LogAnalysis\Analyze-SysmonLogs.ps1 -Filter NetworkConnect,ProcessCreate -Suspicious

Retrieve PowerShell Command History

# Pull all users' PSReadLine history and transcript logs
.\LogAnalysis\Get-PowerShellHistory.ps1 -AllUsers -IncludeTranscripts

Find Indicators of Compromise

# Search across all log sources for known IOCs
.\LogAnalysis\Find-IOCs.ps1 -IOCFile .\Data\iocs.csv -SearchScope All -ExportReport

🀝 Contributing

Contributions are welcome β€” new detection scripts, improved documentation, bug fixes, and hardening rules all strengthen the community toolkit.

1. Fork the repository
2. git checkout -b feature/your-module-name
3. git commit -m "Add: description of what you added"
4. git push origin feature/your-module-name
5. Open a Pull Request

Script standards for contributions:

  • All scripts must include comment-based help (Get-Help compatible)
  • Follow PowerShell Approved Verbs
  • Include at least one usage example per script
  • Red team scripts must include an authorization warning at runtime

⚠️ Disclaimer

This toolkit is intended strictly for authorized security testing, research, and educational purposes.

Unauthorized use of any offensive modules against systems you do not own or have explicit written authorization to test is illegal under the Computer Fraud and Abuse Act (CFAA), the Computer Misuse Act (CMA), and equivalent legislation worldwide.

The authors and contributors of this toolkit accept no liability for any misuse, damage, or legal consequences arising from unauthorized use. Always operate within legal and ethical boundaries.


πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for full details.



Built for defenders. Sharpened by attackers. Trusted by both.


GitHub Stars GitHub Forks GitHub Issues

⭐ Star this repo if it helped you Β |Β  πŸ› Report a Bug Β |Β  πŸ’‘ Request a Feature Β |Β  πŸ’¬ Discussions

About

PowerShell automation toolkit for cybersecurity operations, built for technical and non-technical users. Automates security hardening, incident response, log analysis, and compliance checks. Includes beginner-friendly documentation and advanced scripting modules for blue-team and red-team tasks. Strengthen your security posture with confidence.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors