-
Notifications
You must be signed in to change notification settings - Fork 45
/
tasks.py
32 lines (28 loc) · 904 Bytes
/
tasks.py
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
# -*- coding: utf-8 -*-
from celery import Celery, platforms
from lib.scanAwvs import *
NAME, VERSION, AUTHOR, LICENSE = "PublicSecScan", "V0.1", "咚咚呛", "Public (FREE)"
app = Celery()
platforms.C_FORCE_ROOT = True
DEBUG_INFO = True
app.conf.update(
CELERY_IMPORTS=("tasks",),
BROKER_URL='redis://:' + REDIS_PASSWORD + '@' + REDIS_HOST + ':' + str(REDIS_PORT) + '/' + str(REDIS_DB),
CELERY_TASK_SERIALIZER='json',
CELERY_RESULT_SERIALIZER='json',
CELERY_TIMEZONE='Asia/Shanghai',
CELERY_ENABLE_UTC=True,
CELERY_REDIS_MAX_CONNECTIONS=5000,
BROKER_HEARTBEAT=30,
BROKER_TRANSPORT_OPTIONS={'visibility_timeout': 3600},
# CELERY_ROUTES={
# 'tasks.sec_dispath': {'queue': 'sec_dispath'},
# },
)
@app.task(name='tasks.sec_dispath')
def sec_dispath(targets):
try:
AWVS_Scan(targets).run()
except Exception, e:
return
return