bats3c / shad0w

A post exploitation framework designed to operate covertly on heavily monitored environments
https://blog.dylan.codes/shad0w/
MIT License
2.03k stars 323 forks source link

Stuck in python command after missing parameter error #45

Closed HashtagMarkus closed 4 years ago

HashtagMarkus commented 4 years ago

Steps to reproduce:

Example:

shad0w(az500@c2test) ≫ execute
the following arguments are required: -f/--file
...

shad0w(az500@c2test) ≫ execute
the following arguments are required: -f/--file
the following arguments are required: -f/--file
...

shad0w(az500@c2test) ≫ execute -f msg.exe -p hello world
the following arguments are required: -f/--file
the following arguments are required: -f/--file

I noticed this in the following commands:

Seems to work without this issue: (Not sure yet why this behaves different)

bats3c commented 4 years ago

I believe this is the cause of issue #29 which was been incorrectly closed. But rather than reopening I will use this issue to track the fix as this bug is in a lot of modules.

HashtagMarkus commented 4 years ago

Proposal for a refactoring of the commands which would also fix this issue

https://github.com/bats3c/shad0w/compare/master...HashtagMarkus:dev?expand=1

I created basecommand.py class and as an example refactored execute.py to inherit from BaseCommand. This way the parsing and error handling would be handled in a single point (base) and the concrete command implementation only provides plain functionality and description. I could go further in that direction, but since it's quite a big refactoring touching all commands I'd rather get your opinion on that first ;-)

HashtagMarkus commented 4 years ago

Refactored all above mentioned commands first. (See #48 ) If accepted, I'd refactor the other commands in a separate PR to keep things small

bats3c commented 4 years ago

Accepted #48. This should be fixed now.