Minor refactoring

This commit is contained in:
Miroslav Stampar 2012-12-07 11:54:34 +01:00
parent fbaeecdaf9
commit 75e6d77fbc
3 changed files with 7 additions and 4 deletions

View File

@ -21,6 +21,7 @@ from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
from lib.core.dicts import SQL_STATEMENTS
from lib.core.enums import CUSTOM_LOGGING
from lib.core.enums import DBMS
from lib.core.enums import EXPECTED
from lib.core.settings import UNICODE_ENCODING
@ -44,7 +45,7 @@ def direct(query, content=True):
if select and not query.upper().startswith("SELECT "):
query = "SELECT %s" % query
logger.log(9, query)
logger.log(CUSTOM_LOGGING.PAYLOAD, query)
output = hashDBRetrieve(query, True, True)
start = time.time()

View File

@ -16,6 +16,7 @@ from lib.core.common import getUnicode
from lib.core.common import urlencode
from lib.core.data import conf
from lib.core.data import logger
from lib.core.enums import CUSTOM_LOGGING
from lib.core.exception import SqlmapConnectionException
from lib.core.exception import SqlmapGenericException
from lib.core.settings import GOOGLE_REGEX
@ -67,7 +68,7 @@ class Google(object):
requestMsg = "HTTP request:\nGET %s" % url
requestMsg += " %s" % httplib.HTTPConnection._http_vsn_str
logger.log(8, requestMsg)
logger.log(CUSTOM_LOGGING.TRAFFIC_OUT, requestMsg)
page = conn.read()
code = conn.code
@ -82,7 +83,7 @@ class Google(object):
elif conf.verbose > 4:
responseMsg += "%s\n%s\n" % (responseHeaders, page)
logger.log(7, responseMsg)
logger.log(CUSTOM_LOGGING.TRAFFIC_IN, responseMsg)
except urllib2.HTTPError, e:
try:
page = e.read()

View File

@ -8,6 +8,7 @@ See the file 'doc/COPYING' for copying permission
import threading
from lib.core.data import logger
from lib.core.enums import CUSTOM_LOGGING
def timeout(func, args=(), kwargs={}, duration=1, default=None):
class InterruptableThread(threading.Thread):
@ -19,7 +20,7 @@ def timeout(func, args=(), kwargs={}, duration=1, default=None):
try:
self.result = func(*args, **kwargs)
except Exception, msg:
logger.log(7, msg)
logger.log(CUSTOM_LOGGING.TRAFFIC_IN, msg)
self.result = default
thread = InterruptableThread()