pub struct NessusScan { /* private fields */ }
Expand description
This struct holds the two sections of a Nessus XML file. Every XML file must have a single Policy section, and zero or one Report sections.
-
The Policy section contains information about the scan settings, plugins used, etc.
-
The Report section contains the results from having run a Nessus scan with the provided Policy
This crate provides iterators over the discovered hosts and ports.
Implementations§
Source§impl NessusScan
impl NessusScan
Sourcepub fn parse(nessus_xml_str: &str) -> Result<Self, Error>
pub fn parse(nessus_xml_str: &str) -> Result<Self, Error>
Attempt to parse an XML object as a Nessus report
let xml = r#"
<?xml version="1.0" ?>
<NessusClientData_v2>
...
</NessusClientData_v2>
"#;
let nessus = NessusScan::parse(&xml).unwrap();
Sourcepub fn hosts(&self) -> Iter<'_, ReportHost>
pub fn hosts(&self) -> Iter<'_, ReportHost>
Returns an interator over the hosts in the scan
let xml = r#"
<?xml version="1.0" ?>
<NessusClientData_v2>
...
</NessusClientData_v2>
"#;
let nessus = NessusScan::parse(&xml).unwrap();
for host in nessus.hosts() {
println!("Hostname: {}", host);
}
Sourcepub fn ports(&self) -> IntoIter<(&ReportHost, Port)>
pub fn ports(&self) -> IntoIter<(&ReportHost, Port)>
Returns an interator over the ports in the scan.
let xml = r#"
<?xml version="1.0" ?>
<NessusClientData_v2>
...
</NessusClientData_v2>
"#;
let nessus = NessusScan::parse(&xml).unwrap();
for (host, port) in nessus.ports() {
println!("Hostname: {}, port: {}", host, port.id);
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NessusScan
impl RefUnwindSafe for NessusScan
impl Send for NessusScan
impl Sync for NessusScan
impl Unpin for NessusScan
impl UnwindSafe for NessusScan
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more