Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LoRexxar committed Aug 11, 2021
1 parent 07bc2c8 commit 05fdb1a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
3 changes: 2 additions & 1 deletion core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

from django.core.management import call_command
from utils.log import log, logger, log_add, log_rm
from utils.utils import get_mainstr_from_filename, get_scan_id
from utils.utils import get_mainstr_from_filename
from utils.status import get_scan_id
from utils.web import upload_log
from utils.file import load_kunlunmignore

Expand Down
3 changes: 2 additions & 1 deletion core/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

from utils.log import logger, logger_console, log, log_add
from utils import readlineng as readline
from utils.utils import get_mainstr_from_filename, get_scan_id, file_output_format, show_context
from utils.utils import get_mainstr_from_filename, file_output_format, show_context
from utils.status import get_scan_id

from Kunlun_M.settings import HISTORY_FILE_PATH, MAX_HISTORY_LENGTH
from Kunlun_M.settings import RULES_PATH, PROJECT_DIRECTORY, LOGS_PATH
Expand Down
2 changes: 1 addition & 1 deletion core/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from utils.utils import show_context
from utils.file import FileParseAll, get_line
from utils.log import logger
from utils.utils import get_scan_id
from utils.status import get_scan_id

from web.index.models import ScanResultTask, NewEvilFunc
from web.index.models import get_resultflow_class, check_update_or_new_scanresult
Expand Down
27 changes: 27 additions & 0 deletions utils/status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python
# encoding: utf-8
'''
@author: LoRexxar
@contact: [email protected]
@file: status.py
@time: 2021/8/11 15:31
@desc:
'''

from web.index.models import ScanTask


SCAN_ID = -1


def get_scan_id():
global SCAN_ID

if SCAN_ID > 0:
return SCAN_ID
else:
s = ScanTask.objects.order_by("-id").first()
SCAN_ID = s.id

return SCAN_ID
15 changes: 0 additions & 15 deletions utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import ast

from Kunlun_M.settings import RULES_PATH, PROJECT_DIRECTORY
from web.index.models import ScanTask

from utils.log import logger, logger_console
from utils.file import check_filepath, get_line
Expand All @@ -37,20 +36,6 @@
OUTPUT_MODE_STREAM = 'stream'
PY2 = sys.version_info[0] == 2

SCAN_ID = -1


def get_scan_id():
global SCAN_ID

if SCAN_ID > 0:
return SCAN_ID
else:
s = ScanTask.objects.order_by("-id").first()
SCAN_ID = s.id

return SCAN_ID


class ParseArgs(object):
def __init__(self, target, formatter, output, special_rules=None, language=None, black_path=None, a_sid=None):
Expand Down

0 comments on commit 05fdb1a

Please sign in to comment.