Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6b81eef

Browse files
committed
refactoring
1 parent cd6ceb7 commit 6b81eef

8 files changed

Lines changed: 9 additions & 30 deletions

File tree

lib/core/common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
from lib.core.enums import PAYLOAD
5757
from lib.core.enums import REFLECTIVE_COUNTER
5858
from lib.core.enums import SORTORDER
59-
from lib.core.enums import WARNFLAGS
6059
from lib.core.exception import sqlmapDataException
6160
from lib.core.exception import sqlmapFilePathException
6261
from lib.core.exception import sqlmapGenericException
@@ -665,7 +664,7 @@ def dataToStdout(data, forceOutput=False):
665664
warnMsg += "replacement with '?' character. Please, find "
666665
warnMsg += "proper character representation inside "
667666
warnMsg += "coresponding output files. "
668-
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.DATA_TO_STDOUT)
667+
singleTimeLogMessage(warnMsg)
669668

670669
sys.stdout.write(output)
671670
else:

lib/core/enums.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,6 @@ class HTTPHEADER:
9898
REFERER = "Referer"
9999
USER_AGENT = "User-Agent"
100100

101-
class WARNFLAGS:
102-
NO_CAST = 'NO_CAST'
103-
RANDOM_AGENT = 'RANDOM_AGENT'
104-
DATA_TO_STDOUT = 'DATA_TO_STDOUT'
105-
THREADS = 'THREADS'
106-
PIVOT_LIMIT = 'PIVOT_LIMIT'
107-
TIME_UNRECOVERED = 'TIME_UNRECOVERED'
108-
SINGLE_THREAD = 'SINGLE_THREAD'
109-
UNION_APPEARS = 'UNION_APPEARS'
110-
111101
class EXPECTED:
112102
BOOL = "bool"
113103
INT = "int"

lib/request/connect.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"""
99

1010
import httplib
11-
import logging
1211
import re
1312
import socket
1413
import time
@@ -44,7 +43,6 @@
4443
from lib.core.enums import NULLCONNECTION
4544
from lib.core.enums import PAYLOAD
4645
from lib.core.enums import PLACE
47-
from lib.core.enums import WARNFLAGS
4846
from lib.core.exception import sqlmapConnectionException
4947
from lib.core.exception import sqlmapSyntaxException
5048
from lib.core.settings import HTTP_SILENT_TIMEOUT
@@ -415,16 +413,16 @@ def getPage(**kwargs):
415413
warnMsg += "without flag T in --technique option "
416414
warnMsg += "(e.g. --flush-session --technique=BEUS) or try to "
417415
warnMsg += "lower the --time-sec value (e.g. --time-sec=2)"
418-
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.TIME_UNRECOVERED)
416+
singleTimeLogMessage(warnMsg)
419417
elif kb.originalPage is None:
420418
warnMsg = "if the problem persists please try to rerun "
421419
warnMsg += "with the --random-agent switch turned on "
422420
warnMsg += "and/or try to use proxy switches (--ignore-proxy, --proxy,...)"
423-
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.RANDOM_AGENT)
421+
singleTimeLogMessage(warnMsg)
424422
elif conf.threads > 1:
425423
warnMsg = "if the problem persists please try to lower "
426424
warnMsg += "the number of used threads (--threads)"
427-
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.THREADS)
425+
singleTimeLogMessage(warnMsg)
428426

429427
time.sleep(1)
430428

lib/techniques/blind/inference.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
See the file 'doc/COPYING' for copying permission
88
"""
99

10-
import logging
1110
import threading
1211
import time
1312
import traceback
@@ -34,7 +33,6 @@
3433
from lib.core.data import queries
3534
from lib.core.enums import DBMS
3635
from lib.core.enums import PAYLOAD
37-
from lib.core.enums import WARNFLAGS
3836
from lib.core.exception import sqlmapConnectionException
3937
from lib.core.exception import sqlmapValueException
4038
from lib.core.exception import sqlmapThreadException
@@ -118,7 +116,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
118116
if conf.threads == 1 and not timeBasedCompare:
119117
warnMsg = "running in a single-thread mode. please consider usage of "
120118
warnMsg += "--threads option to declare higher number of threads"
121-
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.SINGLE_THREAD)
119+
singleTimeLogMessage(warnMsg)
122120

