Class: Alert

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_doc) ⇒ Alert

Returns a new instance of Alert.



13
14
15
16
17
18
19
# File 'lib/sdee.rb', line 13

def initialize(xml_doc)
  @doc = xml_doc

  build_alert
  build_sig
  build_participants 
end

Instance Attribute Details

#alert_timeObject

Returns the value of attribute alert_time.



8
9
10
# File 'lib/sdee.rb', line 8

def alert_time
  @alert_time
end

#attackerObject

Returns the value of attribute attacker.



8
9
10
# File 'lib/sdee.rb', line 8

def attacker
  @attacker
end

#attacker_localityObject

Returns the value of attribute attacker_locality.



8
9
10
# File 'lib/sdee.rb', line 8

def attacker_locality
  @attacker_locality
end

#attacker_portObject

Returns the value of attribute attacker_port.



8
9
10
# File 'lib/sdee.rb', line 8

def attacker_port
  @attacker_port
end

#event_idObject

Returns the value of attribute event_id.



8
9
10
# File 'lib/sdee.rb', line 8

def event_id
  @event_id
end

#originatorObject

Returns the value of attribute originator.



8
9
10
# File 'lib/sdee.rb', line 8

def originator
  @originator
end

#protocolObject

Returns the value of attribute protocol.



8
9
10
# File 'lib/sdee.rb', line 8

def protocol
  @protocol
end

#risk_ratingObject

Returns the value of attribute risk_rating.



8
9
10
# File 'lib/sdee.rb', line 8

def risk_rating
  @risk_rating
end

#severityObject

Returns the value of attribute severity.



8
9
10
# File 'lib/sdee.rb', line 8

def severity
  @severity
end

#sig_detailObject

Returns the value of attribute sig_detail.



8
9
10
# File 'lib/sdee.rb', line 8

def sig_detail
  @sig_detail
end

#sig_idObject

Returns the value of attribute sig_id.



8
9
10
# File 'lib/sdee.rb', line 8

def sig_id
  @sig_id
end

#sig_versionObject

Returns the value of attribute sig_version.



8
9
10
# File 'lib/sdee.rb', line 8

def sig_version
  @sig_version
end

#subsig_idObject

Returns the value of attribute subsig_id.



8
9
10
# File 'lib/sdee.rb', line 8

def subsig_id
  @subsig_id
end

#target_localityObject

Returns the value of attribute target_locality.



8
9
10
# File 'lib/sdee.rb', line 8

def target_locality
  @target_locality
end

#target_portObject

Returns the value of attribute target_port.



8
9
10
# File 'lib/sdee.rb', line 8

def target_port
  @target_port
end

#targetsObject

Returns the value of attribute targets.



8
9
10
# File 'lib/sdee.rb', line 8

def targets
  @targets
end

#threat_ratingObject

Returns the value of attribute threat_rating.



8
9
10
# File 'lib/sdee.rb', line 8

def threat_rating
  @threat_rating
end

Instance Method Details

#to_hashObject



21
22
23
24
25
26
27
28
29
# File 'lib/sdee.rb', line 21

def to_hash
  vars = {}

  instance_variables.reject {|var| var == :@doc }.each do |var|
    vars[var.to_s[1..-1]] = instance_variable_get(var)
  end

  vars
end

#to_jsonObject



31
32
33
# File 'lib/sdee.rb', line 31

def to_json
  to_hash.to_json
end