Skip to content

Instantly share code, notes, and snippets.

@truekonrads
Created August 5, 2014 12:31
Show Gist options
  • Select an option

  • Save truekonrads/49f6a70f4ac583cf6d30 to your computer and use it in GitHub Desktop.

Select an option

Save truekonrads/49f6a70f4ac583cf6d30 to your computer and use it in GitHub Desktop.
Get http(s) from gnamp and spit out urls
#!/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