Beispiel #1
0
def setRestAPILog():
    if hasattr(conf, "api"):
        conf.database_cursor = Database(conf.database)
        conf.database_cursor.connect("client")

        # Set a logging handler that writes log messages to a IPC database
        logger.removeHandler(LOGGER_HANDLER)
        LOGGER_RECORDER = LogRecorder()
        logger.addHandler(LOGGER_RECORDER)
Beispiel #2
0
def setRestAPILog():
    if hasattr(conf, "api"):
        conf.database_cursor = Database(conf.database)
        conf.database_cursor.connect("client")

        # Set a logging handler that writes log messages to a IPC database
        logger.removeHandler(LOGGER_HANDLER)
        LOGGER_RECORDER = LogRecorder()
        logger.addHandler(LOGGER_RECORDER)
Beispiel #3
0
def setRestAPILog():
    if hasattr(conf, "api"):
        conf.database_connection = sqlite3.connect(conf.database, timeout=1, isolation_level=None)
        conf.database_cursor = conf.database_connection.cursor()

        # Set a logging handler that writes log messages to a IPC database
        logger.removeHandler(LOGGER_HANDLER)
        LOGGER_RECORDER = LogRecorder()
        logger.addHandler(LOGGER_RECORDER)
Beispiel #4
0
def setRestAPILog():
    if conf.api:
        try:
            conf.databaseCursor = Database(conf.database)
            conf.databaseCursor.connect("client")
        except sqlite3.OperationalError as ex:
            raise SqlmapConnectionException("%s ('%s')" % (ex, conf.database))

        # Set a logging handler that writes log messages to a IPC database
        logger.removeHandler(LOGGER_HANDLER)
        LOGGER_RECORDER = LogRecorder()
        logger.addHandler(LOGGER_RECORDER)
Beispiel #5
0
def setRestAPILog():
    if hasattr(conf, "api"):
        try:
            conf.database_cursor = Database(conf.database)
            conf.database_cursor.connect("client")
        except sqlite3.OperationalError, ex:
            raise SqlmapConnectionException, "%s ('%s')" % (ex, conf.database)

        # Set a logging handler that writes log messages to a IPC database
        logger.removeHandler(LOGGER_HANDLER)
        LOGGER_RECORDER = LogRecorder()
        logger.addHandler(LOGGER_RECORDER)
Beispiel #6
0
def setRestAPILog():
    if conf.api:
        try:
            conf.databaseCursor = Database(conf.database)
            conf.databaseCursor.connect("client")
        except sqlite3.OperationalError, ex:
            raise SqlmapConnectionException, "%s ('%s')" % (ex, conf.database)

        # 设置将日志消息写入IPC数据库的日志处理程序
        logger.removeHandler(LOGGER_HANDLER)
        LOGGER_RECORDER = LogRecorder()
        logger.addHandler(LOGGER_RECORDER)
Beispiel #7
0
        'ERROR': ((0.99609375, 0.296875, 0.1328125, 1), False),
        'CRITICAL': ((0.99609375, 0.296875, 0.1328125, 1), True),
        'PAYLOAD': ((0,1,1,1),False),
        'TRAFFIC OUT': ((1,0,1,1),False),
        'TRAFFIC IN': ((1,0,1,1),True),
    }
    def emit(self, record):
        try:
            msg = self.format(record)
            kivy_logger.debug(msg)
            print_on_widget(msg, self.level_colors[record.levelname])
        except:
            self.handleError(record)

from lib.core.data import logger
widget_handler = WidgetHandler()
widget_handler.setFormatter(logging.Formatter("[%(asctime)s] [%(levelname)s] %(message)s", "%H:%M:%S"))
# widget_handler.setLevel(logging.DEBUG)
logger.addHandler(widget_handler)


# disable os._exit to forbid exiting in multithreading mode
original_exit = os._exit
threading.current_thread().name = 'sqlmapchik_main_thread'
def exit_wrapper(status):
    if threading.current_thread().name == 'sqlmapchik_main_thread':
        original_exit(status)
    else:
        kivy_logger.warning('%s attempted to call os._exit(%d), ignoring' % (threading.current_thread().name, status))
os._exit = exit_wrapper
Beispiel #8
0
        'ERROR': ((0.99609375, 0.296875, 0.1328125, 1), False),
        'CRITICAL': ((0.99609375, 0.296875, 0.1328125, 1), True),
        'PAYLOAD': ((0,1,1,1),False),
        'TRAFFIC OUT': ((1,0,1,1),False),
        'TRAFFIC IN': ((1,0,1,1),True),
    }
    def emit(self, record):
        try:
            msg = self.format(record)
            kivy_logger.debug(msg)
            print_on_widget(msg, self.level_colors[record.levelname])
        except:
            self.handleError(record)

from lib.core.data import logger
widget_handler = WidgetHandler()
widget_handler.setFormatter(logging.Formatter("[%(asctime)s] [%(levelname)s] %(message)s", "%H:%M:%S"))
# widget_handler.setLevel(logging.DEBUG)
logger.addHandler(widget_handler)


# disable os._exit to forbid exiting in multithreading mode
original_exit = os._exit
threading.current_thread().name = 'sqlmapchik_main_thread'
def exit_wrapper(status):
    if threading.current_thread().name == 'sqlmapchik_main_thread':
        original_exit(status)
    else:
        kivy_logger.warning('%s attempted to call os._exit(%d), ignoring' % (threading.current_thread().name, status))
os._exit = exit_wrapper