InsightIDR4Py
Allows simplified Python interaction with Rapid7's InsightIDR REST API.
InsightIDR4Py allows analysts to query log data from Rapid7 InsightIDR, analyze it within Python, and/or feed it to other APIs like VirusTotal, AbuseIPDB, or others. This tool handles some of the challenges and complexities of using the InsightIDR REST API, including polling queries in progress, paginated responses, handling the JSON output, and time range queries.
Happy analyzing!
Examples
Example 1: Query DNS Logs for Suspicious TLDs
import InsightIDR4Py as idr
# define the query parameters
logset_name = "DNS Query"
query = "where(public_suffix IN [buzz, top, club, work, surf, tw, gq, ml, cf, biz, tk, cam, xyz, bond])"
time_range = "Last 36 Hours"
# query the logs
events = idr.QueryEvents(logset_name, query, time_range)
# print out an event
print(event[0])
Result:
{'timestamp': '2021-09-28T15:11:45.000Z', 'asset': 'windesk05.organization.com', 'source_address': '192.168.4.10', 'query': 'regulationprivilegescan.top', 'public_suffix': 'top', 'top_private_domain': 'regulationprivilegescan.top', 'query_type': 'A', 'source_data': '09/28/2021 8:11:45 AM 1480 PACKET 00000076ED1A0140 UDP Rcv 192.168.4.121 c3b3 Q [0001 D NOERROR] A (3)regulationprivilegescan(3)top(0)'}
Example 2: Query Authentication Logs for Failed Logins
# to do
Example 3: Query VPN Logins from a Certain IP Range
# to do
License
This repository is licensed under an MIT license, which grants extensive permission to use this material however you wish.
Contributing
You are welcome to contribute however you wish! I appreciate feedback in any format.