mirror of
https://github.com/ChronosX88/medved.git
synced 2024-11-24 15:42:17 +00:00
Small fixes
This commit is contained in:
parent
d0ff66993d
commit
27291adf71
@ -25,12 +25,16 @@ services:
|
|||||||
package: lib.plugin.base.lib.Telegram
|
package: lib.plugin.base.lib.Telegram
|
||||||
service: TelegramFeed
|
service: TelegramFeed
|
||||||
storage: pool
|
storage: pool
|
||||||
token: "358947514:"
|
token: "358947212354:"
|
||||||
chats:
|
chats:
|
||||||
- id: aiWeipeighah7vufoHa0ieToipooYe
|
- id: aiWeipeighah7vufoHa0ieToipooYe
|
||||||
if:
|
if:
|
||||||
steps.ftp_apply_tpl: true
|
steps.ftp_apply_tpl: true
|
||||||
data.filter: false
|
data.filter: false
|
||||||
|
- id: ohl7AeGah5uo8cho4nae9Eemaeyae3
|
||||||
|
if:
|
||||||
|
steps.gopher_apply_tpl: true
|
||||||
|
data.filter: false
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
pool:
|
pool:
|
||||||
|
@ -24,12 +24,11 @@ class RQExecutor(Executor):
|
|||||||
jobs = []
|
jobs = []
|
||||||
|
|
||||||
while self._running:
|
while self._running:
|
||||||
sleep(self.lcnf.get('delay', 0.2))
|
sleep(self.lcnf.get('delay', 0.5))
|
||||||
try:
|
try:
|
||||||
for pn, pipeline in self.cnf.get("pipelines").items():
|
for pn, pipeline in self.cnf.get("pipelines").items():
|
||||||
if pn not in self.cnf.get('core').get('pipelines'):
|
if pn not in self.cnf.get('core').get('pipelines'):
|
||||||
continue
|
continue
|
||||||
source = Loader.by_id('storage', pipeline.get('source'))
|
|
||||||
for step in pipeline['steps']:
|
for step in pipeline['steps']:
|
||||||
q = Queue(step.get('priority', 'normal'), connection=redis_conn)
|
q = Queue(step.get('priority', 'normal'), connection=redis_conn)
|
||||||
for job_id in jobs:
|
for job_id in jobs:
|
||||||
@ -49,12 +48,15 @@ class RQExecutor(Executor):
|
|||||||
items = self._data.get(block=False, count=count, filter=filter)
|
items = self._data.get(block=False, count=count, filter=filter)
|
||||||
# obtain everything else from source
|
# obtain everything else from source
|
||||||
if len(items) < count:
|
if len(items) < count:
|
||||||
|
source = Loader.by_id('storage', pipeline.get('source'))
|
||||||
new_items = source.get(block=False, count=(count - len(items)), filter=filter)
|
new_items = source.get(block=False, count=(count - len(items)), filter=filter)
|
||||||
items.extend(new_items)
|
items.extend(new_items)
|
||||||
source.remove(new_items)
|
source.remove(new_items)
|
||||||
|
|
||||||
if items:
|
if items:
|
||||||
self._data.update(items, {'$set': {'steps.%s' % step['task']: None}})
|
for i in items:
|
||||||
|
i['steps'][step['task']] = None
|
||||||
|
self._data.update(items)
|
||||||
job = q.enqueue("lib.exeq.Task.run", step['task'], items)
|
job = q.enqueue("lib.exeq.Task.run", step['task'], items)
|
||||||
self._logger.info("%s|%s|%s|%s", job.id, step.get('priority', 'normal'), step['task'], len(items))
|
self._logger.info("%s|%s|%s|%s", job.id, step.get('priority', 'normal'), step['task'], len(items))
|
||||||
jobs.append(job.id)
|
jobs.append(job.id)
|
||||||
|
@ -38,7 +38,7 @@ class MasScanTask(Task):
|
|||||||
|
|
||||||
gi = GeoIP.open(cnf.get("geoip_dat", "/usr/share/GeoIP/GeoIPCity.dat"), GeoIP.GEOIP_INDEX_CACHE | GeoIP.GEOIP_CHECK_CACHE)
|
gi = GeoIP.open(cnf.get("geoip_dat", "/usr/share/GeoIP/GeoIPCity.dat"), GeoIP.GEOIP_INDEX_CACHE | GeoIP.GEOIP_CHECK_CACHE)
|
||||||
ip_list = [i['data']['ip'] for i in items]
|
ip_list = [i['data']['ip'] for i in items]
|
||||||
port_list = cnf.get("tasks").get(self._id).get("ports")
|
port_list = self.lcnf.get("ports")
|
||||||
|
|
||||||
self._logger.debug("Starting scan, ip_list=%s, port_list=%s", ip_list, port_list)
|
self._logger.debug("Starting scan, ip_list=%s, port_list=%s", ip_list, port_list)
|
||||||
|
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
import netaddr
|
|
||||||
|
|
||||||
from Config import cnf
|
|
||||||
from lib.plugin.plugins import BasePlugin
|
|
||||||
|
|
||||||
|
|
||||||
class Plugin(BasePlugin):
|
|
||||||
class TelegramMessage(BasePlugin.TelegramMessage):
|
|
||||||
def _init(self):
|
|
||||||
self._name = "Gopher"
|
|
||||||
|
|
||||||
def _generate(self):
|
|
||||||
|
|
||||||
class Pipeline(BasePlugin.Pipeline):
|
|
||||||
def _init(self):
|
|
||||||
self._name = "Gopher"
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
try:
|
|
||||||
self._find()
|
|
||||||
self._push()
|
|
||||||
except Exception as e:
|
|
||||||
self._logger.debug("Error occured: %s (%s)", e, self._host['ip'])
|
|
||||||
else:
|
|
||||||
self._logger.info("Succeeded for %s" % self._host['ip'])
|
|
Loading…
Reference in New Issue
Block a user