def __init__(self, user, data):

        if not data: return False
        BasePlugin.__init__(self, user, data)
        self.user = user
        self.data = data
        self.conn = None
Beispiel #2
0
    def __init__(self, user, data):

        if not data: return False
        BasePlugin.__init__(self, user, data)
        self.user = user
        self.data = data
        passwd = self.data['ce'].get_user_info(self.user, 'user_passwd')
        self.conn = CC(self.user, passwd)
    def __init__(self, user, data):
        if not data:
            return False

        BasePlugin.__init__(self, user, data)

        # history list length, packets buffer size, query buffer size
        if data.has_key('historyLength'):
            self.data['historyLength'] = (40000,
                int(self.data['historyLength']))[int(self.data['historyLength'])>0]
        else:
            self.data.update([('historyLength', 40000), ])
        if data.has_key('packetsBuffer'):
            self.data['packetsBuffer'] = (400,
                int(self.data['packetsBuffer']))[int(self.data['packetsBuffer'])>0]
        else:
            self.data.update([('packetsBuffer', 400), ])

        # plugin status, packets list, temporary path to save pcap files,
        # packets list index limit, registered sniffers
        self.status = 'paused'
        self.packets = []
        self.pcapPath = getenv('TWISTER_PATH') + '/tmp'
        if not exists(self.pcapPath):
            makedirs(self.pcapPath)
        self.packetsIndexLimit = (self.data['historyLength']
                                    - self.data['packetsBuffer'])
        self.filters = {}
        self.sniffers = {}

        self.commands = {
            'simple': [
                'echo',
                'pause', 'resume',
                'restart', 'reset',
                'savepcap',
                'getfilters',
                'setfilters',
            ],
            'argumented': [
                'query', 'querypkt', 'pushpkt',
                'registersniff', 'restarted',
            ]
        }
Beispiel #4
0
    def __init__(self, user, data):
        if not data:
            return False

        BasePlugin.__init__(self, user, data)

        # history list length, packets buffer size, query buffer size
        self.data['historyLength'] = (40000, int(
            self.data['historyLength']))[int(self.data['historyLength']) > 0]
        self.data['packetsBuffer'] = (400, int(
            self.data['packetsBuffer']))[int(self.data['packetsBuffer']) > 0]

        # plugin status, packets list, temporary path to save pcap files,
        # packets list index limit, registered sniffers
        self.status = 'paused'
        self.packets = []
        self.pcapPath = getenv('TWISTER_PATH') + '/tmp'
        if not exists(self.pcapPath):
            makedirs(self.pcapPath)
        self.packetsIndexLimit = (self.data['historyLength'] -
                                  self.data['packetsBuffer'])
        self.filters = {}
        self.sniffers = {}

        self.commands = {
            'simple': [
                'echo',
                'pause',
                'resume',
                'restart',
                'reset',
                'savepcap',
                'getfilters',
                'setfilters',
            ],
            'argumented': [
                'query',
                'querypkt',
                'pushpkt',
                'registersniff',
                'restarted',
            ]
        }
Beispiel #5
0
 def __init__(self, host, port, **kwargs):
     BasePlugin.__init__(self, host, port, **kwargs)
     # override logger name by adding service name
     self.logger = logging.getLogger("nmap-{0}".format(self.service))
Beispiel #6
0
 def __init__(self,user,data):
     BasePlugin.__init__(self,user,data)
     self.cap_dir = helpers.userHome(user) + '/twister/pcap'
     print 'CAP_DIR: {}'.format(self.cap_dir)