Class: Nexpose::SnmpAlert
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.
-
#vulnFilter ⇒ 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.
-
#setVulnFilter(vulnFilter) ⇒ Object
Sets the Vulnerability Filter for this alert.
- #to_xml ⇒ Object
Methods included from Sanitize
Constructor Details
#initialize(name, community, server, enabled = 1) ⇒ SnmpAlert
Returns a new instance of SnmpAlert.
1246 1247 1248 1249 1250 1251 1252 1253 1254 |
# File 'lib/nexpose.rb', line 1246 def initialize(name, community, server, enabled = 1) @type = :snmp @name = name @community = community @server = server @enabled = enabled # Sets default vuln filter - All Events setVulnFilter(VulnFilter.new("50790400",1)) end |
Instance Attribute Details
#community ⇒ Object (readonly)
The community string
1238 1239 1240 |
# File 'lib/nexpose.rb', line 1238 def community @community end |
#enabled ⇒ Object (readonly)
If this alert is enabled or not
1236 1237 1238 |
# File 'lib/nexpose.rb', line 1236 def enabled @enabled end |
#name ⇒ Object (readonly)
A unique name for this alert
1234 1235 1236 |
# File 'lib/nexpose.rb', line 1234 def name @name end |
#server ⇒ Object (readonly)
The SNMP server to sent this alert
1240 1241 1242 |
# File 'lib/nexpose.rb', line 1240 def server @server end |
#type ⇒ Object (readonly)
The alert type
1244 1245 1246 |
# File 'lib/nexpose.rb', line 1244 def type @type end |
#vulnFilter ⇒ Object (readonly)
The vulnerability filter to trigger the alert
1242 1243 1244 |
# File 'lib/nexpose.rb', line 1242 def vulnFilter @vulnFilter end |
Instance Method Details
#setVulnFilter(vulnFilter) ⇒ Object
Sets the Vulnerability Filter for this alert.
1257 1258 1259 |
# File 'lib/nexpose.rb', line 1257 def setVulnFilter(vulnFilter) @vulnFilter = vulnFilter end |
#to_xml ⇒ Object
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 |
# File 'lib/nexpose.rb', line 1262 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 << vulnFilter.to_xml xml << "</snmpAlert>" xml end |