Class: Arachni::Options

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/options.rb

Overview

Options class.

Implements the Singleton pattern and formaly defines all of Arachni’s runtime options.

@author: Anastasios “Zapotek” Laskos

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

@version: $Rev: 352 $

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Options) initialize

A new instance of Options



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/options.rb', line 325

def initialize( )
    
    # nil everything out
    self.instance_variables.each {
        |var|
        send( "#{var}=", nil )
    }
    
    @exclude    = []
    @include    = []
    @redundant  = []
    @reports    = []
    @repopts    = Hash.new
    @dir        = Hash.new
    @exclude_cookies    = []
    
end

Instance Attribute Details

- (Bool) arachni_verbose

Be verbose?

Returns:

  • (Bool)


70
71
72
# File 'lib/options.rb', line 70

def arachni_verbose
  @arachni_verbose
end

- (Bool) audit_cookies

Should Arachni audit cookies?

Returns:

  • (Bool)


157
158
159
# File 'lib/options.rb', line 157

def audit_cookies
  @audit_cookies
end

- (Bool) audit_forms

Should Arachni audit forms?

Returns:

  • (Bool)


150
151
152
# File 'lib/options.rb', line 150

def audit_forms
  @audit_forms
end

- (Bool) audit_headers

Should Arachni audit HTTP headers?

Returns:

  • (Bool)


164
165
166
# File 'lib/options.rb', line 164

def audit_headers
  @audit_headers
end

Should Arachni audit links?

Returns:

  • (Bool)


143
144
145
# File 'lib/options.rb', line 143

def audit_links
  @audit_links
end

- (String) authed_by

The person that authorized the scan
It will be added to the HTTP “user-agent” and “from” headers.

Returns:

  • (String)


221
222
223
# File 'lib/options.rb', line 221

def authed_by
  @authed_by
end

Location of the cookiejar

Returns:

  • (String)


272
273
274
# File 'lib/options.rb', line 272

def cookie_jar
  @cookie_jar
end

- (Hash) cookies

To be populated by the framework

Parsed cookiejar cookies

Returns:

  • (Hash)

    name=>value pairs



265
266
267
# File 'lib/options.rb', line 265

def cookies
  @cookies
end

- (Bool) debug

Output debugging messages?

Returns:

  • (Bool)


77
78
79
# File 'lib/options.rb', line 77

def debug
  @debug
end

- (Object) delta_time

to be populated by the framework



323
324
325
# File 'lib/options.rb', line 323

def delta_time
  @delta_time
end

- (Integer) depth_limit

How deep to go in the site structure?
If nil, depth_limit = inf

Returns:

  • (Integer)


99
100
101
# File 'lib/options.rb', line 99

def depth_limit
  @depth_limit
end

- (Hash) dir

Holds absolute paths for the directory structure of the framework

Returns:

  • (Hash)


37
38
39
# File 'lib/options.rb', line 37

def dir
  @dir
end

- (Array) exclude

Exclude filters
URL matching any of these patterns won’t be followed

Returns:

  • (Array)


287
288
289
# File 'lib/options.rb', line 287

def exclude
  @exclude
end

- (Array) exclude_cookies

Cookies to exclude from audit

Returns:

  • (Array)


294
295
296
# File 'lib/options.rb', line 294

def exclude_cookies
  @exclude_cookies
end

- (Object) finish_datetime

to be populated by the framework



321
322
323
# File 'lib/options.rb', line 321

def finish_datetime
  @finish_datetime
end

- (Bool) follow_subdomains

Should the crawler follow subdomains?

Returns:

  • (Bool)


309
310
311
# File 'lib/options.rb', line 309

def 
  @follow_subdomains
end

- (Bool) help

Show help?

Returns:

  • (Bool)


51
52
53
# File 'lib/options.rb', line 51

def help
  @help
end

- (Array) include

Include filters
Only URLs that match any of these patterns will be followed

Returns:

  • (Array)


302
303
304
# File 'lib/options.rb', line 302

def include
  @include
end

How many links to follow? If nil, link_count_limit = inf

Returns:

  • (Integer)


107
108
109
# File 'lib/options.rb', line 107

def link_count_limit
  @link_count_limit
end

- (String) load_profile

Location of an Arachni Framework Profile (.afp) file to load

Returns:

  • (String)


213
214
215
# File 'lib/options.rb', line 213

def load_profile
  @load_profile
end

- (Bool) lsmod

List modules and exit?

Returns:

  • (Bool)


122
123
124
# File 'lib/options.rb', line 122

def lsmod
  @lsmod
