Class: Nexpose::ReportAdHoc
- Inherits:
-
Object
- Object
- Nexpose::ReportAdHoc
- Defined in:
- lib/nexpose.rb
Overview
Description
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#error_msg ⇒ Object
readonly
Returns the value of attribute error_msg.
-
#filters ⇒ Object
readonly
Array of (ReportFilter)*.
-
#format ⇒ Object
readonly
pdf|html|xml|text|csv|raw-xml.
-
#report_decoded ⇒ Object
readonly
Returns the value of attribute report_decoded.
-
#request_xml ⇒ Object
readonly
Returns the value of attribute request_xml.
-
#response_xml ⇒ Object
readonly
Returns the value of attribute response_xml.
-
#template_id ⇒ Object
readonly
Report Template ID strong e.g.
Instance Method Summary collapse
- #addFilter(filter_type, id) ⇒ Object
- #generate ⇒ Object
-
#initialize(connection, template_id = 'full-audit', format = 'raw-xml') ⇒ ReportAdHoc
constructor
A new instance of ReportAdHoc.
Constructor Details
#initialize(connection, template_id = 'full-audit', format = 'raw-xml') ⇒ ReportAdHoc
Returns a new instance of ReportAdHoc.
1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 |
# File 'lib/nexpose.rb', line 1981 def initialize(connection, template_id = 'full-audit', format = 'raw-xml') @error = false @connection = connection @xml_tag_stack = array() @filters = Array.new() @template_id = template_id @format = format end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
1969 1970 1971 |
# File 'lib/nexpose.rb', line 1969 def connection @connection end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
1967 1968 1969 |
# File 'lib/nexpose.rb', line 1967 def error @error end |
#error_msg ⇒ Object (readonly)
Returns the value of attribute error_msg.
1968 1969 1970 |
# File 'lib/nexpose.rb', line 1968 def error_msg @error_msg end |
#filters ⇒ Object (readonly)
Array of (ReportFilter)*
1975 1976 1977 |
# File 'lib/nexpose.rb', line 1975 def filters @filters end |
#format ⇒ Object (readonly)
pdf|html|xml|text|csv|raw-xml
1973 1974 1975 |
# File 'lib/nexpose.rb', line 1973 def format @format end |
#report_decoded ⇒ Object (readonly)
Returns the value of attribute report_decoded.
1978 1979 1980 |
# File 'lib/nexpose.rb', line 1978 def report_decoded @report_decoded end |
#request_xml ⇒ Object (readonly)
Returns the value of attribute request_xml.
1976 1977 1978 |
# File 'lib/nexpose.rb', line 1976 def request_xml @request_xml end |
#response_xml ⇒ Object (readonly)
Returns the value of attribute response_xml.
1977 1978 1979 |
# File 'lib/nexpose.rb', line 1977 def response_xml @response_xml end |
#template_id ⇒ Object (readonly)
Report Template ID strong e.g. full-audit
1971 1972 1973 |
# File 'lib/nexpose.rb', line 1971 def template_id @template_id end |
Instance Method Details
#addFilter(filter_type, id) ⇒ Object
1992 1993 1994 1995 1996 1997 1998 1999 |
# File 'lib/nexpose.rb', line 1992 def addFilter(filter_type, id) # filter_type can be site|group|device|scan # id is the ID number. For scan, you can use 'last' for the most recently run scan filter = new ReportFilter.new(filter_type,id) filters.push(filter) end |
#generate ⇒ Object
2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 |
# File 'lib/nexpose.rb', line 2001 def generate() request_xml = '<ReportAdhocGenerateRequest session-id="' + @connection.session_id + '">' request_xml += '<AdhocReportConfig template-id="' + @template_id + '" format="' + @format + '">' request_xml += '<Filters>' @filters.each do |f| request_xml += '<filter type="' + f.type + '" id="'+ f.id + '"/>' end request_xml += '</Filters>' request_xml += '</AdhocReportConfig>' request_xml += '</ReportAdhocGenerateRequest>' myReportAdHoc_request = APIRequest.new(request_xml, @connection.geturl()) myReportAdHoc_request.execute() myReportAdHoc_response = myReportAdHoc_request.response_xml end |