Skip to content

Commit 9fab2c9

Browse files
committed
Minor refactoring
1 parent 7244e8e commit 9fab2c9

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@
300300
# String representation for current database
301301
CURRENT_DB = "CD"
302302

303+
# Name of SQLite file used for storing session data
304+
SESSION_SQLITE_FILE = "session.sqlite"
305+
303306
# Regular expressions used for finding file paths in error messages
304307
FILE_PATH_REGEXES = (r"<b>(?P<result>[^<>]+?)</b> on line \d+", r"(?P<result>[^<>'\"]+?)['\"]? on line \d+", r"(?:[>(\[\s])(?P<result>[A-Za-z]:[\\/][\w. \\/-]*)", r"(?:[>(\[\s])(?P<result>/\w[/\w.~-]+)", r"href=['\"]file://(?P<result>/[^'\"]+)")
305308

lib/core/target.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
from lib.core.settings import REFERER_ALIASES
6363
from lib.core.settings import RESTORE_MERGED_OPTIONS
6464
from lib.core.settings import RESULTS_FILE_FORMAT
65+
from lib.core.settings import SESSION_SQLITE_FILE
6566
from lib.core.settings import SUPPORTED_DBMS
6667
from lib.core.settings import UNENCODED_ORIGINAL_VALUE
6768
from lib.core.settings import UNICODE_ENCODING
@@ -396,22 +397,25 @@ def process(match, repl):
396397
raise SqlmapGenericException(errMsg)
397398
else:
398399
for place in (PLACE.GET, PLACE.POST, PLACE.COOKIE):
400+
if conf.csrfToken:
401+
break
402+
399403
for parameter in conf.paramDict.get(place, {}):
400404
if any(parameter.lower().count(_) for _ in CSRF_TOKEN_PARAMETER_INFIXES):
401405
message = "%s parameter '%s' appears to hold anti-CSRF token. " % (place, parameter)
402406
message += "Do you want sqlmap to automatically update it in further requests? [y/N] "
403407

404408
if readInput(message, default='N', boolean=True):
405409
conf.csrfToken = getUnicode(parameter)
406-
break
410+
break
407411

408412
def _setHashDB():
409413
"""
410414
Check and set the HashDB SQLite file for query resume functionality.
411415
"""
412416

413417
if not conf.hashDBFile:
414-
conf.hashDBFile = conf.sessionFile or os.path.join(conf.outputPath, "session.sqlite")
418+
conf.hashDBFile = conf.sessionFile or os.path.join(conf.outputPath, SESSION_SQLITE_FILE)
415419

416420
if os.path.exists(conf.hashDBFile):
417421
if conf.flushSession:

txt/checksum.md5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ e1c000db9be27f973569b1a430629037 lib/core/option.py
4646
760d9df2a27ded29109b390ab202e72d lib/core/replication.py
4747
a2466b62e67f8b31736bac4dac590e51 lib/core/revision.py
4848
02d4762140a72fd44668d3dab5eabda9 lib/core/session.py
49-
0b215c469175a858a36a8858b22c475e lib/core/settings.py
49+
4a2c73dcb44a0982c61e35afee07aada lib/core/settings.py
5050
35bffbad762eb9e03db9e93b1c991103 lib/core/shell.py
5151
a59ec28371ae067a6fdd8f810edbee3d lib/core/subprocessng.py
52-
d5a04d672a18f78deb2839c3745ff83c lib/core/target.py
52+
d93501771b41315f9fb949305b6ed257 lib/core/target.py
5353
df8f6475a53d83400c1a3967c0a21bd7 lib/core/testing.py
5454
632538fe50f6b3179e1a5a85e8b79741 lib/core/threads.py
5555
a119989ca03f8c8fbdf7d3035084eb31 lib/core/unescaper.py

0 commit comments

Comments
 (0)