MetasploitExpress::Parser - Parse metasploit express scan data with Perl
This document describes the latest version of MetasploitExpress::Parser.
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.
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
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 a MetasploitExpress XML file. The XML files are generated from using Metasploit Express
Obtain the MetasploitExpress::Parser::Session object which contains the session scan information.
Obtain an Array of MetasploitExpress::Parser::Host objects which contain host information.
Obtain an Array of MetasploitExpress::Parser::Service objects which contain service information.
Obtain an Array of MetasploitExpress::Parser::Event objects which contain event information.
Obtain an Array of MetasploitExpress::Parser::Task objects which contain task information.
Obtain an Array of MetasploitExpress::Parser::Report objects which contain report information.
This object contains the scan session information of the MetasploitExpress scan.
Returns the time of the scan.
Returns the user that ran the scan.
Returns the name of the project.
This object contains the information for a host.
Returns a string which contains the ip of this host.
Returns a string which contains the ip v6 of this host.
Returns a string which contains the architecture this host.
Returns a string which contains the comment for this this host.
Returns a string which contains the date/time this host was created.
Returns a string which contains the id for this host.
Returns a string which contains the MAC address for this host.
Returns a string which contains the hostname for this host.
Returns a string which contains the OS flavor for this host.
Returns a string which contains the OS name for this host. Ex: Microsoft Windows XP
Returns a string which contains the OS service pack for this host. Ex: SP0/1
Returns a string which contains the purpose for this host. Ex: client
Returns a string which contains the state for this host. Ex: alive
Returns a string which contains the workspace_id for this host.
This object contains the information for a port/service.
Returns a string which contains the port number.
Returns a string which contains the protocol. Ex: tcp or udp
Returns a string which contains the state. Ex: open
Returns a string which contains the host_id.
Returns a string which contains the id.
Returns a string which contains the date/time this service was created.
Returns a string which contains the date/time this service was last updated.
This object contains the information for a event.
Returns a string which contains the host_id. This will be a number or 'NULL'.
Returns a string which contains the critical information about the event. This will be a string or 'NULL'
Returns a string which contains user that created this event.
Returns a string which contains the date/time this event was created.
Returns a string which contains the date/time this event was last updated.
Returns a string which contains the workspace id for this event.
Returns a string which contains a boolean if this event has already been seen before.
Returns a string which contains the name of this event. Ex: module_complete
This object contains the information for a task.
Returns a string which contains the description of this task.
Returns a string which contains the error if one occured.
Returns a string which contains the module that was executed for this task.
Returns a string which contains the path which contains the data for this task.
Returns a string which contains the workspace id for this task.
Returns a string which contains the username that created this task.
Returns a string which contains the date/time this task was created.
Returns a string which contains the date/time this task was last updated.
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";
XML::LibXML and Object::InsideOut
Joshua D. Abraham, <jabra AT spl0it DOT org>
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.
To install MetasploitExpress::Parser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MetasploitExpress::Parser
CPAN shell
perl -MCPAN -e shell install MetasploitExpress::Parser
For more information on module installation, please visit the detailed CPAN module installation guide.