Joshua "Jabra" Abraham
and 1 contributors

NAME

MetasploitExpress::Parser - Parse metasploit express scan data with Perl

VERSION

This document describes the latest version of MetasploitExpress::Parser.

SYNOPSIS

 my $msf = new MetatsploitExpress::Parser;

 my $parser = $msf->parse_file('test1.xml');
    #a MetasploitExpress::Parser Object

 my @hosts = $parser->get_all_hosts();
    #an Array of MetasploitExpress::Parser::Host Objects

 my @services = $parser->get_all_services();
    #an Array of MetasploitExpress::Parser::Service Objects

 my @tasks = $parser->get_all_tasks();
    #an Array of MetasploitExpress::Parser::Task Objects

 my @events = $parser->get_all_events();
    #an Array of MetasploitExpress::Parser::Event Objects

 my @reports = $parser->get_all_reports();
    #an Array of MetasploitExpress::Parser::Report Objects

For a full listing of methods see the documentation corresponding to each object.

DESCRIPTION

OVERVIEW

 MetasploitExpress::Parser                              -- Core parser
 |
 +--MetasploitExpress::Parser::Session                  -- Metasploit Express scan session information
 |  
 +--MetasploitExpress::Parser::Host                     -- General host information
 |
 +--MetasploitExpress::Parser::Service                  -- General service information
 |
 +--MetasploitExpress::Parser::Report                   -- General report information
 |
 +--MetasploitExpress::Parser::Task                     -- General task information
 |
 +--MetasploitExpress::Parser::Event                    -- General event information

METHODS

MetasploitExpress::Parser

The main idea behind the core modules is, you will first parse the scan data then extract the information. Therefore, you should run parse_file then the you can use any of the get_* methods.

parse_file($xml_file)

Parse a MetasploitExpress XML file. The XML files are generated from using Metasploit Express

get_session()

Obtain the MetasploitExpress::Parser::Session object which contains the session scan information.

get_all_hosts()

Obtain an Array of MetasploitExpress::Parser::Host objects which contain host information.

get_all_services()

Obtain an Array of MetasploitExpress::Parser::Service objects which contain service information.

get_all_events()

Obtain an Array of MetasploitExpress::Parser::Event objects which contain event information.

get_all_tasks()

Obtain an Array of MetasploitExpress::Parser::Task objects which contain task information.

get_all_reports()

Obtain an Array of MetasploitExpress::Parser::Report objects which contain report information.

MetasploitExpress::Parser::Session

This object contains the scan session information of the MetasploitExpress scan.

time()

Returns the time of the scan.

user()

Returns the user that ran the scan.

project()

Returns the name of the project.

MetasploitExpress::Parser::Host

This object contains the information for a host.

address()

Returns a string which contains the ip of this host.

address6()

Returns a string which contains the ip v6 of this host.

arch()

Returns a string which contains the architecture this host.

comments()

Returns a string which contains the comment for this this host.

created_at()

Returns a string which contains the date/time this host was created.

id()

Returns a string which contains the id for this host.

mac()

Returns a string which contains the MAC address for this host.

name()

Returns a string which contains the hostname for this host.

os_flavor()

Returns a string which contains the OS flavor for this host.

os_name()

Returns a string which contains the OS name for this host. Ex: Microsoft Windows XP

os_sp()

Returns a string which contains the OS service pack for this host. Ex: SP0/1

purpose()

Returns a string which contains the purpose for this host. Ex: client

state()

Returns a string which contains the state for this host. Ex: alive

workspace_id()

Returns a string which contains the workspace_id for this host.

MetasploitExpress::Parser::Service

This object contains the information for a port/service.

port()

Returns a string which contains the port number.

proto()

Returns a string which contains the protocol. Ex: tcp or udp

state()

Returns a string which contains the state. Ex: open

host_id()

Returns a string which contains the host_id.

id()

Returns a string which contains the id.

created_at()

Returns a string which contains the date/time this service was created.

updated_at()

Returns a string which contains the date/time this service was last updated.

MetasploitExpress::Parser::Event

This object contains the information for a event.

host_id()

Returns a string which contains the host_id. This will be a number or 'NULL'.

critical()

Returns a string which contains the critical information about the event. This will be a string or 'NULL'

user()

Returns a string which contains user that created this event.

id()

Returns a string which contains the id.

created_at()

Returns a string which contains the date/time this event was created.

updated_at()

Returns a string which contains the date/time this event was last updated.

workspace_id()

Returns a string which contains the workspace id for this event.

seen()

Returns a string which contains a boolean if this event has already been seen before.

name()

Returns a string which contains the name of this event. Ex: module_complete

MetasploitExpress::Parser::Task

This object contains the information for a task.

description()

Returns a string which contains the description of this task.

error()

Returns a string which contains the error if one occured.

id()

Returns a string which contains the id.

module()

Returns a string which contains the module that was executed for this task.

path()

Returns a string which contains the path which contains the data for this task.

workspace_id()

Returns a string which contains the workspace id for this task.

user()

Returns a string which contains the username that created this task.

created_at()

Returns a string which contains the date/time this task was created.

updated_at()

Returns a string which contains the date/time this task was last updated.

EXAMPLES

Here is an example of parsing an XML file using MetasploitExpress::Parser:

my $msf = new MetasploitExpress::Parser;

my $parser = $msf->parse_file('test1.xml');

foreach my $h ( $parser->get_all_hosts() ){ print "ip: " . $h->address . "\n"; print "---\n";

}

foreach my $s ( $parser->get_all_services() ){ print "port: " . $s->port . "\n"; print "proto: " . $s->proto . "\n"; print "name: " . $s->name . "\n"; print "host_id: " . $s->host_id . "\n"; print "---\n";

}

SEE ALSO

 XML::LibXML and Object::InsideOut
 

AUTHOR

Joshua D. Abraham, <jabra AT spl0it DOT org>

COPYRIGHT AND LICENSE

Copyright 2010 Joshua D. Abraham. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.