refactoring

This commit is contained in:
Miroslav Stampar 2011-06-08 14:30:12 +00:00
parent cd6ceb733e
commit 6b81eef65a
8 changed files with 9 additions and 30 deletions

View File

@ -56,7 +56,6 @@ from lib.core.enums import PLACE
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.enums import REFLECTIVE_COUNTER from lib.core.enums import REFLECTIVE_COUNTER
from lib.core.enums import SORTORDER from lib.core.enums import SORTORDER
from lib.core.enums import WARNFLAGS
from lib.core.exception import sqlmapDataException from lib.core.exception import sqlmapDataException
from lib.core.exception import sqlmapFilePathException from lib.core.exception import sqlmapFilePathException
from lib.core.exception import sqlmapGenericException from lib.core.exception import sqlmapGenericException
@ -665,7 +664,7 @@ def dataToStdout(data, forceOutput=False):
warnMsg += "replacement with '?' character. Please, find " warnMsg += "replacement with '?' character. Please, find "
warnMsg += "proper character representation inside " warnMsg += "proper character representation inside "
warnMsg += "coresponding output files. " warnMsg += "coresponding output files. "
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.DATA_TO_STDOUT) singleTimeLogMessage(warnMsg)
sys.stdout.write(output) sys.stdout.write(output)
else: else:

View File

@ -98,16 +98,6 @@ class HTTPHEADER:
REFERER = "Referer" REFERER = "Referer"
USER_AGENT = "User-Agent" USER_AGENT = "User-Agent"
class WARNFLAGS:
NO_CAST = 'NO_CAST'
RANDOM_AGENT = 'RANDOM_AGENT'
DATA_TO_STDOUT = 'DATA_TO_STDOUT'
THREADS = 'THREADS'
PIVOT_LIMIT = 'PIVOT_LIMIT'
TIME_UNRECOVERED = 'TIME_UNRECOVERED'
SINGLE_THREAD = 'SINGLE_THREAD'
UNION_APPEARS = 'UNION_APPEARS'
class EXPECTED: class EXPECTED:
BOOL = "bool" BOOL = "bool"
INT = "int" INT = "int"

View File

@ -8,7 +8,6 @@ See the file 'doc/COPYING' for copying permission
""" """
import httplib import httplib
import logging
import re import re
import socket import socket
import time import time
@ -44,7 +43,6 @@ from lib.core.enums import HTTPMETHOD
from lib.core.enums import NULLCONNECTION from lib.core.enums import NULLCONNECTION
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.enums import PLACE from lib.core.enums import PLACE
from lib.core.enums import WARNFLAGS
from lib.core.exception import sqlmapConnectionException from lib.core.exception import sqlmapConnectionException
from lib.core.exception import sqlmapSyntaxException from lib.core.exception import sqlmapSyntaxException
from lib.core.settings import HTTP_SILENT_TIMEOUT from lib.core.settings import HTTP_SILENT_TIMEOUT
@ -415,16 +413,16 @@ class Connect:
warnMsg += "without flag T in --technique option " warnMsg += "without flag T in --technique option "
warnMsg += "(e.g. --flush-session --technique=BEUS) or try to " warnMsg += "(e.g. --flush-session --technique=BEUS) or try to "
warnMsg += "lower the --time-sec value (e.g. --time-sec=2)" warnMsg += "lower the --time-sec value (e.g. --time-sec=2)"
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.TIME_UNRECOVERED) singleTimeLogMessage(warnMsg)
elif kb.originalPage is None: elif kb.originalPage is None:
warnMsg = "if the problem persists please try to rerun " warnMsg = "if the problem persists please try to rerun "
warnMsg += "with the --random-agent switch turned on " warnMsg += "with the --random-agent switch turned on "
warnMsg += "and/or try to use proxy switches (--ignore-proxy, --proxy,...)" warnMsg += "and/or try to use proxy switches (--ignore-proxy, --proxy,...)"
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.RANDOM_AGENT) singleTimeLogMessage(warnMsg)
elif conf.threads > 1: elif conf.threads > 1:
warnMsg = "if the problem persists please try to lower " warnMsg = "if the problem persists please try to lower "
warnMsg += "the number of used threads (--threads)" warnMsg += "the number of used threads (--threads)"
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.THREADS) singleTimeLogMessage(warnMsg)
time.sleep(1) time.sleep(1)

View File

@ -7,7 +7,6 @@ Copyright (c) 2006-2011 sqlmap developers (http://sqlmap.sourceforge.net/)
See the file 'doc/COPYING' for copying permission See the file 'doc/COPYING' for copying permission
""" """
import logging
import threading import threading
import time import time
import traceback import traceback
@ -34,7 +33,6 @@ from lib.core.data import logger
from lib.core.data import queries from lib.core.data import queries
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.enums import WARNFLAGS
from lib.core.exception import sqlmapConnectionException from lib.core.exception import sqlmapConnectionException
from lib.core.exception import sqlmapValueException from lib.core.exception import sqlmapValueException
from lib.core.exception import sqlmapThreadException from lib.core.exception import sqlmapThreadException
@ -118,7 +116,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
if conf.threads == 1 and not timeBasedCompare: if conf.threads == 1 and not timeBasedCompare:
warnMsg = "running in a single-thread mode. please consider usage of " warnMsg = "running in a single-thread mode. please consider usage of "
warnMsg += "--threads option to declare higher number of threads" warnMsg += "--threads option to declare higher number of threads"
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.SINGLE_THREAD) singleTimeLogMessage(warnMsg)
if conf.verbose in (1, 2) and not showEta: if conf.verbose in (1, 2) and not showEta:
if isinstance(length, int) and conf.threads > 1: if isinstance(length, int) and conf.threads > 1:

