[WIP] Adding OpenGraph export functionality for BloodHound #992
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.
Description
This work in Progress PR aims to add the possibility to generate an OpenGraph json file to enriched BloodHound datas after an NetExec run. (Only works for bloudhound-CE)
I made this PR even if it is still work in progress to have some feedback, in particular about the implementation as I am not sure about creating the global object in opengraph.py or modifying netexec.py and proto_flow workflow so let me know if there is any better ways. :)
The goal is to be able to easily add new tags/edges to bloodhound
--opengraph path/to/bloudhound/computers.json is used to generate the json. Computers.json data is used to resolve fqdn to Object ID as this is how BloudHound matches nodes. This resolution could later be also done directly with an ldap query or via bloudhound API. However, it is imo the best compromise as it avoids the need of a new ldap connection and the need to have the BloudHound instance reachable.
The json file is then generated in the NXCPath/log/ and can be imported directly in BloudHound via the direct import feature.
Example
Adding edges for HasSession when running --reg-sessions and adding host info such as IPs or SMB signing status
Generated OpenGraph json
After import in bloodhound:
An example of adding a tag with a module can be found in ntlm_reflection.py for example.
Implementation
New helper class OpenGraph that create a new global object opengraph.
This exposed 2 main methods:
Host info are extrated by adding a new optional proto_flow() step opengraph_host_info() and module can directly call add_*() to add new info.
TODOs
Type of change
Insert an "x" inside the brackets for relevant items (do not delete options)
Setup guide for the review
Test were done on GOAD-Light, run bloodhound first then you can import opengraph json data as any bloudhound data.
Checklist:
Insert an "x" inside the brackets for completed and relevant items (do not delete options)
poetry run python -m ruff check . --preview, use--fixto automatically fix what it can)tests/e2e_commands.txtfile if necessary (new modules or features are required to be added to the e2e tests)