File: backendplugin.py

package info (click to toggle)
python-libnmap 0.7.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,416 kB
  • sloc: xml: 5,572; python: 4,299; makefile: 149
file content (44 lines) | stat: -rw-r--r-- 1,092 bytes parent folder | download
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
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python


class NmapBackendPlugin(object):
    """
    Abstract class showing to the minimal implementation for a plugin
    All subclass MUST at least implement the following methods
    """

    def __init__(self):
        self.dbname = "nmapdb"
        self.store = "reports"

    def insert(self, NmapReport):
        """
        insert NmapReport in the backend
        :param NmapReport:
        :return: str the ident of the object in the backend for
        future usage
        or None
        """
        raise NotImplementedError

    def delete(self, id):
        """
        delete NmapReport if the backend
        :param id: str
        """
        raise NotImplementedError

    def get(self, id):
        """
        retrieve a NmapReport from the backend
        :param id: str
        :return: NmapReport
        """
        raise NotImplementedError

    def getall(self, filter):
        """
        :return: collection of tuple (id,NmapReport)
        :param filter: Nice to have implement a filter capability
        """
        raise NotImplementedError