Skip to content

autoimprover: simplify winpeas checks#627

Merged
github-actions[bot] merged 1 commit intomasterfrom
autoimprover/winpeas/23780611103
Mar 31, 2026
Merged

autoimprover: simplify winpeas checks#627
github-actions[bot] merged 1 commit intomasterfrom
autoimprover/winpeas/23780611103

Conversation

@carlospolop
Copy link
Copy Markdown
Collaborator

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 in winPEAS/winPEASexe/Tests. Recent activity is concentrated in Checks/*, network scanning, and a small March 15 change touching SystemInfo and UserInfoHelper.
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.cs now. 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, or mono, 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 touching SystemInfo and UserInfoHelper.

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 in GetSessionValue() 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, and mono are not installed, so verification was limited to code inspection and diff review. Since the target tool is winpeas, no linpeas build was attempted.\n\nGenerated by PEASS autoimprover workflow.

@github-actions github-actions bot merged commit 98e5cd3 into master Mar 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant