Skip to content
Create a gist now

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import sys, lxml.etree as et
def purge_plugin( tree, id ):
print ':: Searching for %s Entries..' % id
targets = tree.findall( '//ReportItem[@pluginID="%s"]' % id )
print ' Found %s entries.' % len( targets )
print ':: Excising %s entries..' % id
for target in targets:
sys.stdout.write( '.' )
sys.stdout.flush( )
target.getparent( ).remove( target )
print
def nsfix( src_path, dst_path, *plugins ):
print ':: Loading source file..'
tree = et.parse( src_path )
for plugin in plugins:
purge_plugin( tree, plugin )
print ':: Writing output file..'
tree.write( dst_path )
print ':: Done.'
if __name__ == "__main__":
if len( sys.argv ) > 3:
nsfix( *sys.argv[1:] )
else:
print >>sys.stderr, 'USAGE: nsfix <src.nessus> <dst.nessus> <plugin0> <plugin1> ...'
print >>sys.stderr, 'EX: nsfix sample.nessus dest.nessus 19506 11084'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.