Skip to content

Commit 0e206da

Browse files
committed
Minor patches (pydiatra)
1 parent 81e6dab commit 0e206da

File tree

13 files changed

+29
-26
lines changed

13 files changed

+29
-26
lines changed

extra/mssqlsig/update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def updateMSSQLXML():
4343

4444
return
4545

46-
releases = re.findall("class=\"BCC_DV_01DarkBlueTitle\">SQL Server\s(.+?)\sBuilds", mssqlVersionsHtmlString, re.I | re.M)
46+
releases = re.findall("class=\"BCC_DV_01DarkBlueTitle\">SQL Server\s(.+?)\sBuilds", mssqlVersionsHtmlString, re.I)
4747
releasesCount = len(releases)
4848

4949
# Create the minidom document
@@ -74,7 +74,7 @@ def updateMSSQLXML():
7474
stopIdx = mssqlVersionsHtmlString.index("SQL Server %s Builds" % releases[index + 1])
7575

7676
mssqlVersionsReleaseString = mssqlVersionsHtmlString[startIdx:stopIdx]
77-
servicepackVersion = re.findall("</td><td>[7\.0|2000|2005|2008|2008 R2]*(.*?)</td><td.*?([\d\.]+)</td>[\r]*\n", mssqlVersionsReleaseString, re.I | re.M)
77+
servicepackVersion = re.findall("</td><td>[7\.0|2000|2005|2008|2008 R2]*(.*?)</td><td.*?([\d\.]+)</td>[\r]*\n", mssqlVersionsReleaseString, re.I)
7878

7979
for servicePack, version in servicepackVersion:
8080
if servicePack.startswith(" "):

extra/shutils/regressiontest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def main():
8383
if stderr:
8484
failure_email("Execution of regression test failed with error:\n\n%s" % stderr)
8585

86-
failed_tests = re.findall("running live test case: (.+?) \((\d+)\/\d+\)[\r]*\n.+test failed (at parsing items: (.+))?\s*\- scan folder: (\/.+) \- traceback: (.*?)( - SQL injection not detected)?[\r]*\n", stdout, re.M)
86+
failed_tests = re.findall("running live test case: (.+?) \((\d+)\/\d+\)[\r]*\n.+test failed (at parsing items: (.+))?\s*\- scan folder: (\/.+) \- traceback: (.*?)( - SQL injection not detected)?[\r]*\n", stdout)
8787

8888
for failed_test in failed_tests:
8989
title = failed_test[0]

lib/controller/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _formatInjection(inj):
140140
if inj.place == PLACE.CUSTOM_HEADER:
141141
payload = payload.split(',', 1)[1]
142142
if stype == PAYLOAD.TECHNIQUE.UNION:
143-
count = re.sub(r"(?i)(\(.+\))|(\blimit[^A-Za-z]+)", "", sdata.payload).count(',') + 1
143+
count = re.sub(r"(?i)(\(.+\))|(\blimit[^a-z]+)", "", sdata.payload).count(',') + 1
144144
title = re.sub(r"\d+ to \d+", str(count), title)
145145
vector = agent.forgeUnionQuery("[QUERY]", vector[0], vector[1], vector[2], None, None, vector[5], vector[6])
146146
if count == 1:

lib/core/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def suffixQuery(self, expression, comment=None, suffix=None, where=None):
296296
elif suffix and not comment:
297297
expression += suffix.replace('\\', BOUNDARY_BACKSLASH_MARKER)
298298

299-
return re.sub(r"(?s);\W*;", ";", expression)
299+
return re.sub(r";\W*;", ";", expression)
300300

301301
def cleanupPayload(self, payload, origValue=None):
302302
if payload is None:

lib/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ def getSQLSnippet(dbms, sfile, **variables):
19611961

19621962
retVal = readCachedFileContent(filename)
19631963
retVal = re.sub(r"#.+", "", retVal)
1964-
retVal = re.sub(r"(?s);\s+", "; ", retVal).strip("\r\n")
1964+
retVal = re.sub(r";\s+", "; ", retVal).strip("\r\n")
19651965

19661966
for _ in variables.keys():
19671967
retVal = re.sub(r"%%%s%%" % _, variables[_], retVal)

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.1.4.23"
22+
VERSION = "1.1.4.24"
2323
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2424
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2525
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/core/target.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,8 @@ def _setResultsFile():
532532
except (OSError, IOError), ex:
533533
try:
534534
warnMsg = "unable to create results file '%s' ('%s'). " % (conf.resultsFilename, getUnicode(ex))
535-
conf.resultsFilename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.RESULTS, suffix=".csv")[1]
535+
handle, conf.resultsFilename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.RESULTS, suffix=".csv")
536+
os.close(handle)
536537
conf.resultsFP = openFile(conf.resultsFilename, "w+", UNICODE_ENCODING, buffering=0)
537538
warnMsg += "Using temporary file '%s' instead" % conf.resultsFilename
538539
logger.warn(warnMsg)

lib/utils/api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ def reset_options(self):
163163
self.options = AttribDict(self._original_options)
164164

165165
def engine_start(self):
166-
configFile = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.CONFIG, text=True)[1]
166+
handle, configFile = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.CONFIG, text=True)
167+
os.close(handle)
167168
saveConfig(self.options, configFile)
168169

169170
if os.path.exists("sqlmap.py"):
@@ -651,7 +652,8 @@ def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=REST
651652
REST-JSON API server
652653
"""
653654
DataStore.admin_id = hexencode(os.urandom(16))
654-
Database.filepath = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.IPC, text=False)[1]
655+
handle, Database.filepath = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.IPC, text=False)
656+
os.close(handle)
655657

656658
if port == 0: # random
657659
with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:

lib/utils/crawler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def crawlThread():
8787
tags = soup('a')
8888

8989
if not tags:
90-
tags = re.finditer(r'(?si)<a[^>]+href="(?P<href>[^>"]+)"', content)
90+
tags = re.finditer(r'(?i)<a[^>]+href="(?P<href>[^>"]+)"', content)
9191

9292
for tag in tags:
9393
href = tag.get("href") if hasattr(tag, "get") else tag.group("href")

plugins/generic/syntax.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def _escape(expression, quote=True, escaper=None):
2222
retVal = expression
2323

2424
if quote:
25-
for item in re.findall(r"'[^']*'+", expression, re.S):
25+
for item in re.findall(r"'[^']*'+", expression):
2626
_ = item[1:-1]
2727
if _:
2828
retVal = retVal.replace(item, escaper(_))

0 commit comments

Comments
 (0)