Example #1
0
 def __init__(self,
              iterTarget,
              pocPath,
              poolModule='beethread',
              concurrency=20,
              verify=True):
     self.iterTarget = iterTarget
     self.verify = verify
     self._pocObj = Poc(path=pocPath)
     self._poolModule = poolModule
     self._workerPool = self._initWorkerPool(poolModule)(
         concurrency=concurrency)
Example #2
0
 def __init__(self, iterTarget, pocPath, poolModule='beethread',
              concurrency=20, verify=True):
     self.iterTarget = iterTarget
     self.verify = verify
     self._pocObj = Poc(path=pocPath)
     self._poolModule = poolModule
     self._workerPool = self._initWorkerPool(poolModule)(concurrency=concurrency)
Example #3
0
class Hunter(object):
    '''scanner scanning a list of targets with a particular poc.'''
    def __init__(self,
                 iterTarget,
                 pocPath,
                 poolModule='beethread',
                 concurrency=20,
                 verify=True):
        self.iterTarget = iterTarget
        self.verify = verify
        self._pocObj = Poc(path=pocPath)
        self._poolModule = poolModule
        self._workerPool = self._initWorkerPool(poolModule)(
            concurrency=concurrency)

    def _initWorkerPool(self, poolModule='beethread'):
        if poolModule is 'beethread':
            return bt.WorkerPool
        elif poolModule is 'beecoroutine':
            return bc.WorkerPool

    def _runPoc(self, target):
        # TODO: need to normalize target in Poc
        target = target.strip()
        return self._pocObj.run(target=target, verify=self.verify)

    def scan(self, timeout=None):
        self._workerPool.work(iterJobFuncArgs=self.iterTarget,
                              jobFunc=self._runPoc,
                              timeout=timeout)
        return self._workerPool.results
Example #4
0
class Hunter(object):
    '''scanner scanning a list of targets with a particular poc.'''
    def __init__(self, iterTarget, pocPath, poolModule='beethread',
                 concurrency=20, verify=True):
        self.iterTarget = iterTarget
        self.verify = verify
        self._pocObj = Poc(path=pocPath)
        self._poolModule = poolModule
        self._workerPool = self._initWorkerPool(poolModule)(concurrency=concurrency)

    def _initWorkerPool(self, poolModule='beethread'):
        if poolModule is 'beethread':
            return bt.WorkerPool
        elif poolModule is 'beecoroutine':
            return bc.WorkerPool

    def _runPoc(self, target):
        # TODO: need to normalize target in Poc
        target = target.strip()
        return self._pocObj.run(target=target, verify=self.verify)

    def scan(self, timeout=None):
        self._workerPool.work(iterJobFuncArgs=self.iterTarget,
                              jobFunc=self._runPoc,
                              timeout=timeout)
        return self._workerPool.results
Example #5
0
 def _loadPocs(self, listPocPaths):
     pocObjs = []
     for pocPath in listPocPaths:
         pocObjs.append(Poc(path=pocPath))
     return pocObjs