Class: Nexpose::SNMPAlert
- Inherits:
-
Object
- Object
- Nexpose::SNMPAlert
- Includes:
- Sanitize
- Defined in:
- lib/nexpose/site.rb
Overview
Description
Object that represents an SNMP Alert.
Instance Attribute Summary collapse
-
#community ⇒ Object
readonly
The community string.
-
#enabled ⇒ Object
readonly
If this alert is enabled or not.
-
#name ⇒ Object
readonly
A unique name for this alert.
-
#server ⇒ Object
readonly
The SNMP server to sent this alert.
-
#type ⇒ Object
readonly
The alert type.
-
#vuln_filter ⇒ Object
readonly
The vulnerability filter to trigger the alert.
Instance Method Summary collapse
-
#initialize(name, community, server, enabled = 1) ⇒ SNMPAlert
constructor
A new instance of SNMPAlert.
- #to_xml ⇒ Object
Methods included from Sanitize
Constructor Details
#initialize(name, community, server, enabled = 1) ⇒ SNMPAlert
Returns a new instance of SNMPAlert.
608 609 610 611 612 613 614 615 616 |
# File 'lib/nexpose/site.rb', line 608 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
#community ⇒ Object (readonly)
The community string
600 601 602 |
# File 'lib/nexpose/site.rb', line 600 def community @community end |
#enabled ⇒ Object (readonly)
If this alert is enabled or not
598 599 600 |
# File 'lib/nexpose/site.rb', line 598 def enabled @enabled end |
#name ⇒ Object (readonly)
A unique name for this alert
596 597 598 |
# File 'lib/nexpose/site.rb', line 596 def name @name end |
#server ⇒ Object (readonly)
The SNMP server to sent this alert
602 603 604 |
# File 'lib/nexpose/site.rb', line 602 def server @server end |
#type ⇒ Object (readonly)
The alert type
606 607 608 |
# File 'lib/nexpose/site.rb', line 606 def type @type end |
#vuln_filter ⇒ Object (readonly)
The vulnerability filter to trigger the alert
604 605 606 |
# File 'lib/nexpose/site.rb', line 604 def vuln_filter @vuln_filter end |
Instance Method Details
#to_xml ⇒ Object
618 619 620 621 622 623 624 625 626 627 |
# File 'lib/nexpose/site.rb', line 618 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 |