How to utilize the cbsearch utility to collect raw solr document information.
Run the utility directly on the primary server. The utility will reach out to each minion node to find the stored node.
/usr/share/cb/cbsearch| Switch | Use | Required | Info |
--process | --process <unique_id> | Yes (only one base) | Searches cbevents (reader) for the full raw process document |
| --binary | --binary <md5 or sha256> | Yes (only one base) | Searches cbmodules core based on the hash provided |
| --feed | --feed <id or name> | Yes (only one base) | Searches cbfeeds core based on the feed id or the feed name |
| --alert | --alert <watchlist_id or feed report name> | Yes (only one base) | Searches cbalerts core for alerts based on watchlist id or the report name. Report name is the one found when clicking "threat reports", selecting the report and viewing the title at the top |
| Switch | Use | Required | Info |
--filename | --filename /tmp/myfile.json | Optional | Allows a user to specify a path and filename By default, base switches will use what is entered as the filename and saved to /var/log/cb/ When using --query, if nothing is specified it will output /var/log/cb/custom_query.json |
| --save | --save | Yes (can be combined) | Allows a user to save the output locally to /var/log/cb unless specified with --filename Can be used with --post and --print |
| --post | --post | Yes (can be combined) | Creates the file, submits it to Alliance and deletes it locally. To keep the file, use --save as well. Use only for Broadcom direct or escalated cases. |
| Yes (can be combined) | Will print the output to the screen. Pro tip: use "--print --row 1" if you are testing a query and want to see what returns |
| Switch | Use | Required | Info |
| --query | --query "myquery" | Optional | Allows custom query search based on one of the above base switches cbsearch --process --query "myquery" Must be double quoted outside, and single quoted after the search terms. Can also be single quoted outside and double quoted inside |
| --row | --row 50 | Optional | Specify the row count (amount of documents to return). |
| --row-limit | --row-limit 100 | Optional | Splits the query runs into smaller segments. By default this is limited to 5000. For example: 600 rows, when row-limit is set to 100 the utility will run the query 6 times to get all 600, putting them in separate documents |
| Type | Search | Info |
| Raw Process Document | cbsearch --process 00000035-0000-035c-01d9-73908e8da50d --save | Saves all raw process document segments matching that unique id into a local file. |
| Custom Process Search Query | cbsearch --process --query 'process_name:parity.exe and netconn_count:[1 to *]' --save --row 10 --debug --filename /tmp/parity_capture.json | Runs the query "process_name:parity.exe and netconn_count:[1 to *]" |
| Binary MD5/Sha256 | cbsearch --binary C8214821278F83E9937798FD4C41A584 --print cbsearch --binary 50420B826E802FAAED8928A74A044D8E8738785DBED93CFDB6080F92CF951435 --print | Prints the binary document to standard out in terminal. The utility handles the case-sensitivity. It will accept lower or uppercase. |
| Custom Binary Search | cbsearch --binary --query 'original_filename:"cbstream.sys" and product_name:"Carbon Black EDR Sensor"' --print --row 20 | Prints 20 binaries matching the filename and product name. |
| Feed Based ID | cbsearch --feed 20 --row 1 --print | Printing a single feed report to the matched feed id of 20 to standard out in terminal |
| Feed Based Name | cbsearch --feed bit9suspiciousindicators --print --row 1 | Printing a single feed report to the matched bit9suspiciousindicators feed by name to standard out in terminal |
| Feed Query | cbsearch --feed --query "title:mshtml.dll" --print --row 1 | Searches like title will pick up on parts of the query, resulting in inaccurate results. So instead of 'title:Defense Evasion - Signed Binary Proxy Execution - mshtml.dll"', find something unique to the name like "title:mshtml.dll" to take advantage of the tokenization |
| Alert by Watchlist ID | cbsearch --alert 32 --print --row 1 | Printing a single match for an alert from watchlist 32 to standard out in terminal |
| Alert by Feed Report Name | cbsearch --alert "'Matched yara rules: matchover100kb, matchStringforputty'" --print --row 1 | Printing a single match for an alert based on the yara rule feed name to standard out in terminal |
| Custom Alert Query | cbsearch --alert --query md5:a98d71eb1bec5d38549b2155a3e54008 --print --row 1 | Printing a single match for alert based on this md5 to standard out in terminal |