Class: Arachni::Modules::Recon::ExtractObjects

Inherits:
Arachni::Module::Base show all
Includes:
Arachni::Module::Registrar, Arachni::UI::Output
Defined in:
modules/recon/extract_objects.rb

Overview

This is a discovery/data mining example module.

It extracts all object elements from a webpage
and adds them to module storage to be used by other modules later on.

It will also show you how to use the module data storage system.

Such modules can be used for general data mining or discovery
and then pass their data to the system to be used by other modules.

@author: Anastasios “Zapotek” Laskos

                                     <tasos.laskos@gmail.com>
                                     <zapotek@segfault.gr>

@version: $Rev: 371 $

See Also:

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from Arachni::Module::Registrar

#add_storage, #get_storage, #get_store, included, #register_results

Methods included from Arachni::UI::Output

#debug!, #debug?, #only_positives!, #only_positives?, #print_debug, #print_debug_backtrace, #print_debug_pp, #print_error, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #verbose!, #verbose?

Methods inherited from Arachni::Module::Base

#clean_up, deps, #get_cookie_simple, #get_cookies, #get_cookies_simple, #get_data_file, #get_form_simple, #get_forms, #get_forms_simple, #get_links, #get_links_simple, #get_request_headers, #get_response_headers, #prepare

Methods included from Arachni::Module::Auditor

#audit_cookies, #audit_forms, #audit_headers, #audit_links, #get_matches, #inject_each_var

Methods included from Arachni::Module::Trainer

#train

Methods included from Arachni::Module::ElementDB

#init_cookies, #init_forms, #init_links, #update_cookies, #update_forms, #update_links, #work_on_cookies, #work_on_forms, #work_on_links

Constructor Details

- (ExtractObjects) initialize(page)

A new instance of ExtractObjects



42
43
44
45
# File 'modules/recon/extract_objects.rb', line 42

def initialize( page )
    # in this case we don't need to call the parent
    @page = page
end

Class Method Details

+ (Object) info



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'modules/recon/extract_objects.rb', line 62

def self.info
    {
        'Name'           => 'ExtractObjects',
        'Description'    => %q{Extracts all 'object' elements from a webpage.},
        'Elements'       => [],
        'Author'         => 'zapotek',
        'Version'        => '$Rev: 371 $',
        'References'     => {
            
        },
        'Targets'        => { 'Generic' => 'all' },
    }
end

Instance Method Details

- (Object) run



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'modules/recon/extract_objects.rb', line 47

def run( )

    # get all objects from the HTML code 
    @__objects = @page.html.scan( /<object(.*?)<\/object>/ixm )

    #
    # add the object elements to storage
    #
    # you can use whatever key you want when saving data
    # but it's best to use the class name...keeps things tidy
    #
    add_storage( self.class.info['Name'], @__objects )
end