Repository navigation
Add DarkEye TI provider (HaveIBeenRansom and Breach House) - #965
Open
Juan Manuel Tejada (juanmill4) wants to merge 1 commit into
Open
Juan Manuel Tejada (juanmill4) wants to merge 1 commit into
Juan Manuel Tejada (juanmill4) wants to merge 1 commit into
Conversation
One provider, msticpy/context/tiproviders/darkeye.py, looks up domains, hostnames and email addresses in the two DarkEye products that have an API. Each product has its own optional key (HIBRAuthKey, BreachHouseAuthKey); a product without a key is not queried, and at least one key is required. Both products are combined into one result in which every record carries its product and category (ransomware, breach, leak, stealer, lead). Only listing metadata is kept. The tests in tests/context/test_darkeye.py run offline.
Author
|
@microsoft-github-policy-service agree company="Darkeye Industries LLC" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this adds
A
DarkEyethreat intelligence provider. DarkEye has two products with a paid API, and this one provider covers both:GET /api/metadata/domain/{observable}or/api/metadata/email/{observable}, up to 5 pages.GET /api/v1/search?q={observable}.Supported observables:
dns,hostname,email. No query subtypes.Each product has its own optional key. A product without a key is not queried and its host is never contacted. At least one key is required; with neither, the provider raises
MsticpyConfigError.What a result looks like
One row per observable.
DetailshasCount,Categories,Truncated, aProductsentry per product (ok,erroror not queried, with its record count) andRecords. Each record hasproduct(HaveIBeenRansomorBreach House),category(ransomware,breach,leak,stealerorlead), plus id, title, website, group, country and discovery date when the API returns them.Severity never goes above
warning, because a listing means the organisation or address appears in leaked or listed data, not that the observable is hostile. Leads, and no records at all, areinformation: no record only means nothing was found. If every queried product fails, the row isQUERY_FAILEDrather than an empty "not found"; if only one fails, the other's records are returned and the error is inDetails.Only listing metadata is read. HaveIBeenRansom's stealer-content endpoint is not used, no password or credential field is kept from either response, and
RawResultholds the reduced records, not the raw API response.Design choices worth explaining
_run_ti_lookup_queryis overridden because one lookup goes to two hosts, each with its own key, and the answer is one combined result.scanmalwaredoes the same.parse_resultsis kept and reports the same details from a built result.Two new names in
_HTTP_PROVIDER_LEGAL_KWARGS(HIBRAuthKey,BreachHouseAuthKey).lookup.pysilently drops any other kwarg, so without this the keys frommsticpyconfig.yamlwould never reach the provider. A test loads the provider throughTILookupfromtests/msticpyconfig-test.yamlto check this.Breach House matching. Its search is free text, so a record is kept only when it is about the observable: the exact address for an email, or the host or one of its subdomains for a hostname (
notexample.comandexample.com.other.comdo not matchexample.com).Requests. The key is sent only in the
Authorizationheader of a request to its own host, and redirects are not followed so the header cannot be carried elsewhere. Error messages never include the key or the exception text. Each lookup is bounded: 5 HaveIBeenRansom pages, 25 results per Breach House section, 100 records per product;Truncatedsays when a limit was hit.Changes
msticpy/context/tiproviders/darkeye.py(new): the provider.msticpy/context/tiproviders/__init__.py: registersDarkEye.msticpy/context/lookup.py: the two key names in_HTTP_PROVIDER_LEGAL_KWARGS.msticpy/resources/mpconfig_defaults.yaml: config definition, both keys optional,Primarydefaults toFalse.tests/context/test_darkeye.py(new) andtests/msticpyconfig-test.yaml.TIProviders.rst,msticpyconfig.rstand the API pagemsticpy.context.tiproviders.darkeye.rst.No new dependencies.
Testing
pytest tests/context/test_darkeye.py: 82 passed. All HTTP is mocked withrespx, nothing is sent to either API.pytest tests/context/test_lookup.py tests/context/test_tiproviders.py tests/common/test_pkg_config.py tests/config: pass, excepttest_geo_ip_settings, which fails the same way on untouchedmainhere (no MaxMind setup).ruff check,ruff format,pylint(10.00),pydocstyle --convention=numpyandmypypass on the new module.