Class: Nexpose::SMTPAlert
- Inherits:
-
Object
- Object
- Nexpose::SMTPAlert
- Includes:
- Sanitize
- Defined in:
- lib/nexpose/site.rb
Overview
Description
Object that represents an SMTP (Email) Alert.
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
If this alert is enabled or not.
-
#limitText ⇒ Object
readonly
Limit the text for mobile devices.
-
#name ⇒ Object
readonly
A unique name for this alert.
-
#recipients ⇒ Object
readonly
Array containing Strings of email addresses Array of strings with the email addresses of the intended recipients.
-
#sender ⇒ Object
readonly
The email address of the sender.
-
#type ⇒ Object
readonly
The alert type.
-
#vulnFilter ⇒ Object
readonly
The vulnerability filter to trigger the alert.
Instance Method Summary collapse
-
#addRecipient(recipient) ⇒ Object
Adds a new Recipient to the recipients array.
-
#initialize(name, sender, limitText, enabled = 1) ⇒ SMTPAlert
constructor
A new instance of SMTPAlert.
-
#setVulnFilter(vulnFilter) ⇒ Object
Sets the Vulnerability Filter for this alert.
- #to_xml ⇒ Object
Methods included from Sanitize
Constructor Details
#initialize(name, sender, limitText, enabled = 1) ⇒ SMTPAlert
Returns a new instance of SMTPAlert.
714 715 716 717 718 719 720 721 722 723 |
# File 'lib/nexpose/site.rb', line 714 def initialize(name, sender, limitText, enabled = 1) @type = :smtp @name = name @sender = sender @enabled = enabled @limitText = limitText @recipients = [] # Sets default vuln filter - All Events setVulnFilter(VulnFilter.new("50790400", 1)) end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
If this alert is enabled or not
701 702 703 |
# File 'lib/nexpose/site.rb', line 701 def enabled @enabled end |
#limitText ⇒ Object (readonly)
Limit the text for mobile devices
705 706 707 |
# File 'lib/nexpose/site.rb', line 705 def limitText @limitText end |
#name ⇒ Object (readonly)
A unique name for this alert
699 700 701 |
# File 'lib/nexpose/site.rb', line 699 def name @name end |
#recipients ⇒ Object (readonly)
Array containing Strings of email addresses Array of strings with the email addresses of the intended recipients
708 709 710 |
# File 'lib/nexpose/site.rb', line 708 def recipients @recipients end |
#sender ⇒ Object (readonly)
The email address of the sender
703 704 705 |
# File 'lib/nexpose/site.rb', line 703 def sender @sender end |
#type ⇒ Object (readonly)
The alert type
712 713 714 |
# File 'lib/nexpose/site.rb', line 712 def type @type end |
#vulnFilter ⇒ Object (readonly)
The vulnerability filter to trigger the alert
710 711 712 |
# File 'lib/nexpose/site.rb', line 710 def vulnFilter @vulnFilter end |
Instance Method Details
#addRecipient(recipient) ⇒ Object
Adds a new Recipient to the recipients array
726 727 728 |
# File 'lib/nexpose/site.rb', line 726 def addRecipient(recipient) @recipients.push(recipient) end |
#setVulnFilter(vulnFilter) ⇒ Object
Sets the Vulnerability Filter for this alert.
731 732 733 |
# File 'lib/nexpose/site.rb', line 731 def setVulnFilter(vulnFilter) @vulnFilter = vulnFilter end |
#to_xml ⇒ Object
737 738 739 740 741 742 743 744 745 746 747 748 749 |
# File 'lib/nexpose/site.rb', line 737 def to_xml xml = "<smtpAlert" xml << %Q{ name="#{replace_entities(name)}"} xml << %Q{ enabled="#{replace_entities(enabled)}"} xml << %Q{ sender="#{replace_entities(sender)}"} xml << %Q{ limitText="#{replace_entities(limitText)}">} recipients.each do |recpt| xml << "<recipient>#{replace_entities(recpt)}</recipient>" end xml << vulnFilter.to_xml xml << "</smtpAlert>" xml end |