Class: Arachni::RPC::XML::Server::Framework

Inherits:
Framework show all
Defined in:
lib/rpc/xml/server/framework.rb

Overview

Extends the Framework adding XML-RPC specific functionality

@author: Tasos “Zapotek” Laskos

<[email protected]>
<[email protected]>

@version: 0.1.1

Constant Summary

Constants inherited from Framework

Framework::REVISION

Instance Attribute Summary

Attributes inherited from Framework

#auditmap, #http, #modules, #opts, #page_queue, #plugins, #reports, #sitemap, #spider

Instance Method Summary collapse

Methods inherited from Framework

#audit, #audit_queue, #audit_store, #lsmod, #lsrep, #pause!, #paused?, #plugin_store, #resume!, #revision, #running?, #stats, #version

Methods included from Mixins::Observable

#method_missing

Methods included from Module::Utilities

#exception_jail, #get_path, #normalize_url, #read_file, #seed

Methods included from UI::Output

#buffer, #debug!, #flush_buffer, #mute!, #muted?, #only_positives!, #only_positives?, #print_debug, #print_debug_backtrace, #print_debug_pp, #print_error, #print_error_backtrace, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #reroute_to_file, #reroute_to_file?, #unmute!, #verbose!

Constructor Details

#initialize(opts) ⇒ Framework

Returns a new instance of Framework.



89
90
91
92
93
# File 'lib/rpc/xml/server/framework.rb', line 89

def initialize( opts )
    super( opts )
    @modules = Arachni::RPC::XML::Server::Module::Manager.new( opts )
    @plugins = Arachni::RPC::XML::Server::Plugin::Manager.new( self )
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Arachni::Mixins::Observable

Instance Method Details

#abort!Object

Aborts the running audit.



44
45
46
47
# File 'lib/rpc/xml/server/framework.rb', line 44

def abort!
    @job.kill
    return true
end

#auditstoreYAML

Returns the results of the audit as a serialized AuditStore object.

Returns:

  • (YAML)

    YAML dump of the AuditStore



162
163
164
165
166
167
168
169
170
171
# File 'lib/rpc/xml/server/framework.rb', line 162

def auditstore
    exception_jail {
        return false if !@job

        store =  audit_store( true )
        store.framework = nil

        return YAML.dump( store )
    }
end

#busy?Bool Also known as: is_busy

Checks to see if an audit is running.

Returns:

  • (Bool)


54
55
56
57
# File 'lib/rpc/xml/server/framework.rb', line 54

def busy?
    return false if !@job
    return @job.alive?
end

#debug?Boolean Also known as: is_debug

Checks whether the framework is in debug mode

Returns:

  • (Boolean)


62
63
64
# File 'lib/rpc/xml/server/framework.rb', line 62

def debug?
    @@debug
end

#debug_offObject

Disables debugging output



183
184
185
# File 'lib/rpc/xml/server/framework.rb', line 183

def debug_off
    @@debug = false
end

#debug_onObject

Enables debugging output



176
177
178
# File 'lib/rpc/xml/server/framework.rb', line 176

def debug_on
    @@debug = true
end

#lsplugArray<Hash>

Returns an array of hashes with information about all available reports

Returns:

  • (Array<Hash>)


101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/rpc/xml/server/framework.rb', line 101

def lsplug

    plug_info = []

    @plugins.available( ).each {
        |plugin|

        info = @plugins[plugin].info

        info[:plug_name]   = plugin
        info[:path]        = @plugins.name_to_path( plugin )

        info[:options] = [info[:options]].flatten.compact.map {
            |opt|
            opt_h = opt.to_h
            opt_h['default'] = '' if opt_h['default'].nil?
            opt_h['type']    = opt.type
            opt_h
        }

        plug_info << info
    }

    @plugins.clear( )

    return plug_info
end

#reportYAML

Returns the results of the audit.

Returns:

  • (YAML)

    YAML dump of the results hash



147
148
149
150
151
152
153
154
155
# File 'lib/rpc/xml/server/framework.rb', line 147

def report
    exception_jail {
        return false if !@job

        store =  audit_store( true )
        store.framework = ''
        return YAML.dump( store.to_h.dup )
    }
end

#runObject

Starts the audit.

The audit is started in a new thread to avoid service blocking.



135
136
137
138
139
140
# File 'lib/rpc/xml/server/framework.rb', line 135

def run
    @job = Thread.new {
        exception_jail { old_run }
    }
    return true
end

#verbose?Boolean Also known as: is_verbose

Checks whether the framework is in debug mode

Returns:

  • (Boolean)


69
70
71
# File 'lib/rpc/xml/server/framework.rb', line 69

def verbose?
    @@verbose
end

#verbose_offObject

Disables debugging output



197
198
199
# File 'lib/rpc/xml/server/framework.rb', line 197

def verbose_off
    @@verbose = false
end

#verbose_onObject

Enables debugging output



190
191
192
# File 'lib/rpc/xml/server/framework.rb', line 190

def verbose_on
    @@verbose = true
end