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

Skip to content

Commit 496075e

Browse files
committed
Trivial refactoring
1 parent ac2359f commit 496075e

5 files changed

Lines changed: 11 additions & 6 deletions

File tree

lib/controller/checks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
from lib.core.settings import CHECK_INTERNET_ADDRESS
7474
from lib.core.settings import CHECK_INTERNET_VALUE
7575
from lib.core.settings import DEFAULT_GET_POST_DELIMITER
76+
from lib.core.settings import DEV_EMAIL_ADDRESS
7677
from lib.core.settings import DUMMY_NON_SQLI_CHECK_APPENDIX
7778
from lib.core.settings import FI_ERROR_REGEX
7879
from lib.core.settings import FORMAT_EXCEPTION_STRINGS
@@ -1411,7 +1412,7 @@ def _(*args, **kwargs):
14111412
message = "WAF/IPS/IDS specific response can be found in '%s'. " % filename
14121413
message += "If you know the details on used protection please "
14131414
message += "report it along with specific response "
1414-
message += "to '[email protected]'"
1415+
message += "to '%s'" % DEV_EMAIL_ADDRESS
14151416
logger.warn(message)
14161417

14171418
message = "are you sure that you want to "

lib/core/common.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
from lib.core.settings import DEFAULT_COOKIE_DELIMITER
103103
from lib.core.settings import DEFAULT_GET_POST_DELIMITER
104104
from lib.core.settings import DEFAULT_MSSQL_SCHEMA
105+
from lib.core.settings import DEV_EMAIL_ADDRESS
105106
from lib.core.settings import DUMMY_USER_INJECTION
106107
from lib.core.settings import DYNAMICITY_MARK_LENGTH
107108
from lib.core.settings import ERROR_PARSING_REGEXES
@@ -1768,7 +1769,7 @@ def safeStringFormat(format_, params):
17681769
if isinstance(params, basestring):
17691770
retVal = retVal.replace("%s", params, 1)
17701771
elif not isListLike(params):
1771-
retVal = retVal.replace("%s", str(params), 1)
1772+
retVal = retVal.replace("%s", getUnicode(params), 1)
17721773
else:
17731774
start, end = 0, len(retVal)
17741775
match = re.search(r"%s(.+)%s" % (PAYLOAD_DELIMITER, PAYLOAD_DELIMITER), retVal)
@@ -1794,7 +1795,7 @@ def safeStringFormat(format_, params):
17941795
if match:
17951796
if count >= len(params):
17961797
warnMsg = "wrong number of parameters during string formatting. "
1797-
warnMsg += "Please report by e-mail content \"%r | %r | %r\" to '[email protected]'" % (format_, params, retVal)
1798+
warnMsg += "Please report by e-mail content \"%r | %r | %r\" to '%s'" % (format_, params, retVal, DEV_EMAIL_ADDRESS)
17981799
raise SqlmapValueException(warnMsg)
17991800
else:
18001801
retVal = re.sub(r"(\A|[^A-Za-z0-9])(%s)([^A-Za-z0-9]|\Z)", r"\g<1>%s\g<3>" % params[count], retVal, 1)

lib/core/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
2626
DESCRIPTION = "automatic SQL injection and database takeover tool"
2727
SITE = "http://sqlmap.org"
28+
DEV_EMAIL_ADDRESS = "[email protected]"
2829
ISSUES_PAGE = "https://github.com/sqlmapproject/sqlmap/issues/new"
2930
GIT_REPOSITORY = "git://github.com/sqlmapproject/sqlmap.git"
3031
GIT_PAGE = "https://github.com/sqlmapproject/sqlmap"

lib/request/basic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from lib.core.exception import SqlmapCompressionException
3434
from lib.core.settings import BLOCKED_IP_REGEX
3535
from lib.core.settings import DEFAULT_COOKIE_DELIMITER
36+
from lib.core.settings import DEV_EMAIL_ADDRESS
3637
from lib.core.settings import EVENTVALIDATION_REGEX
3738
from lib.core.settings import MAX_CONNECTION_TOTAL_SIZE
3839
from lib.core.settings import META_CHARSET_REGEX
@@ -214,7 +215,7 @@ def checkCharEncoding(encoding, warn=True):
214215
except (LookupError, ValueError):
215216
if warn:
216217
warnMsg = "unknown web page charset '%s'. " % encoding
217-
warnMsg += "Please report by e-mail to '[email protected]'"
218+
warnMsg += "Please report by e-mail to '%s'" % DEV_EMAIL_ADDRESS
218219
singleTimeLogMessage(warnMsg, logging.WARN, encoding)
219220
encoding = None
220221

lib/utils/hash.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
from lib.core.exception import SqlmapUserQuitException
7171
from lib.core.settings import COMMON_PASSWORD_SUFFIXES
7272
from lib.core.settings import COMMON_USER_COLUMNS
73+
from lib.core.settings import DEV_EMAIL_ADDRESS
7374
from lib.core.settings import DUMMY_USER_PREFIX
7475
from lib.core.settings import HASH_MOD_ITEM_DISPLAY
7576
from lib.core.settings import HASH_RECOGNITION_QUIT_THRESHOLD
@@ -763,7 +764,7 @@ def _bruteProcessVariantA(attack_info, hash_regex, suffix, retVal, proc_id, proc
763764

764765
except Exception, e:
765766
warnMsg = "there was a problem while hashing entry: %s (%s). " % (repr(word), e)
766-
warnMsg += "Please report by e-mail to '[email protected]'"
767+
warnMsg += "Please report by e-mail to '%s'" % DEV_EMAIL_ADDRESS
767768
logger.critical(warnMsg)
768769

769770
except KeyboardInterrupt:
@@ -837,7 +838,7 @@ def _bruteProcessVariantB(user, hash_, kwargs, hash_regex, suffix, retVal, found
837838

838839
except Exception, e:
839840
warnMsg = "there was a problem while hashing entry: %s (%s). " % (repr(word), e)
840-
warnMsg += "Please report by e-mail to '[email protected]'"
841+
warnMsg += "Please report by e-mail to '%s'" % DEV_EMAIL_ADDRESS
841842
logger.critical(warnMsg)
842843

843844
except KeyboardInterrupt:

0 commit comments

Comments
 (0)