autoimprover: simplify winpeas checks#627
Merged
github-actions[bot] merged 1 commit intomasterfrom Mar 31, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated simplifications for winpeas checks.\n\nAgent summary:\nPEASS winpeas autoimprover agent completed successfully with 38 steps. Agent Comment: I’m scoping the WinPEAS C# surface first and pulling the recent git history for only those files. After that I’ll inspect the hot spots for duplicated logic and refactor only if the change is clearly behavior-preserving.
The WinPEAS EXE scope is under
winPEAS/winPEASexe/winPEAS, with tests inwinPEAS/winPEASexe/Tests. Recent activity is concentrated inChecks/*, network scanning, and a small March 15 change touchingSystemInfoandUserInfoHelper.I’ve got the change window narrowed down. The main candidate area for a safe simplification is the WinPEAS argument/check orchestration layer and a few repeated data-normalization blocks in
UserInfo, rather than the lower-level discovery code where behavior is easier to disturb.I found a low-risk duplication that is worth touching:
UserInfo.PrintRdpSessions()manually extracts and null-normalizes the same dictionary fields twice. I’m checking the surrounding code now so I can collapse that into a single helper without altering output or control flow.I’m editing
UserInfo.csnow. The change is limited to factoring repeated RDP session dictionary lookups into a helper so the same fields are normalized in one place instead of two slightly different blocks.The edit is in place. I’m verifying the exact diff and the local build capability now; this environment does not currently have
dotnet,msbuild, ormono, so verification is likely limited to static inspection and git diff review.Main WinPEAS EXE code is under winPEAS, with tests in Tests. In the last 30 days, the relevant changes were mostly in the check orchestration layer (
Checks.cs), network scan fixes, and two March 15 updates touchingSystemInfoandUserInfoHelper.I applied one small safe refactor in UserInfo.cs. The
PrintRdpSessions()path had the same dictionary field extraction and null-to-empty normalization duplicated in both the session-print loop and the flagged-session warning loop. That is now centralized inGetSessionValue()at UserInfo.cs, which keeps output and behavior unchanged while reducing repetition and making the RDP-session handling easier to follow.README was left unchanged because this refactor does not change functionality or output. I could not run a full build/test in this environment because
dotnet,msbuild, andmonoare not installed, so verification was limited to code inspection and diff review. Since the target tool iswinpeas, nolinpeasbuild was attempted.\n\nGenerated by PEASS autoimprover workflow.