An easier way to interact with the notion API. If you find yourself with a Notion Integration Token, you may find that the Notion API is not the best for pulling data for offensive assessments. This small tool will hopefully make it less painful.
Specific logic to handle 429 timeouts has been included. This was a particular painpoint during an assessment. The client was slamming the Notion API and would get rate-limited instantly. This logic aims to use the Retry-after timeout supplied in the 429 to hopefully get some requests through. Since searching doesn't support mulitple keyword search, batch searching via threading is performed. Threading is also used to make batch page download requests.
Batch Search for keywords / strings. Ouputs raw JSON response, as well as a formatted CSV with just the important data (page-id, filename, last edit date, and keyword match)
python3 notionTriage.py batch-search --object page --query "Crowdstrike" --query "Offices" --out-dir testing --workers 4 --verbose --csv-out testing/results.csv --out-dir testing
Pull and format all pages from a return separated list of page ids. The original unformatted JSON is also outputted.
python notionTriage.py batch-get-page --ids-file page-ids.txt --raw-dir testing --fmt-dir testing --workers 4 --verbose