File tree Expand file tree Collapse file tree 4 files changed +94
-1
lines changed
Expand file tree Collapse file tree 4 files changed +94
-1
lines changed Original file line number Diff line number Diff line change 1+ name : ci-build
2+ on :
3+ pull_request :
4+ branches :
5+ - main
6+
7+ jobs :
8+ build-image :
9+ runs-on : windows-2022
10+ steps :
11+ - name : Checkout
12+ uses : actions/checkout@v4
13+
14+ - name : Build Image
15+ shell : bash
16+ env :
17+ GITHUB_HEAD_REF : ${{ github.head_ref }}
18+ run : |
19+ export IMAGE_TAG=$(echo "${GITHUB_HEAD_REF}" | sed "s/\//-/g")-2022
20+ echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
21+ docker build -t windows-event-gen:${IMAGE_TAG} .
Original file line number Diff line number Diff line change 1+ FROM mcr.microsoft.com/powershell:7.4-windowsservercore-ltsc2022
2+
3+ LABEL maintainer="Paul Crooks <
[email protected] >"
4+
5+ RUN mkdir EventGen
6+
7+ COPY Entrypoint.ps1 EventGen/
8+
9+ ENTRYPOINT ["powershell", "C:/EventGen/Entrypoint.ps1"]
Original file line number Diff line number Diff line change 1+ Write-Host " Windows Event Generator"
2+
3+ function LogIfNotEmpty () {
4+ param (
5+ $logFile
6+ )
7+ $fileSize = (Get-Item - Path $logFile ).Length
8+ if ($fileSize -ne 0 ) {
9+ Write-Host " START $logFile "
10+ Get-Content $logFile
11+ Write-Host " END $logFile "
12+ }
13+ }
14+
15+ $eventList = @ (
16+ [PSCustomObject ]@ {name = " SAM Read" ; cmd = " esentutl.exe" ; args = " /y /vss %SystemRoot%/system32/config/SAM_ps /d %temp%/SAM_ps" }
17+ [PSCustomObject ]@ {name = " Clear Windows Event Log" ; cmd = " powershell" ; args = " Clear-EventLog -LogName System" }
18+ [PSCustomObject ]@ {name = " Encoded Powershell Execution" ; cmd = " powershell" ; args = " -enc bABzAA==" }
19+ [PSCustomObject ]@ {name = " Enumerate Logged-on Users" ; cmd = " powershell" ; args = " query user" }
20+ )
21+
22+ $stdoutFile = " Output.txt"
23+ $stderrFile = " Error.txt"
24+
25+ while ($true ) {
26+ foreach ( $event in $eventList ) {
27+ Write-Host " Running" $event.name
28+
29+ $processOptions = @ {
30+ ArgumentList = $event.args
31+ FilePath = $event.cmd
32+ NoNewWindow = $true
33+ RedirectStandardOutput = $stdoutFile
34+ RedirectStandardError = $stderrFile
35+ }
36+ Start-Process @processOptions
37+
38+ LogIfNotEmpty($stdoutFile )
39+ LogIfNotEmpty($stderrFile )
40+
41+ Start-Sleep 10
42+
43+ Remove-Item Output.txt
44+ Remove-Item Error.txt
45+
46+ Write-Host " **********************************************"
47+ }
48+ }
Original file line number Diff line number Diff line change 1- # windows-event-generator
1+ # Windows Event Generator
2+
3+ Very basic Event Generator for Windows. This is intended only for Agent developers to make some event noise.
4+
5+ ## Versions
6+ - Windows Server 2022
7+
8+ ## Build
9+ ``` powershell
10+ PS > docker build -t win-event-gen:latest-2022 -f .\Dockerfile.2022 .
11+ ```
12+
13+ ## Run
14+ ``` powershell
15+ PS > docker run -t --rm win-event-gen:latest-2022
16+ ```
You can’t perform that action at this time.
0 commit comments