Class: Arachni::AuditStore

Inherits:
Object
  • Object
show all
Defined in:
lib/audit_store.rb

Overview

Arachni::AuditStore class

Represents a finished audit session.
It holds information about the runtime environment, the results of the audit etc…

@author: Anastasios “Zapotek” Laskos

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

@version: 0.1-pre

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (AuditStore) initialize(audit = {})

A new instance of AuditStore



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/audit_store.rb', line 69

def initialize( audit = {} )
    
    # set instance variables from audit opts
    audit.each {
        |k, v|
        self.instance_variable_set( '@' + k, v )
    }
    
    @options         = prepare_options( @options )
    @vulns           = prepare_variations( @vulns )
    @start_datetime  = @options['start_datetime'].asctime
    @finish_datetime = @options['finish_datetime'].asctime
    @delta_time      = secs_to_hms( @options['delta_time'] )
end

Instance Attribute Details

- (String) delta_time (readonly)

How long the audit took

Returns:

  • (String)

    how long the audit took



67
68
69
# File 'lib/audit_store.rb', line 67

def delta_time
  @delta_time
end

- (String) finish_datetime (readonly)

The date and time when the audit finished

Returns:

  • (String)

    the date and time when the audit finished



62
63
64
# File 'lib/audit_store.rb', line 62

def finish_datetime
  @finish_datetime
end

- (Hash) options (readonly)

The runtime arguments/options of the environment

Returns:

  • (Hash)

    the runtime arguments/options of the environment



42
43
44
# File 'lib/audit_store.rb', line 42

def options
  @options
end

- (String) revision (readonly)

The SVN revision of the framework

Returns:

  • (String)

    the SVN revision of the framework



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

def revision
  @revision
end

- (Array) sitemap (readonly)

All the urls crawled

Returns:

  • (Array)

    all the urls crawled



47
48
49
# File 'lib/audit_store.rb', line 47

def sitemap
  @sitemap
end

- (String) start_datetime (readonly)

The date and time when the audit started

Returns:

  • (String)

    the date and time when the audit started



57
58
59
# File 'lib/audit_store.rb', line 57

def start_datetime
  @start_datetime
end

- (String) version (readonly)

The version of the framework

Returns:

  • (String)

    the version of the framework



32
33
34
# File 'lib/audit_store.rb', line 32

def version
  @version
end

- (Array<Vulnerability>) vulns (readonly)

The discovered vulnerabilities

Returns:



52
53
54
# File 'lib/audit_store.rb', line 52

def vulns
  @vulns
end

Class Method Details

+ (AuditStore) load(file)

Loads and returns an AuditStore object from file

Parameters:

  • (String) file

    the file to load

Returns:



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

def AuditStore.load( file )
     YAML::load( IO.read( file ) )
end

Instance Method Details

- (Object) save(file)

Saves ‘self’ to file

Parameters:

  • (String) file


100
101
102
103
# File 'lib/audit_store.rb', line 100

def save( file )
    f = File.open( file, 'w' )
    YAML.dump( self, f )
end

- (Hash) to_h

Returns ‘self’ and all objects in its instance vars as hashes

Returns:

  • (Hash)


110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/audit_store.rb', line 110

def to_h

    hash = obj_to_hash( self )
    
    vulns = []
    hash['vulns'].each { 
        |vuln|
        vulns << obj_to_hash( vuln )
    }
    
    hash['vulns'] = vulns
    return hash
end