Created
April 5, 2016 15:04
-
-
Save anonymous/321844f3b3d5631baaa0bf73da20b847 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 | |
#uery : 4.2.2.2 | |
#egion : 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.Country)</Value></Entity>" | |
$MaltegoOrganization = "<Entity Type='Organization'><Value>$($response.org)</Value></Entity>" | |
#Output | |
Write-Host "$MaltegoHeader$MaltegoLocation$MaltegoOrganization$MaltegoFooter" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment