class documentation

This class handle the persistence of NmapRepport object in SQL backend Implementation is made using sqlalchemy(0.8.1) usage : #get a nmapReport object from libnmap.parser import NmapParser from libnmap.reportjson import ReportDecoder, ReportEncoder import json nmap_report_obj = NmapParser.parse_fromfile( '/home/vagrant/python-nmap-lib/libnmap/test/files/1_hosts.xml') #get a backend with in memory sqlite from libnmap.plugins.backendpluginFactory import BackendPluginFactory mybackend_mem = BackendPluginFactory.create(plugin_name='sql', url='sqlite://', echo=True) mybackend_mysql = BackendPluginFactory.create(plugin_name='sql', url='mysql+mysqldb://scott:tiger@localhost/foo', echo=True) mybackend = BackendPluginFactory.create(plugin_name='sql', url='sqlite:////tmp/reportdb.sql', echo=True) #lets save!! nmap_report_obj.save(mybackend) mybackend.getall() mybackend.get(1)

Class Reports Embeded class for ORM map NmapReport to a simple three column table
Method __init__ constructor receive a **kwargs as the **kwargs in the sqlalchemy create_engine() method (see sqlalchemy docs) You must add to this **kwargs an 'url' key with the url to your database This constructor will : - create all the necessary obj to discuss with the DB - create all the mapping(ORM)...
Method delete Remove a report from the backend
Method get retrieve a NmapReport from the backend
Method getall :param filter: Nice to have implement a filter capability
Method insert insert NmapReport in the backend
Instance Variable engine Undocumented
Instance Variable Session Undocumented
Instance Variable url Undocumented

Inherited from NmapBackendPlugin:

Instance Variable dbname Undocumented
Instance Variable store Undocumented
def __init__(self, **kwargs): (source)

constructor receive a **kwargs as the **kwargs in the sqlalchemy create_engine() method (see sqlalchemy docs) You must add to this **kwargs an 'url' key with the url to your database This constructor will : - create all the necessary obj to discuss with the DB - create all the mapping(ORM) todo : support the : sqlalchemy.engine_from_config :param **kwargs: :raises: ValueError if no url is given, all exception sqlalchemy can throw ie sqlite in memory url='sqlite://' echo=True ie sqlite file on hd url='sqlite:////tmp/reportdb.sql' echo=True ie mysql url='mysql+mysqldb://scott:tiger@localhost/foo'

def delete(self, report_id=None): (source)

Remove a report from the backend :param id: str :returns: The number of rows deleted

def get(self, report_id=None): (source)

retrieve a NmapReport from the backend :param id: str :returns: NmapReport

def getall(self): (source)

:param filter: Nice to have implement a filter capability :returns: collection of tuple (id,NmapReport)

def insert(self, nmap_report): (source)

insert NmapReport in the backend :param NmapReport: :returns: the ident of the object in the backend for future usage or None

Undocumented

Undocumented

Undocumented