Class: Arachni::AuditStore
Overview
Arachni::AuditStore class
Represents a finished audit session.<br/> It holds information about the runtime environment, the results of the audit etc…
@author: Tasos “Zapotek” Laskos
<[email protected]>
<[email protected]>
@version: 0.1.1
Constant Summary collapse
- ORDER =
[ ::Arachni::Issue::Severity::HIGH, ::Arachni::Issue::Severity::MEDIUM, ::Arachni::Issue::Severity::LOW, ::Arachni::Issue::Severity::INFORMATIONAL ]
Instance Attribute Summary collapse
-
#delta_time ⇒ String
readonly
How long the audit took.
-
#finish_datetime ⇒ String
readonly
The date and time when the audit finished.
-
#framework ⇒ Object
Returns the value of attribute framework.
-
#issues ⇒ Array<Issue>
readonly
The discovered issues.
-
#options ⇒ Hash
readonly
The runtime arguments/options of the environment.
-
#plugins ⇒ Object
readonly
Returns the value of attribute plugins.
-
#revision ⇒ String
readonly
The revision of the framework class.
-
#sitemap ⇒ Array
readonly
All the urls crawled.
-
#start_datetime ⇒ String
readonly
The date and time when the audit started.
-
#version ⇒ String
readonly
The version of the framework.
Class Method Summary collapse
-
.load(file) ⇒ AuditStore
Loads and returns an AuditStore object from file.
Instance Method Summary collapse
-
#initialize(audit = {}, framework) ⇒ AuditStore
constructor
A new instance of AuditStore.
-
#save(file) ⇒ Object
Saves ‘self’ to file.
-
#to_h ⇒ Hash
Returns ‘self’ and all objects in its instance vars as hashes.
Constructor Details
#initialize(audit = {}, framework) ⇒ AuditStore
Returns a new instance of AuditStore.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/audit_store.rb', line 82 def initialize( audit = {}, framework ) @framework = framework # set instance variables from audit opts audit.each { |k, v| self.instance_variable_set( '@' + k.to_s, v ) } @options = ( @options ) @issues = sort( prepare_variations( @issues ) ) @start_datetime = @options['start_datetime'].asctime if @options['finish_datetime'] @finish_datetime = @options['finish_datetime'].asctime else @finish_datetime = Time.now.asctime end @delta_time = secs_to_hms( @options['delta_time'] ) end |
Instance Attribute Details
#delta_time ⇒ String (readonly)
Returns how long the audit took.
70 71 72 |
# File 'lib/audit_store.rb', line 70 def delta_time @delta_time end |
#finish_datetime ⇒ String (readonly)
Returns the date and time when the audit finished.
65 66 67 |
# File 'lib/audit_store.rb', line 65 def finish_datetime @finish_datetime end |
#framework ⇒ Object
Returns the value of attribute framework.
72 73 74 |
# File 'lib/audit_store.rb', line 72 def framework @framework end |
#issues ⇒ Array<Issue> (readonly)
Returns the discovered issues.
53 54 55 |
# File 'lib/audit_store.rb', line 53 def issues @issues end |
#options ⇒ Hash (readonly)
Returns the runtime arguments/options of the environment.
43 44 45 |
# File 'lib/audit_store.rb', line 43 def @options end |
#plugins ⇒ Object (readonly)
Returns the value of attribute plugins.
55 56 57 |
# File 'lib/audit_store.rb', line 55 def plugins @plugins end |
#revision ⇒ String (readonly)
Returns the revision of the framework class.
38 39 40 |
# File 'lib/audit_store.rb', line 38 def revision @revision end |
#sitemap ⇒ Array (readonly)
Returns all the urls crawled.
48 49 50 |
# File 'lib/audit_store.rb', line 48 def sitemap @sitemap end |
#start_datetime ⇒ String (readonly)
Returns the date and time when the audit started.
60 61 62 |
# File 'lib/audit_store.rb', line 60 def start_datetime @start_datetime end |
#version ⇒ String (readonly)
Returns the version of the framework.
33 34 35 |
# File 'lib/audit_store.rb', line 33 def version @version end |
Class Method Details
.load(file) ⇒ AuditStore
Loads and returns an AuditStore object from file
113 114 115 116 117 118 119 |
# File 'lib/audit_store.rb', line 113 def AuditStore.load( file ) begin Marshal.load( IO.read( file ) ) rescue YAML.load( IO.read( file ) ) end end |
Instance Method Details
#save(file) ⇒ Object
Saves ‘self’ to file
126 127 128 129 130 131 132 133 134 |
# File 'lib/audit_store.rb', line 126 def save( file ) @framework = '' f = File.open( file, 'w' ) begin Marshal.dump( self, f ) rescue YAML.dump( self, f ) end end |
#to_h ⇒ Hash
Returns ‘self’ and all objects in its instance vars as hashes
141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/audit_store.rb', line 141 def to_h hash = obj_to_hash( self ) issues = [] hash['issues'].each { |issue| issues << obj_to_hash( issue ) } hash['issues'] = issues return hash end |