Skip to content

Instantly share code, notes, and snippets.

@technion
Created July 26, 2019 06:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save technion/7f93c4ef7c172d6de6cac7af379cdb00 to your computer and use it in GitHub Desktop.
Save technion/7f93c4ef7c172d6de6cac7af379cdb00 to your computer and use it in GitHub Desktop.
Alien Vault OTX file hash IOC download Powershell
# Script to create current IOC hash file from Alien Vault Open Threat Exchange
$apikey = "KEY"
$feedurl = "https://otx.alienvault.com/api/v1/pulses/subscribed/?limit=10&page=1"
Start-Transcript -Path E:\custom-hash-iocs.txt
function fetchOTX($url) {
$indicators = Invoke-RestMethod -Uri $url -Headers @{"X-OTX-API-KEY"="$apikey"}
foreach($ioc in $indicators.results.indicators) {
if ($ioc.type -like "FileHash-*") {
write-host "$($ioc.indicator); OTX id $($ioc.id)"
}
}
if ($indicators.next -ne $null) {
fetchOTX($indicators.next)
}
}
fetchOTX($feedurl)
Stop-Transcript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment