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

Skip to content

Commit c47b44e

Browse files
committed
Merge branch 'master' of github.com:sqlmapproject/sqlmap
2 parents 1152cf8 + 55a9f91 commit c47b44e

5 files changed

Lines changed: 19 additions & 38 deletions

File tree

lib/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ def normalizePath(filepath):
13601360
retVal = filepath
13611361

13621362
if retVal:
1363-
retVal = retVal.strip("\r").strip("\n")
1363+
retVal = retVal.strip("\r\n")
13641364
retVal = ntpath.normpath(retVal) if isWindowsDriveLetterPath(retVal) else posixpath.normpath(retVal)
13651365

13661366
return retVal

lib/core/option.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ def _getaddrinfo(*args, **kwargs):
916916

917917
def _setHTTPProxy():
918918
"""
919-
Check and set the HTTP proxy to pass by all HTTP requests.
919+
Check and set the HTTP/SOCKS proxy for all HTTP requests.
920920
"""
921921

922922
global proxyHandler
@@ -927,7 +927,7 @@ def _setHTTPProxy():
927927

928928
return
929929

930-
debugMsg = "setting the HTTP/SOCKS proxy to pass by all HTTP requests"
930+
debugMsg = "setting the HTTP/SOCKS proxy for all HTTP requests"
931931
logger.debug(debugMsg)
932932

933933
proxySplit = urlparse.urlsplit(conf.proxy)
@@ -1376,7 +1376,7 @@ def _cleanupOptions():
13761376
if not any([char in conf.testFilter for char in ('.', ')', '(', ']', '[')]):
13771377
conf.testFilter = conf.testFilter.replace('*', '.*')
13781378

1379-
if conf.timeSec not in kb.explicitSettings:
1379+
if "timeSec" not in kb.explicitSettings:
13801380
if conf.tor:
13811381
conf.timeSec = 2 * conf.timeSec
13821382
kb.adjustTimeDelay = ADJUST_TIME_DELAY.DISABLE

plugins/generic/filesystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _checkFileLength(self, localFile, remoteFile, fileRead=False):
6565
if localFileSize == remoteFileSize:
6666
sameFile = True
6767
infoMsg = "the local file %s and the remote file " % localFile
68-
infoMsg += "%s have the same size" % remoteFile
68+
infoMsg += "%s has the same size" % remoteFile
6969
elif remoteFileSize > localFileSize:
7070
infoMsg = "the remote file %s is larger than " % remoteFile
7171
infoMsg += "the local file %s" % localFile

tamper/between.py

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,10 @@ def tamper(payload, **kwargs):
3838
retVal = payload
3939

4040
if payload:
41-
retVal = ""
42-
quote, doublequote, firstspace = False, False, False
41+
match = re.search(r"(?i)(\b(AND|OR)\b\s+)(?!.*\b(AND|OR)\b)([^>]+?)\s*>\s*([^>]+)\s*\Z", payload)
4342

44-
for i in xrange(len(payload)):
45-
if not firstspace:
46-
if payload[i].isspace():
47-
firstspace = True
48-
retVal += " "
49-
continue
50-
51-
elif payload[i] == '\'':
52-
quote = not quote
53-
54-
elif payload[i] == '"':
55-
doublequote = not doublequote
56-
57-
elif payload[i] == ">" and not doublequote and not quote:
58-
retVal += " " if i > 0 and not payload[i - 1].isspace() else ""
59-
retVal += "NOT BETWEEN %s AND" % ('0' if re.search(r"\A[^\w]*\d", payload[i + 1:]) else "NULL")
60-
retVal += " " if i < len(payload) - 1 and not payload[i + 1:i + 2].isspace() else ""
61-
62-
continue
63-
64-
retVal += payload[i]
43+
if match:
44+
_ = "%s %s NOT BETWEEN 0 AND %s" % (match.group(2), match.group(4), match.group(5))
45+
retVal = retVal.replace(match.group(0), _)
6546

6647
return retVal

