<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>webstersprodigy.net &#187; nessus</title>
	<atom:link href="http://webstersprodigy.net/tag/nessus/feed/" rel="self" type="application/rss+xml" />
	<link>http://webstersprodigy.net</link>
	<description>Me trying to learn how to use a computer</description>
	<lastBuildDate>Sat, 04 Feb 2012 01:17:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>updated nessus-grep</title>
		<link>http://webstersprodigy.net/2010/02/updated-nessus-grep/</link>
		<comments>http://webstersprodigy.net/2010/02/updated-nessus-grep/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 20:22:00 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[nessus]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=663</guid>
		<description><![CDATA[This program takes a regular expression for a problem and returns the
affected hosts. It iterates through all reports saved in a .nessus file
making no attempt at uniqueness, (eg if you scanned a host more than once) 
searching through titles, data, port, and IDs for matches.]]></description>
			<content:encoded><![CDATA[<pre class="brush: python; title: ; notranslate">
#!/usr/bin/python

def usage():
  print &quot;&quot;&quot;
This program takes a regular expression for a problem and returns the
affected hosts. It iterates through all reports saved in a .nessus file
making no attempt at uniqueness, (eg if you scanned a host more than once)
searching through titles, data, port, and IDs for matches.

It prints one host per line, relying on tools like wc, tr, sort, uniq

USAGE:
arg[0] [--dns]  myfile.nessus regex

For a regex reference, see http://docs.python.org/library/re.html

The --dns flag will print out the dns name in addition to what was given for
the scan

EXAMPLES:

#search for hosts that ran the nikto plugin
python nessus_grep.py scan.nessus nikto

#case insensitive search for nikto
python nessus_grep.py scan.nessus &quot;(?i)nikto&quot;

#it's usually probably ok to just check for id, but be careful
#as an added precaution I give it the beginning end of lines
python nessus_grep.py scan.nessus &quot;^10386$&quot; 

#find all hosts with either the SSL Cipher &quot;bug&quot; or running SSL Version 2
python nessus_grep.py scan.nessus &quot;(SSL Weak Cipher Suites Supported|SSL \
Version 2 \(v2\) Protocol Detection)&quot;
&quot;&quot;&quot;

import sys
import re
from lxml import etree

def regexsearch(regex, *strings):
  for i in strings:
    try:
      if re.search(regex, i):
        return True
    except TypeError:
      pass

&quot;&quot;&quot;
Although there is some repeating logic in dotnessusparse
and dotxmlparse, they are two different formats and are
kept separate in case of changes to only one
&quot;&quot;&quot;
def dotnessusparse(nessus_xml, hostprint=False):
  for report in nessus_xml.getroot():
    if &quot;Report&quot; in repr(report.tag):
      for host in report:
        if &quot;ReportHost&quot; in host.tag:
          hostname = (host.find(&quot;HostName&quot;).text)
          dnsname = host.find(&quot;dns_name&quot;).text.rstrip(&quot;.\\n&quot;)
          if (&quot;(unknown)&quot; in dnsname):
            dnsname = &quot;&quot;
          reptitem = (host.findall(&quot;ReportItem&quot;))
          for issue in reptitem:
            data = issue.find(&quot;data&quot;).text
            pluginname = issue.find(&quot;pluginName&quot;).text
            pluginid = issue.find(&quot;pluginID&quot;).text
            port = issue.find(&quot;port&quot;).text
            if regexsearch(regex, data, pluginname, pluginid, port):
              if hostprint:
                hostname = hostname + &quot; (&quot; + dnsname + &quot;)&quot;
              print hostname
              break

def dotxmlparse(nessus_xml, hostprint=False):
  for report in nessus_xml.getroot():
    if &quot;Report&quot; in repr(report.tag):
      for host in report:
        if &quot;ReportHost&quot; in host.tag:
          hostname = host.get(&quot;name&quot;)
          dnsname = &quot;&quot;
          hostprops = host.find(&quot;HostProperties&quot;).findall(&quot;tag&quot;)
          for prop in hostprops:
            if prop.get(&quot;name&quot;) == &quot;host-fqdn&quot;:
              dnsname = prop.text
          reptitem = (host.findall(&quot;ReportItem&quot;))
          for issue in reptitem:
            data = sol = syn = plugout = None
            if issue.find(&quot;description&quot;) is not None:
              data = issue.find(&quot;description&quot;).text
            if issue.find(&quot;solution&quot;) is not None:
              sol = issue.find(&quot;solution&quot;).text
            if issue.find(&quot;synopsis&quot;) is not None:
              syn = issue.find(&quot;synopsis&quot;).text
            if issue.find(&quot;plugin_output&quot;) is not None:
              plugout = issue.find(&quot;plugin_output&quot;).text
            pluginname = issue.get(&quot;pluginName&quot;)
            pluginId = issue.get(&quot;pluginID&quot;)
            if regexsearch(regex, sol, syn, plugout, pluginname, pluginId):
              if hostprint:
                hostname = hostname + &quot; (&quot; + dnsname + &quot;)&quot;
              print hostname
              break

if __name__ == &quot;__main__&quot;:
  re.IGNORECASE
  if len(sys.argv) &lt; 3:
    usage()
    sys.exit(0)
  filelist = sys.argv[1:-1]
  try:
    filelist.remove(&quot;--dns&quot;)
    hostprint = True
  except ValueError:
    hostprint = False
  regex = sys.argv[-1]
  for nessusfile in filelist:
    nessus_xml = etree.parse(nessusfile)
    if nessusfile.endswith(&quot;.nessus&quot;):
      dotnessusparse(nessus_xml, hostprint)
    if nessusfile.endswith(&quot;.xml&quot;):
      dotxmlparse(nessus_xml, hostprint)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2010/02/updated-nessus-grep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nessus grep</title>
		<link>http://webstersprodigy.net/2010/01/nessus-grep/</link>
		<comments>http://webstersprodigy.net/2010/01/nessus-grep/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 08:02:13 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[GrayHat]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[nessus]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=648</guid>
		<description><![CDATA[The code is pretty self explanatory. It searches through a .nessus file and spits out matching hosts.]]></description>
			<content:encoded><![CDATA[<p>The code is pretty self explanatory. It searches through a .nessus file and spits out matching hosts.</p>
<pre class="brush: python; title: ; notranslate">
#!/usr/bin/python

def usage():
  print &quot;&quot;&quot;
This program takes a regular expression for a problem and returns the
affected hosts. It iterates through all reports saved in a .nessus file
making no attempt at uniqueness, (eg if you scanned a host more than once)
searching through titles, data, port, and IDs for matches.

It prints one host per line, relying on tools like wc, tr, sort, uniq

USAGE:
arg[0] myfile.nessus regex

For a regex reference, see http://docs.python.org/library/re.html

EXAMPLES:

#search for hosts that ran the nikto plugin
python nessus_grep.py scan.nessus nikto

#case insensitive search for nikto
python nessus_grep.py scan.nessus &quot;(?i)nikto&quot;

#it's usually probably ok to just check for id, but be careful
#as an added precaution I give it the beginning end of lines
python nessus_grep.py scan.nessus &quot;^10386$&quot; 

#find all hosts with either the SSL Cipher &quot;bug&quot; or running SSL Version 2
python nessus_grep.py scan.nessus &quot;(SSL Weak Cipher Suites Supported|SSL \
Version 2 \(v2\) Protocol Detection)&quot;
&quot;&quot;&quot;

import sys
import re
from lxml import etree

def regexsearch(regex, *strings):
  for i in strings:
    try:
      if re.search(regex, i):
        return True
    except TypeError:
      pass

if __name__ == &quot;__main__&quot;:
  re.IGNORECASE
  if len(sys.argv) != 3:
    usage()
    sys.exit(0)
  regex = sys.argv[2]
  nessus_xml = etree.parse(sys.argv[1])
  for report in nessus_xml.getroot():
    if &quot;Report&quot; in repr(report.tag):
      for host in report:
        if &quot;ReportHost&quot; in host.tag:
          hostname = (host.find(&quot;HostName&quot;).text)
          reptitem = (host.findall(&quot;ReportItem&quot;))
          for issue in reptitem:
            data = issue.find(&quot;data&quot;).text
            pluginname = issue.find(&quot;pluginName&quot;).text
            pluginid = issue.find(&quot;pluginID&quot;).text
            port = issue.find(&quot;port&quot;).text
            if regexsearch(regex, data, pluginname, pluginid, port):
              print hostname
              break
</pre>
]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2010/01/nessus-grep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

