To assess a remote domain for OneDrive enumeration.
$domain = "example.com" # replace with your target domain
$vulnUrl = "https://$domain/personal/" # OneDrive URL to check
try {
$response = Invoke-WebRequest $vulnUrl -UseBasicParsing -ErrorAction Stop
$status = $response.StatusCode
} catch {
$status = $_.Exception.Response.StatusCode.Value__
}
if ($status -eq 200) {
Write-Host "OneDrive Enumeration possible on $domain"
} else {
Write-Host "OneDrive Enumeration not possible on $domain"
}
In this code, we are using the Invoke-WebRequest cmdlet to make a request to the OneDrive URL for the remote domain. We are checking the status code of the response to determine if the OneDrive enumeration is possible or not.