xml/queries.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<concatenate query="CONCAT(%s,%s)"/>
2020
<case query="SELECT (CASE WHEN (%s) THEN 1 ELSE 0 END)"/>
2121
<hex query="HEX(%s)"/>
22-
<inference query="ORD(MID((%s),%d,1)) > %d"/>
22+
<inference query="ORD(MID((%s),%d,1))>%d"/>
2323
<banner query="VERSION()"/>
2424
<current_user query="CURRENT_USER()"/>
2525
<current_db query="DATABASE()"/>
@@ -87,7 +87,7 @@
8787
<concatenate query="%s||%s"/>
8888
<case query="SELECT (CASE WHEN (%s) THEN '1' ELSE '0' END)"/>
8989
<hex query="ENCODE(CONVERT_TO((%s),'UTF8'),'HEX')"/>
90-
<inference query="ASCII(SUBSTR((%s)::text,%d,1)) > %d"/>
90+
<inference query="ASCII(SUBSTR((%s)::text,%d,1))>%d"/>
9191
<banner query="VERSION()"/>
9292
<current_user query="CURRENT_USER"/>
9393
<current_db query="CURRENT_DATABASE()"/>
@@ -155,7 +155,7 @@
155155
<concatenate query="%s+%s"/>
156156
<case query="SELECT (CASE WHEN (%s) THEN '1' ELSE '0' END)"/>
157157
<hex query="master.sys.fn_varbintohexstr(CAST(%s AS VARBINARY(MAX)))"/>
158-
<inference query="UNICODE(SUBSTRING((%s),%d,1)) > %d"/>
158+
<inference query="UNICODE(SUBSTRING((%s),%d,1))>%d"/>
159159
<banner query="SELECT @@VERSION"/>
160160
<current_user query="SELECT SYSTEM_USER"/>
161161
<current_db query="SELECT DB_NAME()"/>
@@ -221,7 +221,7 @@
221221
<concatenate query="%s||%s"/>
222222
<case query="SELECT (CASE WHEN (%s) THEN 1 ELSE 0 END)"/>
223223
<hex query="RAWTOHEX(%s)"/>
224-
<inference query="ASCII(SUBSTRC((%s),%d,1)) > %d"/>
224+
<inference query="ASCII(SUBSTRC((%s),%d,1))>%d"/>
225225
<banner query="SELECT banner FROM v$version WHERE ROWNUM=1"/>
226226
<current_user query="SELECT USER FROM DUAL"/>
227227
<!--
@@ -310,7 +310,7 @@
310310
<concatenate query="%s||%s"/>
311311
<case query="SELECT (CASE WHEN (%s) THEN 1 ELSE 0 END)"/>
312312
<hex query="HEX(%s)"/>
313-
<inference query="SUBSTR((%s),%d,1) > '%c'"/>
313+
<inference query="SUBSTR((%s),%d,1)>'%c'"/>
314314
<banner query="SELECT SQLITE_VERSION()"/>
315315
<current_user/>
316316
<current_db/>
@@ -359,7 +359,7 @@
359359
<substring query="MID((%s),%d,%d)"/>
360360
<concatenate query="%s&amp;%s"/>
361361
<case query="SELECT (IIF(%s,1,0))"/>
362-
<inference query="ASCW(MID((%s),%d,1)) > %d"/>
362+
<inference query="ASCW(MID((%s),%d,1))>%d"/>
363363
<banner/>
364364
<!--CURRENTUSER() is not available outside the MS Access query tool itself-->
365365
<current_user/>
@@ -401,7 +401,7 @@
401401
<substring query="SUBSTRING((%s) FROM %d FOR %d)"/>
402402
<concatenate query="%s||%s"/>
403403
<case query="SELECT IIF(%s,1,0)"/>
404-
<inference query="ASCII_VAL(SUBSTRING((%s) FROM %d FOR 1)) > %d" dbms_version="&gt;=2.1" query2="SUBSTRING((%s) FROM %d FOR 1) > '%c'"/>
404+
<inference query="ASCII_VAL(SUBSTRING((%s) FROM %d FOR 1))>%d" dbms_version="&gt;=2.1" query2="SUBSTRING((%s) FROM %d FOR 1)>'%c'"/>
405405
<banner query="SELECT RDB$GET_CONTEXT('SYSTEM','ENGINE_VERSION') FROM RDB$DATABASE" dbms_version="&gt;=2.1"/>
406406
<current_user query="SELECT CURRENT_USER FROM RDB$DATABASE"/>
407407
<current_db query="SELECT RDB$GET_CONTEXT('SYSTEM','DB_NAME') FROM RDB$DATABASE"/>
@@ -457,7 +457,7 @@
457457
<concatenate query="CONCAT(%s,%s)"/>
458458
<case query="SELECT (CASE WHEN (%s) THEN 1 ELSE 0 END)"/>
459459
<hex query="HEX(%s)"/>
460-
<inference query="SUBSTR((%s),%d,1) > '%c'"/>
460+
<inference query="SUBSTR((%s),%d,1)>'%c'"/>
461461
<banner query="SELECT ID FROM SYSINFO.VERSION"/>
462462
<current_user query="SELECT USER() FROM DUAL"/>
463463
<current_db query="SELECT DATABASE() FROM DUAL"/>
@@ -507,7 +507,7 @@
507507
<concatenate query="%s+%s"/>
508508
<case query="SELECT (CASE WHEN (%s) THEN '1' ELSE '0' END)"/>
509509
<hex query="BINTOSTR(CONVERT(VARBINARY,%s))"/>
510-
<inference query="ASCII(SUBSTRING((%s),%d,1)) > %d"/>
510+
<inference query="ASCII(SUBSTRING((%s),%d,1))>%d"/>
511511
<banner query="SELECT @@VERSION"/>
512512
<current_user query="SELECT SUSER_NAME()"/>
513513
<current_db query="SELECT DB_NAME()"/>
@@ -576,7 +576,7 @@
576576
<concatenate query="%s||%s"/>
577577
<case query="SELECT (CASE WHEN (%s) THEN '1' ELSE '0' END) FROM SYSIBM.SYSDUMMY1"/>
578578
<hex query="HEX(%s)"/>
579-
<inference query="SUBSTR((%s),%d,1) > '%c'"/>
579+
<inference query="SUBSTR((%s),%d,1)>'%c'"/>
580580
<!-- NOTE: We have to use the complicated UDB OLAP functions in query2 because sqlmap injects isnull query inside MAX function, else we would use: SELECT MAX(versionnumber) FROM sysibm.sysversions -->
581581
<banner query="SELECT service_level FROM TABLE(sysproc.env_get_inst_info())" query2="SELECT versionnumber FROM (SELECT ROW_NUMBER() OVER (ORDER BY versionnumber DESC) AS LIMIT,versionnumber FROM sysibm.sysversions) AS foobar WHERE LIMIT=1"/>
582582
<current_user query="SELECT user FROM SYSIBM.SYSDUMMY1"/>

0 commit comments

Comments
 (0)