target / huntlib

A Python library to help with some common threat hunting data analysis operations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Retrieve first N results from search

jshlbrd opened this issue · comments

Is your feature request related to a problem? Please describe.
When testing new searches the user may be interested in immediate feedback on the search results and not interested in receiving all results -- this can make testing take longer than it otherwise would need to be, especially for searches that may return thousands of results.

Describe the solution you'd like
An option to only return the first N results of a search (similar to the Unix "head" command). Ideally this is written in a way that interrupts the search after N is reached, which would speed up the time to get results.

Describe alternatives you've considered
N/A

Additional context
N/A

I made a new branch called searchlimit which adds the limit parameter to ElasticDF and SplunkDF methods search() and search_df(). Consider it an alpha release right now: I changed search types for both classes under the hood to make this work and they both still need more testing.

Still, my initial test cases work OK, and limits really speed up the searches, too.

You can install this in a new virtualenv with a command like:

pip install https://github.com/target/huntlib/archive/searchlimit.zip

Please drop any feedback in this issue.

I merged this into master and made a new release, v0.3.0.