123121
if conf.verbose in (1, 2) and not showEta:
124122
if isinstance(length, int) and conf.threads > 1:

lib/techniques/inband/union/test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
See the file 'doc/COPYING' for copying permission
88
"""
99

10-
import logging
1110
import random
1211
import re
1312
import time
@@ -34,7 +33,6 @@
3433
from lib.core.data import queries
3534
from lib.core.enums import DBMS
3635
from lib.core.enums import PAYLOAD
37-
from lib.core.enums import WARNFLAGS
3836
from lib.core.settings import FROM_TABLE
3937
from lib.core.settings import UNION_MIN_RESPONSE_CHARS
4038
from lib.core.settings import UNION_STDEV_COEFF
@@ -216,7 +214,7 @@ def __unionTestByCharBruteforce(comment, place, parameter, value, prefix, suffix
216214
warnMsg = "please consider usage of --union-char option "
217215
warnMsg += "(e.g. --union-char=1) and/or try to force "
218216
warnMsg += "back-end DBMS (e.g. --dbms=mysql) to make it work"
219-
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.UNION_APPEARS)
217+
singleTimeLogMessage(warnMsg)
220218

221219
return validPayload, vector
222220

lib/techniques/inband/union/use.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
See the file 'doc/COPYING' for copying permission
88
"""
99

10-
import logging
1110
import re
1211
import threading
1312
import time
@@ -34,7 +33,6 @@
3433
from lib.core.data import queries
3534
from lib.core.enums import DBMS
3635
from lib.core.enums import PAYLOAD
37-
from lib.core.enums import WARNFLAGS
3836
from lib.core.exception import sqlmapConnectionException
3937
from lib.core.exception import sqlmapSyntaxException
4038
from lib.core.settings import FROM_TABLE
@@ -96,7 +94,7 @@ def __oneShotUnionUse(expression, unpack=True):
9694
warnMsg = "if the problem persists with 'None' values please try to use "
9795
warnMsg += "hidden switch --no-cast (fixing problems with some collation "
9896
warnMsg += "issues)"
99-
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.NO_CAST)
97+
singleTimeLogMessage(warnMsg)
10098

10199
return output
102100

lib/utils/hash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def crypt_generic_passwd(password, salt, uppercase=False):
210210

211211
retVal = crypt(password, salt)
212212

213-
return retVal.upper() if uppercase else retVal.lower()
213+
return retVal.upper() if uppercase else retVal
214214

215215
__functions__ = {
216216
HASH.MYSQL: mysql_passwd,

plugins/generic/enumeration.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
See the file 'doc/COPYING' for copying permission
88
"""
99

10-
import logging
1110
import re
1211
import time
1312

@@ -49,7 +48,6 @@
4948
from lib.core.enums import DBMS
5049
from lib.core.enums import EXPECTED
5150
from lib.core.enums import PAYLOAD
52-
from lib.core.enums import WARNFLAGS
5351
from lib.core.exception import sqlmapConnectionException
5452
from lib.core.exception import sqlmapMissingMandatoryOptionException
5553
from lib.core.exception import sqlmapNoneDataException
@@ -1412,7 +1410,7 @@ def __pivotDumpTable(self, table, colList, count=None, blind=True):
14121410
if (i + 1) < conf.limitStart:
14131411
warnMsg = "skipping first %d pivot " % conf.limitStart
14141412
warnMsg += "point values"
1415-
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.PIVOT_LIMIT)
1413+
singleTimeLogMessage(warnMsg)
14161414
break
14171415
elif (i + 1) > conf.limitStop:
14181416
breakRetrieval = True

0 commit comments

Comments
 (0)