View File

@ -7,7 +7,6 @@ Copyright (c) 2006-2011 sqlmap developers (http://sqlmap.sourceforge.net/)
See the file 'doc/COPYING' for copying permission See the file 'doc/COPYING' for copying permission
""" """
import logging
import random import random
import re import re
import time import time
@ -34,7 +33,6 @@ from lib.core.data import logger
from lib.core.data import queries from lib.core.data import queries
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.enums import WARNFLAGS
from lib.core.settings import FROM_TABLE from lib.core.settings import FROM_TABLE
from lib.core.settings import UNION_MIN_RESPONSE_CHARS from lib.core.settings import UNION_MIN_RESPONSE_CHARS
from lib.core.settings import UNION_STDEV_COEFF from lib.core.settings import UNION_STDEV_COEFF
@ -216,7 +214,7 @@ def __unionTestByCharBruteforce(comment, place, parameter, value, prefix, suffix
warnMsg = "please consider usage of --union-char option " warnMsg = "please consider usage of --union-char option "
warnMsg += "(e.g. --union-char=1) and/or try to force " warnMsg += "(e.g. --union-char=1) and/or try to force "
warnMsg += "back-end DBMS (e.g. --dbms=mysql) to make it work" warnMsg += "back-end DBMS (e.g. --dbms=mysql) to make it work"
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.UNION_APPEARS) singleTimeLogMessage(warnMsg)
return validPayload, vector return validPayload, vector

View File

@ -7,7 +7,6 @@ Copyright (c) 2006-2011 sqlmap developers (http://sqlmap.sourceforge.net/)
See the file 'doc/COPYING' for copying permission See the file 'doc/COPYING' for copying permission
""" """
import logging
import re import re
import threading import threading
import time import time
@ -34,7 +33,6 @@ from lib.core.data import logger
from lib.core.data import queries from lib.core.data import queries
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.enums import WARNFLAGS
from lib.core.exception import sqlmapConnectionException from lib.core.exception import sqlmapConnectionException
from lib.core.exception import sqlmapSyntaxException from lib.core.exception import sqlmapSyntaxException
from lib.core.settings import FROM_TABLE from lib.core.settings import FROM_TABLE
@ -96,7 +94,7 @@ def __oneShotUnionUse(expression, unpack=True):
warnMsg = "if the problem persists with 'None' values please try to use " warnMsg = "if the problem persists with 'None' values please try to use "
warnMsg += "hidden switch --no-cast (fixing problems with some collation " warnMsg += "hidden switch --no-cast (fixing problems with some collation "
warnMsg += "issues)" warnMsg += "issues)"
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.NO_CAST) singleTimeLogMessage(warnMsg)
return output return output

View File

@ -210,7 +210,7 @@ def crypt_generic_passwd(password, salt, uppercase=False):
retVal = crypt(password, salt) retVal = crypt(password, salt)
return retVal.upper() if uppercase else retVal.lower() return retVal.upper() if uppercase else retVal
__functions__ = { __functions__ = {
HASH.MYSQL: mysql_passwd, HASH.MYSQL: mysql_passwd,

View File

@ -7,7 +7,6 @@ Copyright (c) 2006-2011 sqlmap developers (http://sqlmap.sourceforge.net/)
See the file 'doc/COPYING' for copying permission See the file 'doc/COPYING' for copying permission
""" """
import logging
import re import re
import time import time
@ -49,7 +48,6 @@ from lib.core.dicts import firebirdPrivs
from lib.core.enums import DBMS from lib.core.enums import DBMS
from lib.core.enums import EXPECTED from lib.core.enums import EXPECTED
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.enums import WARNFLAGS
from lib.core.exception import sqlmapConnectionException from lib.core.exception import sqlmapConnectionException
from lib.core.exception import sqlmapMissingMandatoryOptionException from lib.core.exception import sqlmapMissingMandatoryOptionException
from lib.core.exception import sqlmapNoneDataException from lib.core.exception import sqlmapNoneDataException
@ -1412,7 +1410,7 @@ class Enumeration:
if (i + 1) < conf.limitStart: if (i + 1) < conf.limitStart:
warnMsg = "skipping first %d pivot " % conf.limitStart warnMsg = "skipping first %d pivot " % conf.limitStart
warnMsg += "point values" warnMsg += "point values"
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.PIVOT_LIMIT) singleTimeLogMessage(warnMsg)
break break
elif (i + 1) > conf.limitStop: elif (i + 1) > conf.limitStop:
breakRetrieval = True breakRetrieval = True