Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If running more than one module at the same time, output gets mixed up #93

Open
byt3bl33d3r opened this issue Sep 10, 2019 · 3 comments
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed

Comments

@byt3bl33d3r
Copy link
Owner

byt3bl33d3r commented Sep 10, 2019

Sessions run modules/tasks asynchronously, the way this is currently implemented (threads) has the unfortunate consequence of mixing up module's output if more than one is running at the same time because we're just hooking STDout using Console.SetOutput(). (https://github.com/byt3bl33d3r/SILENTTRINITY/blob/master/core/teamserver/data/stage.boo#L359-L379)

We really have only two options (unless i'm missing something obvious) to fix this:

  1. We run each module in it's own separate process instead of a thread (which would allow us to keep using the print statement for a modules output but would complicate the code considerably )
  2. Pass a new StringBuilder() object to each module and append the output to it (this would allow us to keep using threads but we won't be able to use the print statement anymore to handle output which is really pretty)
@byt3bl33d3r byt3bl33d3r added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed labels Sep 10, 2019
@byt3bl33d3r
Copy link
Owner Author

Turns out this is a lot more complicated problem than I thought. The only way around this seems to be solution n2 and forgo redirecting Stdout all together.

@baconwaifu
Copy link

Would it be possible to modify the parser so each instance can have it's own TextWriter as "stdout"? The main scheduler can then buffer and order it appropriately without significantly increasing complexity, or breaking existing modules. Console is just a static wrapper around a TextWriter anyways.

@jayrod
Copy link

jayrod commented Sep 4, 2021

Option n2 might allow for alternate data from one command. Like it'd be great to output the ps module in both human readable format and also parsable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants