dafthack / GraphRunner

A Post-exploitation Toolset for Interacting with the Microsoft Graph API
MIT License
933 stars 102 forks source link

Get-SharePointSiteURLs gets only the top 500 results #32

Open EnriqueHernandezL opened 5 months ago

EnriqueHernandezL commented 5 months ago

In large environments, the function won't fetch all sites. The Graph API response contains a boolean field in hitsContainers.moreResultsAvailable indicating whether there are more results to the search or not.

In order to fix this, the function should keep increasing the "from" value of the post body (for example in 500 batches) and repeating the POST request until hitsContainers.moreResultsAvailable is false.