end

- (Bool) lsrep

List reports and exit?

Returns:

  • (Bool)


129
130
131
# File 'lib/options.rb', line 129

def lsrep
  @lsrep
end

- (Array) mods

Array of modules to load

Returns:

  • (Array)


171
172
173
# File 'lib/options.rb', line 171

def mods
  @mods
end

- (Bool) mods_run_last

Run the modules after the crawl/analysis?

Returns:

  • (Bool)


316
317
318
# File 'lib/options.rb', line 316

def mods_run_last
  @mods_run_last
end

- (Bool) obey_robots_txt

Should the crawler obery robots.txt files?

Returns:

  • (Bool)


91
92
93
# File 'lib/options.rb', line 91

def obey_robots_txt
  @obey_robots_txt
end

- (Bool) only_positives

Output only positive results during the audit?

Returns:

  • (Bool)


58
59
60
# File 'lib/options.rb', line 58

def only_positives
  @only_positives
end

- (String) proxy_addr

The address of the proxy server

Returns:

  • (String)


228
229
230
# File 'lib/options.rb', line 228

def proxy_addr
  @proxy_addr
end

- (String) proxy_pass

The proxy password

Returns:

  • (String)


242
243
244
# File 'lib/options.rb', line 242

def proxy_pass
  @proxy_pass
end

- (String) proxy_port

The port to connect on the proxy server

Returns:

  • (String)


235
236
237
# File 'lib/options.rb', line 235

def proxy_port
  @proxy_port
end

- (String) proxy_type

The proxy type

Returns:

  • (String)

    [http, socks]



256
257
258
# File 'lib/options.rb', line 256

def proxy_type
  @proxy_type
end

- (String) proxy_user

The proxy user

Returns:

  • (String)


249
250
251
# File 'lib/options.rb', line 249

def proxy_user
  @proxy_user
end

- (Integer) redirect_limit

How many redirects to follow? If nil, redirect_limit = inf

Returns:

  • (Integer)


115
116
117
# File 'lib/options.rb', line 115

def redirect_limit
  @redirect_limit
end

- (Array) redundant

Filters for redundant links

Returns:

  • (Array)


84
85
86
# File 'lib/options.rb', line 84

def redundant
  @redundant
end

- (String) repload

Location of an Arachni Framework Report (.afr) file to load

Returns:

  • (String)


185
186
187
# File 'lib/options.rb', line 185

def repload
  @repload
end

- (Hash) repopts

Options to be passed to the reports

Returns:

  • (Hash)

    name=>value pairs



199
200
201
# File 'lib/options.rb', line 199

def repopts
  @repopts
end

- (Array) reports

Array of reports to load

Returns:

  • (Array)


178
179
180
# File 'lib/options.rb', line 178

def reports
  @reports
end

- (String) repsave

Where to save the Arachni Framework Report (.afr) file

Returns:

  • (String)


192
193
194
# File 'lib/options.rb', line 192

def repsave
  @repsave
end

- (Object) resume

Not implemented



63
64
65
# File 'lib/options.rb', line 63

def resume
  @resume
end

- (String) save_profile

Where to save the Arachni Framework Profile (.afp) file

Returns:

  • (String)


206
207
208
# File 'lib/options.rb', line 206

def save_profile
  @save_profile
end

- (Object) start_datetime

to be populated by the framework



319
320
321
# File 'lib/options.rb', line 319

def start_datetime
  @start_datetime
end

- (Integer) threads

How many threads to spawn?

Returns:

  • (Integer)


136
137
138
# File 'lib/options.rb', line 136

def threads
  @threads
end

- (String, URI) url

The URL to audit

Returns:

  • (String, URI)


44
45
46
# File 'lib/options.rb', line 44

def url
  @url
end

- (String) user_agent

The HTTP user-agent to use

Returns:

  • (String)


279
280
281
# File 'lib/options.rb', line 279

def user_agent
  @user_agent
end

Instance Method Details

- (Object) merge!(options)

Merges self with the object in ‘options’

Parameters:



362
363
364
365
366
367
# File 'lib/options.rb', line 362

def merge!( options )
    options.to_h.each_pair {
        |k, v|
        send( "#{k}=", v ) if v
    }
end

- (Hash) to_h

Converts the Options object to hash

Returns:

  • (Hash)


348
349
350
351
352
353
354
355
# File 'lib/options.rb', line 348

def to_h
    hash = Hash.new
    self.instance_variables.each {
        |var|
        hash[normalize_name( var )] = self.instance_variable_get( var ) 
    }
    hash
end