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.
-
#limit_text ⇒ 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.
-
#vuln_filter ⇒ Object
The vulnerability filter to trigger the alert.
Instance Method Summary collapse
-
#add_recipient(recipient) ⇒ Object
Adds a new Recipient to the recipients array.
-
#initialize(name, sender, limit_text, enabled = 1) ⇒ SMTPAlert
constructor
A new instance of SMTPAlert.
- #to_xml ⇒ Object
Methods included from Sanitize
Constructor Details
#initialize(name, sender, limit_text, enabled = 1) ⇒ SMTPAlert
Returns a new instance of SMTPAlert.
668 669 670 671 672 673 674 675 676 677 |
# File 'lib/nexpose/site.rb', line 668 def initialize(name, sender, limit_text, enabled = 1) @type = :smtp @name = name @sender = sender @enabled = enabled @limit_text = limit_text @recipients = [] # Sets default vuln filter - All Events @vuln_filter = VulnFilter.new('50790400', 1) end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
If this alert is enabled or not
655 656 657 |
# File 'lib/nexpose/site.rb', line 655 def enabled @enabled end |
#limit_text ⇒ Object (readonly)
Limit the text for mobile devices
659 660 661 |
# File 'lib/nexpose/site.rb', line 659 def limit_text @limit_text end |
#name ⇒ Object (readonly)
A unique name for this alert
653 654 655 |
# File 'lib/nexpose/site.rb', line 653 def name @name end |
#recipients ⇒ Object (readonly)
Array containing Strings of email addresses Array of strings with the email addresses of the intended recipients
662 663 664 |
# File 'lib/nexpose/site.rb', line 662 def recipients @recipients end |
#sender ⇒ Object (readonly)
The email address of the sender
657 658 659 |
# File 'lib/nexpose/site.rb', line 657 def sender @sender end |
#type ⇒ Object (readonly)
The alert type
666 667 668 |
# File 'lib/nexpose/site.rb', line 666 def type @type end |
#vuln_filter ⇒ Object
The vulnerability filter to trigger the alert
664 665 666 |
# File 'lib/nexpose/site.rb', line 664 def vuln_filter @vuln_filter end |
Instance Method Details
#add_recipient(recipient) ⇒ Object
Adds a new Recipient to the recipients array
680 681 682 |
# File 'lib/nexpose/site.rb', line 680 def add_recipient(recipient) @recipients.push(recipient) end |
#to_xml ⇒ Object
686 687 688 689 690 691 692 693 694 695 696 697 698 |
# File 'lib/nexpose/site.rb', line 686 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(limit_text)}">} recipients.each do |recpt| xml << "<recipient>#{replace_entities(recpt)}</recipient>" end xml << vuln_filter.to_xml xml << '</smtpAlert>' xml end |