Created
November 12, 2019 14:39
-
-
Save krisdb2009/0d9993094f459545c034874f023b6d5a to your computer and use it in GitHub Desktop.
Udger.com to Palo Alto Mine Meld format.
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
#Udger to Palo Alto Mine Meld | |
#Author: Dylan Bickerstaff | |
#Date: Tuesday, November 12th 2019 | |
#Version: 0 | |
$UdgerAccessKey = "" | |
$MineMeldOutFile = ".\minemeld.out.txt" | |
"Downloading Udger Database..." | |
Invoke-WebRequest -Uri "http://data.udger.com/$($UdgerAccessKey)/udgerdb_v3.dat" -OutFile ".\udgerdb_v3.dat" | |
"Importing SQLite Library..." | |
Add-Type -Path ".\sqlite\System.Data.SQLite.dll" | |
"Connecting to Udger Database..." | |
$connection = [System.Data.SQLite.SQLiteConnection]::new("Data Source=.\udgerdb_v3.dat;Version=3;") | |
$connection.Open() | |
"Querying Udger Database for IPv4 addresses..." | |
$command = [System.Data.SQLite.SQLiteCommand]::new("SELECT * FROM udger_ip_list WHERE ip LIKE '%.%.%.%'", $connection) | |
$reader = $command.ExecuteReader() | |
"Writing results to Mine Meld file: $($MineMeldOutFile)..." | |
Remove-Item -Path $MineMeldOutFile | |
while($reader.Read()) { | |
$ip = $reader.GetValue(1) | |
"$($ip)-$($ip)" | Out-File -Append -FilePath $MineMeldOutFile | |
} | |
"Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment