Class: Nexpose::SyslogAlert

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

Overview

Description

Object that represents a Syslog Alert.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Sanitize

#replace_entities

Constructor Details

#initialize(name, server, enabled = 1) ⇒ SyslogAlert

Returns a new instance of SyslogAlert.



1768
1769
1770
1771
1772
1773
1774
1775
1776
# File 'lib/nexpose.rb', line 1768

def initialize(name, server, enabled = 1)
	@type = :syslog
	@name = name
	@server = server
	@enabled = enabled
	# Sets default vuln filter - All Events
	setVulnFilter(VulnFilter.new("50790400",1))

end

Instance Attribute Details

#enabledObject (readonly)

If this alert is enabled or not



1760
1761
1762
# File 'lib/nexpose.rb', line 1760

def enabled
  @enabled
end

#nameObject (readonly)

A unique name for this alert



1758
1759
1760
# File 'lib/nexpose.rb', line 1758

def name
  @name
end

#serverObject (readonly)

The Syslog server to sent this alert



1762
1763
1764
# File 'lib/nexpose.rb', line 1762

def server
  @server
end

#typeObject (readonly)

The alert type



1766
1767
1768
# File 'lib/nexpose.rb', line 1766

def type
  @type
end

#vulnFilterObject (readonly)

The vulnerability filter to trigger the alert



1764
1765
1766
# File 'lib/nexpose.rb', line 1764

def vulnFilter
  @vulnFilter
end

Instance Method Details

#setVulnFilter(vulnFilter) ⇒ Object

Sets the Vulnerability Filter for this alert.



1779
1780
1781
# File 'lib/nexpose.rb', line 1779

def setVulnFilter(vulnFilter)
	@vulnFilter = vulnFilter
end

#to_xmlObject



1784
1785
1786
1787
1788
1789
1790
1791
1792
# File 'lib/nexpose.rb', line 1784

def to_xml
	xml = "<syslogAlert"
	xml << %Q{ name="#{replace_entities(name)}"}
	xml << %Q{ enabled="#{replace_entities(enabled)}"}
	xml << %Q{ server="#{replace_entities(server)}">}
	xml << vulnFilter.to_xml
	xml << "</syslogAlert>"
	xml
end