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

[FEATURE REQUEST] Convert modules to stop using deprecated features in Empire 5.9+ #716

Open
vinnybod opened this issue Jan 27, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@vinnybod
Copy link

Description

Empire 5.9.0 introduced a new way of doing error handling: https://bc-security.gitbook.io/empire-wiki/module-development/powershell-modules#error-handling

Instead of returning a tuple containing an error message or using the handle_error_message function, an exception should be raised and the generated module script should be returned as a str


Empire 5.9.0 introduced 2 decorators auto_get_source and auto_finalize: https://bc-security.gitbook.io/empire-wiki/module-development/powershell-modules#decorators

Using these decorators eliminates a bit of boiler plate code from the beginning and end of a module's generate function. auto_finalize cannot be used without replacing tuple returns with raised exceptions.

Solution

Remove the use of handle_error_message, instead using the raised exceptions described in the docs https://bc-security.gitbook.io/empire-wiki/module-development/powershell-modules#error-handling

For modules that are not deviating from the boiler plate template, replace the get_module_source and finalize_module calls with the auto_get_source and auto_finalize decorators.

An example module conversion is here:
4eb02f6#diff-c41918d437c0bf39ac6fc692e1bb881586f8d1b0c583864f72bdcfbf5ba0ad65R12-R48

Alternatives

No response

Additional Context

No response

@vinnybod vinnybod added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jan 27, 2024
@git-tirthankar
Copy link

@vinnybod - I have enhanced the feature as mentioned.
Could you please review part 1: #717

@vinnybod
Copy link
Author

vinnybod commented Feb 9, 2024

Hey @git-tirthankar I reviewed the pull request, looks like you just need to lint the code. When I did locally, it found some syntactical errors. Thanks for your help!

cmndcntrlcyber pushed a commit to cmndcntrlcyber/Empire that referenced this issue May 27, 2024
* initial install script updates

* more cleanup

* merge common code

* update Dockerfile

* update dependencies for python 3.12

* allow 3.12 for deps

* pysecretsocks compat

* bump minimum py version to 3.10, upgrade deps for 3.12, add 3.12 to supported versions

* bump to python 3.12

* upgrade deps

* update pr matrix

* ignore thread warnings

* take out the huge query

* take out the huge query in the perf test

* typos in compose file

* more tweaks

* bump time limit on install tests

* bump perf test again because py3.12 is slow on the runner for some reason

* disable some steps

* run ci

* remove token

* fix geo issue

* run py 3.12 tests

* uncomment

* move symlink to install script. use sudo for mysql setup

* fix symlinks

* add keyring bypass to kali

* setup keyring no matter the os. update nim symlinking

* Update CHANGELOG.md

* split install tests

* org agnostic check

* Fix function

* remove release token from checkout in python step

* remove release token from checkout in python step

* fix function

* syntax

* update run-all-tests script

* change var name

* add some echos

* split CI

* updates

* remove token

* wrong path

* re-enable token

* disable parrot for now

* install starkiller in the docker build. check or it in cst. update forked dep references

* update changelog with warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants