- Main process starts the bootstrap script (e.g.
iwr git.io/PSAnywhere | iex
) - Monitor for the process going into debugging state with a "sidecar" runspace that will watch the availability event for debug status
- When a process goes into debug, write to the main host that debug was detected and sidecar is starting
- Spawn a new namedpipe client that attaches to the relevant process' autogenerated named pipe
- Start a new instance of the golang ssh server and redirect stdio to the named pipe. The golang ssh server will have a powershell subsystem that simply interacts with stdin/out EDIT: Investigating using https://github.com/intothevoid/sshserver instead of sshdog
- [Optional] Expose the ssh port via rendevous service (Use gonnel/azure relay/websocat/inlets/whatever)
- You should now be able to enter-pssession -hostname -port <custom server port, will default to 22222> from the client and then debug-runspace (id) to debug the process.
This will work in