Created
July 26, 2019 06:24
-
-
Save technion/7f93c4ef7c172d6de6cac7af379cdb00 to your computer and use it in GitHub Desktop.
Alien Vault OTX file hash IOC download Powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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