Repository navigation
Development
How to build, test, extend and release WinSecHunter 2.1.0.
| Tool | Version | Purpose |
|---|---|---|
| PowerShell | 7.6+ (pwsh) |
module runtime and gates |
| Pester | 5.4+ | unit tests |
| PSScriptAnalyzer | 1.25+ | static analysis |
Install-Module Pester -MinimumVersion 5.4 -Scope CurrentUser -SkipPublisherCheck
Install-Module PSScriptAnalyzer -Scope CurrentUsersrc/WinSecHunter/
βββ WinSecHunter.psd1 manifest β export allow-list mirrored in the psm1
βββ WinSecHunter.psm1 loader: Enums β Classes β Private β Public
βββ WinSecHunter.Format.ps1xml table/list views
βββ Enums/WinSecEnums.ps1
βββ Classes/ WinSecEvent, WinSecModel (case, sessions, findings, coverage, attribution, host results)
βββ Private/ Resource, IpUtils, Decode, Config,
β New-WinSecEventQuery, Invoke-WinSecEventQuery,
β ConvertTo-WinSecEvent, ConvertTo-WinSecHtmlReport,
β Reporting (context, IOCs, renderers, EML), Help
βββ Public/ 20 cmdlets, one file each
βββ Resources/EventCatalog.json
tests/ Pester 5 suites + TestHelpers.ps1
build/ Build-Module Β· Install-Dev Β· validate Β· Export-CatalogDoc
docs/ architecture, examples, audit guide, generated catalog/reference
wiki/ source for this wiki
./build/validate.ps1 -Tests # all gates
./build/Build-Module.ps1 -Zip # artifact + zip under output/
./build/Install-Dev.ps1 -Force # install for manual play
./build/Export-CatalogDoc.ps1 # regenerate docs
Invoke-Pester ./tests -Output Detailed # tests onlyvalidate.ps1 runs, in order: AST parse (classes together with enums), manifest,
import/export parity, comment-based help (synopsis + β₯2 examples), catalog smoke,
PSScriptAnalyzer (0 Error/0 Warning, TypeNotFound excluded), and β with -Tests β Pester.
Current baseline: 168 passed, 0 failed, 1 skipped (the Windows-only guard test is skipped on Windows), 169 tests total.
-
Approved verbs only, private helpers included (
Get-WinSecResource, notLoadResource). -
No
Write-Hostorexitinsrc/. The single exception isShow-WinSecHunterHelp, whose purpose is interactive rendering; it returns strings with-PassThru. -
ShouldProcesson everything that writes.-WhatIfmust not create files or folders. -
StrictMode 3.0 is always on: never dot-access a property that may be absent β use
$obj.PSObject.Properties['Name'], hashtable indexers or a typed default. - UTC for analysis, local time for display only.
-
No
$nullinto value types. Time bounds use[datetime]::MinValueas "not set";[AllowNull()][datetime]does not accept$null, andNullable<T>is unboxed during binding. -
No
$using:scriptblock inForEach-Object -Parallel: pass text and rebuild with[scriptblock]::Create. -
Classify OS errors by
HResult/Win32 code, never by English message text. -
Evidence is immutable: reports go to
<CaseId>-reports, never into the bundle. - No secrets in parameters, files, reports or logs β environment variables only.
- Append an entry to
Resources/EventCatalog.json:{ "Id": β¦, "Log": β¦, "Name": β¦, "Category": β¦, "Importance": β¦, "Attack": [...], "IpFields": [...], "Notes": "β¦" }. - Add it to a profile if it belongs to one.
-
./build/Export-CatalogDoc.ps1β regenerate the catalog page. - Add a parser test if the event has a new field layout.
Private/Decode.ps1 β NTSTATUS, Kerberos and %% tables are plain hashtables keyed by
lowercase bare hex. Add a Decoder.Tests.ps1 case.
Extend the ValidateSet in Resolve-WinSecIpAttribution, add a branch with timeout and
error handling, add a *KeyEnvVar option, and update the provider table in the wiki.
- New file in
Public/. - Add the name to both allow-lists:
WinSecHunter.psm1and.psd1FunctionsToExport. - Comment-based help: synopsis, every parameter, β₯2 examples,
.OUTPUTS. - Tests, including a failure-mode case.
-
./build/validate.ps1 -Testsand updateCHANGELOG.md.
- Pester 5 syntax, module bootstrapped by
tests/TestHelpers.ps1. -
New-TestEventbuilds typedWinSecEventobjects inside module scope. - Private functions are tested with
InModuleScope WinSecHunter { β¦ }. - Windows-only behaviour is guarded with
-Skip:(-not $IsWindows). - Regression tests for fixed defects live in
tests/Regression.Tests.ps1; reporting tests intests/Reporting.Tests.ps1.
# 1. Bump ModuleVersion in WinSecHunter.psd1 and add a CHANGELOG section
# 2. Regenerate documentation
./build/Export-CatalogDoc.ps1
# 3. Gates
./build/validate.ps1 -Tests
./build/Build-Module.ps1 -Zip
# 4. Tag and push
git tag v2.1.0
git push origin main --tagspublish.yml re-runs the suite, rebuilds, checks tag β manifest version, and publishes to
PSGallery using the PSGALLERY_API_KEY repository secret.
The wiki is a separate git repository (<repo>.wiki.git, branch master). Pages live in
wiki/ for review, then are copied into the wiki clone:
git clone https://github.com/paulmann/Get-Windows-Security-Events-By-IP.wiki.git
Copy-Item .\wiki\*.md .\Get-Windows-Security-Events-By-IP.wiki\ -Force
cd .\Get-Windows-Security-Events-By-IP.wiki
git add -A; git commit -m "wiki: 2.1.0"; git pushLinks between pages use page names without .md ([Getting Started](Getting-Started));
repository files need absolute GitHub URLs.
WinSecHunter v2.1.0 Β· PolyForm Noncommercial 1.0.0 Β· derivative of Get-SecurityEventsByIP.ps1 by Mikhail Deynekin
Repository Β· Changelog Β· Security policy Β· Contributing
π Home
π― Problem Domain π Getting Started π§ Architecture
π Cmdlet Reference π Detection and Analysis π Remote Collection π°οΈ Threat Intel and Attribution π‘οΈ Audit Policy Guide
π Reporting and Abuse π§Ύ Evidence and Reporting π Reference Tables
π§ Configuration π©Ί Troubleshooting and FAQ π§βπ» Development πΊοΈ Roadmap