r/PowerShell • u/SlashRevet • Jun 14 '26
Misc I built Disbatch — point it at a PowerShell script and it generates a GUI (with a static risk analyzer)
I never really trusted running .ps1 scripts I found online — I couldn't always tell what they actually did before hitting enter. So I built Disbatch to make scripts easier to understand and use: open one, and it shows you a readable preview, flags risky patterns, reads the param() block and generates matching controls — folder/file pickers, checkboxes, dropdowns (ValidateSet), number/text fields — then runs it in an embedded ConPTY terminal with a live progress bar.
A few things I cared about:
- Static risk analyzer — flags download-and-execute, encoded commands, keyloggers, persistence, shadow-copy deletion, etc., and gates the Run button on warning-level findings. It's a heuristic speed-bump, not antivirus — obfuscated code can evade it, and "no findings" never means "safe." It just surfaces what a script can do so you read it before running.
- Mapper — when detection misses something, you click a line in the preview to bind it to a control. No config files to hand-edit.
- Sidecar — control mappings, hints and last-used values save to
<script>.disbatch.jsonnext to the script, so you can commit it and share with your team.
Single ~4 MB exe, 100% offline, no telemetry. Built in Rust (egui). Also does basic .bat/.cmd positional args.
Heads up: the released binary is unsigned, so SmartScreen will warn — there's a note in the README explaining why and how to verify (or just build from source).
It's an early release and I'd love feedback, especially on the analyzer rules and any param patterns the parser mis-reads.
13
u/Katu93 Jun 14 '26
Very cool idea! And thank you for having a "Vibecoded" disclaimer and not hiding ai use.
7
u/dodexahedron Jun 15 '26 edited Jun 15 '26
First thing I noticed is the regex for the param block is insufficient.
Give it a slightly more complex test input like this, to help you design a more robust pattern:
Honestly, this is a scenario ill-suited for regex. A more complex state machine is needed to parse these language elements. Even a balancing regex fails due to the fact that the meaning of a closing parenthesis is context-dependent. So, a balanced pair will fail miserably on the above, even with some cleanup of the code to remove the ones that are meant to simulate typos, and the comments are likely to be the main killers, with the multi-line attributes being a close second place.
Also, at least for powershell, are you familiar with PSScriptAnalyzer? That might be a good source for you, when figuring out how to deal with various scenarios, since it has to do it too.
The above code is I think slightly illegal due to the nature of the default value initializer on that parameter, but that is irrelevant because the analyzer needs to be able to handle it so it can catch it or, even if it can't catch that, it at least needs to still function properly after encountering it.
1
u/post4u Jun 14 '26
My eyes see Disbatch. My brain says Bitchdash.