Created
August 5, 2014 12:31
-
-
Save truekonrads/49f6a70f4ac583cf6d30 to your computer and use it in GitHub Desktop.
Get http(s) from gnamp and spit out urls
This file contains hidden or 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
| #!/usr/bin/perl -w | |
| # Copyright 2014 Konrads Smelkovs <[email protected]> | |
| #$ cat shooturl.sh | |
| # #!/bin/bash | |
| # /usr/local/bin/CutyCapt --insecure --url=$1 --out=`echo $1|tr '/:' '__'`.png | |
| # Usage: gnmap-to-http-urls.pl scan.gnmap | xargs -P 5 -n 1 --verbose ./shooturl.sh | |
| while (<>) { | |
| next unless m!\d+/open/!; | |
| if (m!^Host:\s+([\d\.]+)\s+\(([^)]*)\)\s+Ports:\s+(.+)!) { | |
| $host = $1; | |
| $fqdn = $2; | |
| $host = $fqdn if $fqdn ne ""; | |
| @portlist = split( /, /, $3 ); | |
| foreach $portstring (@portlist) { | |
| $proto = ""; | |
| @portdetails = split( /\//, $portstring ); | |
| if ( ( scalar @portdetails >= 5 ) and $portdetails[1] eq "open" ) | |
| { | |
| $port = $portdetails[0]; | |
| $proto = "http" if ( $portdetails[4] eq "http" ); | |
| $proto = "https" if ( $portdetails[4] eq "ssl|http" ); | |
| if ($proto) { | |
| print "$proto://$host:$port/\n"; | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment