mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-18 04:20:35 +03:00
Another update for an Issue #287
This commit is contained in:
parent
c3f20a136f
commit
921000bd87
17
_sqlmap.py
17
_sqlmap.py
|
@ -12,6 +12,7 @@ import StringIO
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
import types
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
warnings.filterwarnings(action="ignore", message=".*was already imported", category=UserWarning)
|
warnings.filterwarnings(action="ignore", message=".*was already imported", category=UserWarning)
|
||||||
|
@ -34,7 +35,7 @@ from lib.core.exception import exceptionsTuple
|
||||||
from lib.core.exception import SqlmapSilentQuitException
|
from lib.core.exception import SqlmapSilentQuitException
|
||||||
from lib.core.exception import SqlmapUserQuitException
|
from lib.core.exception import SqlmapUserQuitException
|
||||||
from lib.core.log import FORMATTER
|
from lib.core.log import FORMATTER
|
||||||
from lib.core.log import setLoggerHandler
|
from lib.core.log import LOGGER_HANDLER
|
||||||
from lib.core.option import init
|
from lib.core.option import init
|
||||||
from lib.core.profiling import profile
|
from lib.core.profiling import profile
|
||||||
from lib.core.settings import LEGAL_DISCLAIMER
|
from lib.core.settings import LEGAL_DISCLAIMER
|
||||||
|
@ -54,16 +55,12 @@ def modulePath():
|
||||||
|
|
||||||
def xmlRpcServe():
|
def xmlRpcServe():
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
cmdLineOptions.disableColoring = True
|
||||||
server = XMLRPCServer(cmdLineOptions.xmlRpcPort or XMLRPC_SERVER_PORT)
|
server = XMLRPCServer(cmdLineOptions.xmlRpcPort or XMLRPC_SERVER_PORT)
|
||||||
class _(logging.Handler):
|
def emit(self, record):
|
||||||
def emit(self, record):
|
message = stdoutencode(FORMATTER.format(record))
|
||||||
message = stdoutencode(self.format(record))
|
sys.stdout.write("%s\n" % message)
|
||||||
sys.stdout.write("%s\n" % message)
|
LOGGER_HANDLER.emit = types.MethodType(emit, LOGGER_HANDLER, type(LOGGER_HANDLER))
|
||||||
handler = _()
|
|
||||||
handler.is_tty = False
|
|
||||||
handler.disableColoring = True
|
|
||||||
handler.setFormatter(FORMATTER)
|
|
||||||
setLoggerHandler(handler)
|
|
||||||
sys.stdout = StringIO.StringIO()
|
sys.stdout = StringIO.StringIO()
|
||||||
sys.stderr = StringIO.StringIO()
|
sys.stderr = StringIO.StringIO()
|
||||||
server.serve()
|
server.serve()
|
||||||
|
|
|
@ -17,6 +17,7 @@ logging.addLevelName(CUSTOM_LOGGING.TRAFFIC_IN, "TRAFFIC IN")
|
||||||
|
|
||||||
LOGGER = logging.getLogger("sqlmapLog")
|
LOGGER = logging.getLogger("sqlmapLog")
|
||||||
|
|
||||||
|
LOGGER_HANDLER = None
|
||||||
try:
|
try:
|
||||||
import ctypes
|
import ctypes
|
||||||
LOGGER_HANDLER = ColorizingStreamHandler(sys.stdout)
|
LOGGER_HANDLER = ColorizingStreamHandler(sys.stdout)
|
||||||
|
@ -31,7 +32,3 @@ FORMATTER = logging.Formatter("\r[%(asctime)s] [%(levelname)s] %(message)s", "%H
|
||||||
LOGGER_HANDLER.setFormatter(FORMATTER)
|
LOGGER_HANDLER.setFormatter(FORMATTER)
|
||||||
LOGGER.addHandler(LOGGER_HANDLER)
|
LOGGER.addHandler(LOGGER_HANDLER)
|
||||||
LOGGER.setLevel(logging.WARN)
|
LOGGER.setLevel(logging.WARN)
|
||||||
|
|
||||||
def setLoggerHandler(handler):
|
|
||||||
LOGGER.handlers = []
|
|
||||||
LOGGER.addHandler(handler)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user