Class: Nexpose::SNMPAlert

Inherits:
Object
  • Object
show all
Includes:
Sanitize
Defined in:
lib/nexpose/site.rb

Overview

Description

Object that represents an SNMP Alert.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Sanitize

#replace_entities

Constructor Details

#initialize(name, community, server, enabled = 1) ⇒ SNMPAlert

Returns a new instance of SNMPAlert.



625
626
627
628
629
630
631
632
633
# File 'lib/nexpose/site.rb', line 625

def initialize(name, community, server, enabled = 1)
  @type = :snmp
  @name = name
  @community = community
  @server = server
  @enabled = enabled
  # Sets default vuln filter - All Events
  @vuln_filter = VulnFilter.new('50790400', 1)
end

Instance Attribute Details

#communityObject (readonly)

The community string



617
618
619
# File 'lib/nexpose/site.rb', line 617

def community
  @community
end

#enabledObject (readonly)

If this alert is enabled or not



615
616
617
# File 'lib/nexpose/site.rb', line 615

def enabled
  @enabled
end

#nameObject (readonly)

A unique name for this alert



613
614
615
# File 'lib/nexpose/site.rb', line 613

def name
  @name
end

#serverObject (readonly)

The SNMP server to sent this alert



619
620
621
# File 'lib/nexpose/site.rb', line 619

def server
  @server
end

#typeObject (readonly)

The alert type



623
624
625
# File 'lib/nexpose/site.rb', line 623

def type
  @type
end

#vuln_filterObject (readonly)

The vulnerability filter to trigger the alert



621
622
623
# File 'lib/nexpose/site.rb', line 621

def vuln_filter
  @vuln_filter
end

Instance Method Details

#to_xmlObject



635
636
637
638
639
640
641
642
643
644
# File 'lib/nexpose/site.rb', line 635

def to_xml
  xml = '<snmpAlert'
  xml << %Q{ name="#{replace_entities(name)}"}
  xml << %Q{ enabled="#{replace_entities(enabled)}"}
  xml << %Q{ community="#{replace_entities(community)}"}
  xml << %Q{ server="#{replace_entities(server)}">}
  xml << vuln_filter.to_xml
  xml << '</snmpAlert>'
  xml
end