Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View nsfix.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#!/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.