Conversation
…reaming - render_fixed_layout: three-column dashboard (menu, CLI, meta)\n- start_rainfrog: interactive loop (r refresh, q quit, n new session, c run command)\n- sessions & stream_buffer tracking for background sessions and streaming output\n- run_enumeration helper retained\n
…i for TUI support
There was a problem hiding this comment.
Pull request overview
This PR refactors the session command loop into a dispatcher-driven flow, introduces an experimental TUI architecture backed by shared AppState, and updates the Ruby dependency stack / WinRM integration for Ruby 4 compatibility.
Changes:
- Add
CommandDispatcher+Executionhelpers to centralize command handling and execution/streaming behavior. - Introduce experimental TUI components (
TUI, controller,AppState) and wire a--tuiflag + profile loading helpers. - Harden uploader/downloader path resolution and modernize Ruby dependencies / warning suppression.
Reviewed changes
Copilot reviewed 30 out of 34 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/test_tui_flags.rb | Adds a helper script to test TUI flag scanning (currently references missing API). |
| scripts/test_tui_dashboard.rb | Adds a helper script to render the dashboard with a mock shell. |
| scripts/test_banner_mock.rb | Adds a helper script to test banner rendering with a mock shell. |
| scripts/migrate_ruby4_dependencies.sh | Adds a migration script to regenerate lockfile/install deps for Ruby 4 setup. |
| scripts/demo_tui_live.rb | Adds a TUI demo script (currently references missing API). |
| loot/session_test.log | Removes committed session test log artifact. |
| loot/placeholder.txt | Removes placeholder loot file. |
| lib/evil_ctf/utils.rb | Introduces centralized PowerShell single-quote escaping helper. |
| lib/evil_ctf/uploader/client.rb | Refactors upload/download flows, adds path resolution + AppState progress tracking. |
| lib/evil_ctf/uploader.rb | Updates fileops completion escaping and adds remote tmp cleanup helper. |
| lib/evil_ctf/tui_controller.rb | Adds controller layer for hotkeys, tools/macros, profiles, settings, transfers. |
| lib/evil_ctf/tui.rb | Adds large experimental TUI implementation (async queue + rendering + polling). |
| lib/evil_ctf/tools.rb | Modernizes bypass scripts/macros and shifts execution to Execution.run. |
| lib/evil_ctf/shell_wrapper.rb | Loads warning-silencing compat layer before WinRM initialization. |
| lib/evil_ctf/shell_adapter.rb | Adds internal file manager (upload/download) and extra requires. |
| lib/evil_ctf/session.rb | Reworks session flow: validation, dispatcher integration, optional TUI handoff, prompt normalization. |
| lib/evil_ctf/logger.rb | Switches to a persistent synced file handle + adds close. |
| lib/evil_ctf/execution.rb | Adds bounded-time execution and job-based streaming utility. |
| lib/evil_ctf/errors.rb | Adds ConnectionValidationFailed error type. |
| lib/evil_ctf/connection.rb | Refactors connection builder for keyword args and adds ConnectionValidator. |
| lib/evil_ctf/command_dispatcher.rb | Adds dispatcher with registered handlers (tools, enum, bypass, lsass dump fallback). |
| lib/evil_ctf/cli.rb | Adds --tui, profile loader usage, and pre-session connection validation. |
| lib/evil_ctf/banner.rb | Adds early TUI launch path from banner when enabled. |
| lib/evil_ctf/app_state.rb | Introduces shared thread-safe state container for TUI/session state. |
| lib/config/profiles.rb | Adds centralized profile discovery/loading helpers. |
| lib/compat/silence_warnings.rb | Adds targeted Warning suppression for WinRM “object_id” redefine noise. |
| evil-ctf | Adds wrapper script to run via bundle exec. |
| evil-ctf.rb | Adds root runner that executes EvilCTF::CLI. |
| bin/evil-ctf.rb | Loads silence_warnings and auto-requires bundler/setup for --tui. |
| Gemfile.lock | Updates locked gems/platforms and bundler metadata. |
| Gemfile | Loosens gem constraints and adds TTY deps in development. |
| .gitignore | Ignores bundler config and log output directories. |
| .github/instructions/todos.instructions.md | Adds repo instructions/todos metadata. |
| .github/copilot-instructions.md | Adds Copilot instruction/todo metadata. |
| .bundle/config | Removes committed bundler config. |
Comments suppressed due to low confidence (1)
lib/evil_ctf/session.rb:172
Session.run_sessionvalidatesconnviaEvilCTF::ConnectionValidator.validate(conn, ...)and then immediately callsconn.shell(:powershell). Since the validator currently closes/resets the passed-in connection, this flow is very likely to fail (shell creation on a closed connection). Either validate using a separate connection instance or update the validator to not dispose theconnit was given.
# Validate connection and capture validation info
validation_info = nil
begin
validation_info = EvilCTF::ConnectionValidator.validate(conn, timeout: 10)
if validation_info[:ok]
puts "[+] Connection validated: #{validation_info[:hostname]}"
else
puts "[!] Connection validation failed: #{validation_info[:error]}"
end
rescue => e
validation_info = { ok: false, hostname: nil, error: "Validation error: #{e.message}" }
end
shell = nil
begin
shell = conn.shell(:powershell)
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.
PR Title
Refactor session/TUI flow, modernize Ruby 4 stack, and harden lsass dump fallback path
PR Description
The TUI in this PR is highly experimental and is not production-usable right now.
It is an active refactor foundation for future work, and operator behavior/UX should be considered unstable.
Summary
This PR bundles today’s reliability and modernization work across command dispatch, connection/session flow, tooling, uploader behavior, and the in-progress TUI architecture.
Commits Included
Refactor session dispatch and harden connection/upload reliability
Modernize Ruby 4 stack, harden TUI/dispatcher, and stabilize bypass scripts
Refactor TUI flow and harden lsass_dump fallback/download
What Changed
lsass_dumpworkflow:Behavior Notes
lsass_dumpnow has better operator-facing diagnostics and fallback behavior.Validation
lsass_dumpfailure/fallback/retrieval flow.Safety/Artifact Hygiene
Follow-up Work