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

Skip to content

Commit 05d5342

Browse files
committed
Update and patch for an Issue #2
1 parent 733e06e commit 05d5342

7 files changed

Lines changed: 15 additions & 7 deletions

File tree

lib/controller/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def start():
460460
elif parameter == conf.csrfToken:
461461
testSqlInj = False
462462

463-
infoMsg = "skipping CSRF protection token parameter '%s'" % parameter
463+
infoMsg = "skipping anti-CSRF token parameter '%s'" % parameter
464464
logger.info(infoMsg)
465465

466466
# Ignore session-like parameters for --level < 4

lib/core/optiondict.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
"safUrl": "string",
5353
"saFreq": "integer",
5454
"skipUrlEncode": "boolean",
55+
"csrfToken": "string",
56+
"csrfUrl": "string",
5557
"forceSSL": "boolean",
5658
"hpp": "boolean",
5759
"evalCode": "string",

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@
606606
# Reference: http://www.cookiecentral.com/faq/#3.5
607607
NETSCAPE_FORMAT_HEADER_COOKIES = "# Netscape HTTP Cookie File."
608608

609-
# Infixes used for automatic recognition of parameters carrying CSRF protection tokens
609+
# Infixes used for automatic recognition of parameters carrying anti-CSRF tokens
610610
CSRF_TOKEN_PARAMETER_INFIXES = ("csrf", "xsrf")
611611

612612
# Prefixes used in brute force search for web server document root

lib/core/target.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,14 @@ def process(match, repl):
348348

349349
if conf.csrfToken:
350350
if not any(conf.csrfToken in _ for _ in (conf.paramDict.get(PLACE.GET, {}), conf.paramDict.get(PLACE.POST, {}))) and not conf.csrfToken in set(_[0].lower() for _ in conf.httpHeaders) and not conf.csrfToken in conf.paramDict.get(PLACE.COOKIE, {}):
351-
errMsg = "CSRF protection token parameter '%s' not " % conf.csrfToken
351+
errMsg = "anti-CSRF token parameter '%s' not " % conf.csrfToken
352352
errMsg += "found in provided GET, POST, Cookie or header values"
353353
raise SqlmapGenericException(errMsg)
354354
else:
355355
for place in (PLACE.GET, PLACE.POST, PLACE.COOKIE):
356356
for parameter in conf.paramDict.get(place, {}):
357357
if any(parameter.lower().count(_) for _ in CSRF_TOKEN_PARAMETER_INFIXES):
358-
message = "%s parameter '%s' appears to hold CSRF protection token. " % (place, parameter)
358+
message = "%s parameter '%s' appears to hold anti-CSRF token. " % (place, parameter)
359359
message += "Do you want sqlmap to automatically update it in further requests? [y/N] "
360360
test = readInput(message, default="N")
361361
if test and test[0] in ("y", "Y"):

lib/parse/cmdline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ def cmdLineParser():
191191
help="Skip URL encoding of payload data")
192192

193193
request.add_option("--csrf-token", dest="csrfToken",
194-
help="Parameter used to hold CSRF protection token")
194+
help="Parameter used to hold anti-CSRF token")
195195

196196
request.add_option("--csrf-url", dest="csrfUrl",
197-
help="URL address to visit to extract CSRF protection token")
197+
help="URL address to visit to extract anti-CSRF token")
198198

199199
request.add_option("--force-ssl", dest="forceSSL",
200200
action="store_true",

lib/request/connect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ def _adjustParameter(paramString, parameter, newValue):
787787
break
788788

789789
if not token:
790-
errMsg = "CSRF protection token '%s' can't be found at '%s'" % (conf.csrfToken, conf.csrfUrl or conf.url)
790+
errMsg = "anti-CSRF token '%s' can't be found at '%s'" % (conf.csrfToken, conf.csrfUrl or conf.url)
791791
if not conf.csrfUrl:
792792
errMsg += ". You can try to rerun by providing "
793793
errMsg += "a valid value for option '--csrf-url'"

sqlmap.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ saFreq = 0
158158
# Valid: True or False
159159
skipUrlEncode = False
160160

161+
# Parameter used to hold anti-CSRF token
162+
csrfToken =
163+
164+
# URL address to visit to extract anti-CSRF token
165+
csrfUrl =
166+
161167
# Force usage of SSL/HTTPS
162168
# Valid: True or False
163169
forceSSL = False

0 commit comments

Comments
 (0)