Exemplo n.º 1
0
 def test_1(self):
     logging.init_log(
         StreamHandler(format=logging.FORMAT_SIMPLE),
         FileHandler(format=logging.FORMAT_VERBOSE, level=logging.DEBUG))
     logger = logging.getLogger(__name__)
     print('123')
     logger.debug('hello')
Exemplo n.º 2
0
    def test_3(self):
        logging.init_log(
            StreamHandler(format=logging.FORMAT_SIMPLE),
            TimedRotatingFileHandler(format=logging.FORMAT_VERBOSE,
                                     level=logging.DEBUG))
        logger = logging.getLogger(__name__)

        logger.debug('hello')
Exemplo n.º 3
0
"""
自动检测文件可能的隐写,需要在Linux下使用 Python3 运行
一些依赖还需要手动安装

TODO 文件中可见字符的处理,对于 \00 这种分隔开的字符,需要能够分离

有些RAR等压缩包的文件头被修改,例如改成raR!,可以搜索strings里面的文本是否有符合的特征字符串,做个提醒

FFD9 后的文件内容显示出来
"""

logging.init_log(ColorStreamHandler(logging.INFO, '%(message)s'),
                 FileHandler(level=logging.INFO))

logger = logging.getLogger(__name__)


class WhatSteg(object):
    def __init__(self, file_path, flag_strict_mode=True):
        self.file_path = file_path
        self.current_path = os.path.dirname(file_path)
        base_name = os.path.basename(file_path)
        # 文件的扩展名
        self.file_ext = os.path.splitext(base_name)[1]

        # 文件类型
        self.file_type = ''

        self.output_path = os.path.join(self.current_path, 'output_%s' % base_name)
        self.flag_strict_mode = flag_strict_mode
Exemplo n.º 4
0
from mountains import logging
from mountains.logging import StreamHandler, RotatingFileHandler

import settings
from settings import get_path
from urls import url_handlers

if settings.DEBUG:
    level = logging.DEBUG
else:
    level = logging.INFO

logging.init_log(StreamHandler(level=level),
                 RotatingFileHandler(level=level, max_bytes=1024 * 1024 * 3, backup_count=1),
                 disable_existing_loggers=False)
logging.getLogger('tornado.curl_httpclient').disabled = True
logging.getLogger('tornado.general').disabled = True

logger = logging.getLogger(__name__)

logger.info('%s' % pycurl.version)

SQL_CREATE_TABLE_INTERCEPTOR = """
CREATE TABLE "interceptor" (
"uuid"  TEXT NOT NULL,
"code"  TEXT,
"create_date"  TEXT,
"name"  TEXT,
PRIMARY KEY ("uuid" ASC)
)"""
Exemplo n.º 5
0
import os
from flask import Flask, render_template
from mountains import logging
from mountains.logging import StreamHandler, RotatingFileHandler
import settings
from urls import init_url_rules

if settings.DEBUG:
    level = logging.DEBUG
else:
    level = logging.INFO

logging.init_log(StreamHandler(level=level),
                 RotatingFileHandler(level=level, max_bytes=1024 * 1024 * 3, backup_count=1),
                 disable_existing_loggers=True)
logger = logging.getLogger(__name__)


def get_path(target_path):
    path = os.path.join(os.getcwd(), target_path)  # development path
    if not os.path.exists(path):  # frozen executable path
        path = os.path.join(os.path.dirname(os.path.abspath(__file__)), target_path)
    return path


# 静态文件目录,要用这个格式配置,不然会找不到
app = Flask(__name__, static_folder=get_path('static'),
            template_folder=get_path('templates'), )
app.config["SEND_FILE_MAX_AGE_DEFAULT"] = 1  # disable caching