#!/usr/bin/perl -w
#
# Joshua "Jabra" Abraham ( jabra@spl0it.org )
#
use strict;

if ( !defined($ARGV[0]) ) {
    print "usage $0 [Nmap XML extract]\n";
    exit;
}
my $file = $ARGV[0];
chomp($file);
if ( !-r $file ){
    print "Error $file doesn't exist or isn't readable\n";
}
system("mkdir medusa");
system("mkdir scan");
system("mkdir ike-scan");
system("nmap-parse.pl -i -f $file    > listip.txt");
system("nmap-parse.pl -p 21 -f $file > medusa/ftp_list.txt");
system("nmap-parse.pl -s ftps -f $file > medusa/ftps_list.txt");
system("nmap-parse.pl -p 22 -f $file > medusa/ssh_list.txt");
system("nmap-parse.pl -p 23 -f $file > medusa/telnet_list.txt");
system("nmap-parse.pl -s telnets -f $file > medusa/telnets_list.txt");
system("nmap-parse.pl -p 25 -f $file > scan/mail_list.txt");
system("nmap-parse.pl -s imap -f $file > medusa/imap_list.txt");
system("nmap-parse.pl -s imaps -f $file > medusa/imaps_list.txt");
system("nmap-parse.pl -s pop3 -f $file > medusa/pop3_list.txt");
system("nmap-parse.pl -p 80 -f $file > scan/http_list.txt");
system("nmap-parse.pl -p 443 -f $file > scan/https_list.txt");
system("nmap-parse.pl -p 500 -f $file > ike-scan/isakpmd_list.txt");
system("nmap-parse.pl -p 902 -f $file > medusa/vmware_list.txt");
system("nmap-parse.pl -p 3389 -f $file > medusa/rdesktop_list.txt");
system("nmap-parse.pl -s citrix-ica -f $file > citrix_list.txt");
system("nmap-parse.pl -s vnc -f $file > medusa/vnc_list.txt");
system("nmap-parse.pl -s cifs -f $file > cifs_list.txt");
system("nmap-parse.pl -s http-vnc -f $file > medusa/http-vnc_list.txt");
system("nmap-parse.pl -s portmapper -f $file > portmapper_list.txt");
