Skip to content

Commit ff77075

Browse files
committed
minor improvement
1 parent f5ff78d commit ff77075

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

lib/techniques/inband/union/test.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
See the file 'doc/COPYING' for copying permission
88
"""
99

10+
import re
1011
import time
1112

1213
from lib.core.agent import agent
@@ -17,6 +18,7 @@
1718
from lib.core.common import getUnicode
1819
from lib.core.common import parseUnionPage
1920
from lib.core.common import randomStr
21+
from lib.core.common import wasLastRequestDBMSError
2022
from lib.core.data import conf
2123
from lib.core.data import kb
2224
from lib.core.data import logger
@@ -48,7 +50,10 @@ def __unionPosition(comment, place, parameter, value, prefix, suffix, count, whe
4850
# Perform the request
4951
resultPage, _ = Request.queryPage(payload, place=place, content=True, raise404=False)
5052

51-
if resultPage and randQuery in resultPage and not extractRegexResult('(?P<result>UNION ALL SELECT)', resultPage, re.I):
53+
if wasLastRequestDBMSError() or extractRegexResult('(?P<result>UNION ALL SELECT)', resultPage, re.I):
54+
continue
55+
56+
if resultPage and randQuery in resultPage:
5257
validPayload = payload
5358
vector = (position, count, comment, prefix, suffix, conf.uChar, where)
5459

@@ -65,7 +70,10 @@ def __unionPosition(comment, place, parameter, value, prefix, suffix, count, whe
6570
# Perform the request
6671
resultPage, _ = Request.queryPage(payload, place=place, content=True, raise404=False)
6772

68-
if resultPage and not extractRegexResult('(?P<result>UNION ALL SELECT)', resultPage, re.I) and ((randQuery in resultPage and randQuery2 not in resultPage) or (randQuery not in resultPage and randQuery2 in resultPage)):
73+
if wasLastRequestDBMSError() or extractRegexResult('(?P<result>UNION ALL SELECT)', resultPage, re.I):
74+
continue
75+
76+
if resultPage and ((randQuery in resultPage and randQuery2 not in resultPage) or (randQuery not in resultPage and randQuery2 in resultPage)):
6977
vector = (position, count, comment, prefix, suffix, conf.uChar, 2)
7078

7179
break

0 commit comments

Comments
 (0)