Forked from anonymous/Get-MaltegoTransformResponse.ps1
Last active
April 5, 2016 17:14
-
-
Save Daenks/13e5e19005304869e89241afc85c3748 to your computer and use it in GitHub Desktop.
Powershell Maltego Local Transform Example
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
Param( | |
$IP ##IP we will look up | |
) | |
#Define XML Header | |
$MaltegoHeader = @" | |
<MaltegoMessage> | |
<MaltegoTransformResponseMessage> | |
<Entities> | |
"@ | |
#Define XML Footer | |
$MaltegoFooter = @" | |
</Entities> | |
</MaltegoTransformResponseMessage> | |
</MaltegoMessage> | |
"@ | |
#Example Query: | |
#Invoke-RestMethod -Method GET -Uri "http://ip-api.com/json/4.2.2.2" | |
#Example Results: | |
#as : AS3356 Level 3 Communications, Inc. | |
#city : New York | |
#country : United States | |
#countryCode : US | |
#isp : Level 3 Communications | |
#lat : 40.7128 | |
#lon : -74.0059 | |
#org : Level 3 Communications | |
#query : 4.2.2.2 | |
#region : NY | |
#regionName : New York | |
#status : success | |
#timezone : America/Chicago | |
#zip : | |
#Invoke the API and store the response | |
$response = Invoke-RestMethod -Method GET -Uri "http://ip-api.com/json/$($IP)" | |
#Build the XML Container around the values | |
$MaltegoLocation = "<Entity Type='Location'><Value>$($response.City), $($response.region), $($response.Country)</Value></Entity>" | |
$MaltegoOrganization = "<Entity Type='Organization'><Value>$($response.org)</Value></Entity>" | |
#Output | |
Write-Host "$MaltegoHeader$MaltegoLocation$MaltegoOrganization$MaltegoFooter" | |
#Example Output: | |
#PowerShell> .\Get-MaltegoTransformResponse.ps1 4.2.2.2 | |
#<MaltegoMessage> | |
#<MaltegoTransformResponseMessage> | |
#<Entities><Entity Type='Location'><Value>United States</Value></Entity><Entity Type='Organization'><Value>Level 3 Communications</Value></Entity></Entities> | |
#</MaltegoTransformResponseMessage> | |
#</MaltegoMessage> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment