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

Skip to content

Commit 7e1ff1b

Browse files
committed
Same refactoring as the last commit
1 parent 0cc6e68 commit 7e1ff1b

7 files changed

Lines changed: 7 additions & 21 deletions

File tree

lib/core/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@
125125
from lib.core.settings import TEXT_TAG_REGEX
126126
from lib.core.settings import TIME_STDEV_COEFF
127127
from lib.core.settings import UNICODE_ENCODING
128-
from lib.core.settings import UNKNOWN_DBMS
129128
from lib.core.settings import UNKNOWN_DBMS_VERSION
130129
from lib.core.settings import URI_QUESTION_MARKER
131130
from lib.core.settings import URLENCODE_CHAR_LIMIT

plugins/dbms/access/fingerprint.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from lib.core.common import Backend
1111
from lib.core.common import Format
1212
from lib.core.common import getCurrentThreadData
13-
from lib.core.common import randomInt
1413
from lib.core.common import randomStr
1514
from lib.core.common import wasLastResponseDBMSError
1615
from lib.core.data import conf
@@ -67,8 +66,7 @@ def _sysTablesCheck(self):
6766
negate = True
6867
table = table[1:]
6968

70-
randInt = randomInt()
71-
result = inject.checkBooleanExpression("EXISTS(SELECT * FROM %s WHERE %d=%d)" % (table, randInt, randInt))
69+
result = inject.checkBooleanExpression("EXISTS(SELECT * FROM %s WHERE [RANDNUM]=[RANDNUM])" % table)
7270
if result is None:
7371
result = False
7472

@@ -91,9 +89,8 @@ def _getDatabaseDir(self):
9189
infoMsg = "searching for database directory"
9290
logger.info(infoMsg)
9391

94-
randInt = randomInt()
9592
randStr = randomStr()
96-
inject.checkBooleanExpression("EXISTS(SELECT * FROM %s.%s WHERE %d=%d)" % (randStr, randStr, randInt, randInt))
93+
inject.checkBooleanExpression("EXISTS(SELECT * FROM %s.%s WHERE [RANDNUM]=[RANDNUM])" % (randStr, randStr))
9794

9895
if wasLastResponseDBMSError():
9996
threadData = getCurrentThreadData()

plugins/dbms/db2/fingerprint.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from lib.core.common import Backend
1010
from lib.core.common import Format
11-
from lib.core.common import randomInt
1211
from lib.core.data import conf
1312
from lib.core.data import kb
1413
from lib.core.data import logger
@@ -90,8 +89,7 @@ def checkDbms(self):
9089
logMsg = "testing %s" % DBMS.DB2
9190
logger.info(logMsg)
9291

93-
randInt = randomInt()
94-
result = inject.checkBooleanExpression("%d=(SELECT %d FROM SYSIBM.SYSDUMMY1)" % (randInt, randInt))
92+
result = inject.checkBooleanExpression("[RANDNUM]=(SELECT [RANDNUM] FROM SYSIBM.SYSDUMMY1)")
9593

9694
if result:
9795
logMsg = "confirming %s" % DBMS.DB2

plugins/dbms/firebird/fingerprint.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from lib.core.common import Backend
1111
from lib.core.common import Format
1212
from lib.core.common import getUnicode
13-
from lib.core.common import randomInt
1413
from lib.core.common import randomRange
1514
from lib.core.data import conf
1615
from lib.core.data import kb
@@ -122,8 +121,7 @@ def checkDbms(self):
122121
infoMsg = "testing %s" % DBMS.FIREBIRD
123122
logger.info(infoMsg)
124123

125-
randInt = randomInt()
126-
result = inject.checkBooleanExpression("(SELECT COUNT(*) FROM RDB$DATABASE WHERE %d=%d)>0" % (randInt, randInt))
124+
result = inject.checkBooleanExpression("(SELECT COUNT(*) FROM RDB$DATABASE WHERE [RANDNUM]=[RANDNUM])>0")
127125

128126
if result:
129127
infoMsg = "confirming %s" % DBMS.FIREBIRD

plugins/dbms/mssqlserver/fingerprint.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from lib.core.common import Backend
99
from lib.core.common import Format
1010
from lib.core.common import getUnicode
11-
from lib.core.common import randomInt
1211
from lib.core.data import conf
1312
from lib.core.data import kb
1413
from lib.core.data import logger
@@ -85,8 +84,7 @@ def checkDbms(self):
8584
if conf.direct:
8685
result = True
8786
else:
88-
randInt = randomInt()
89-
result = inject.checkBooleanExpression("BINARY_CHECKSUM(%d)=BINARY_CHECKSUM(%d)" % (randInt, randInt))
87+
result = inject.checkBooleanExpression("BINARY_CHECKSUM([RANDNUM])=BINARY_CHECKSUM([RANDNUM])")
9088

9189
if result:
9290
infoMsg = "confirming %s" % DBMS.MSSQL

plugins/dbms/mysql/fingerprint.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from lib.core.common import Backend
1111
from lib.core.common import Format
1212
from lib.core.common import getUnicode
13-
from lib.core.common import randomInt
1413
from lib.core.data import conf
1514
from lib.core.data import kb
1615
from lib.core.data import logger

plugins/dbms/postgresql/fingerprint.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
from lib.core.common import Backend
99
from lib.core.common import Format
10-
from lib.core.common import getUnicode
11-
from lib.core.common import randomInt
1210
from lib.core.data import conf
1311
from lib.core.data import kb
1412
from lib.core.data import logger
@@ -76,14 +74,13 @@ def checkDbms(self):
7674
infoMsg = "testing %s" % DBMS.PGSQL
7775
logger.info(infoMsg)
7876

79-
randInt = getUnicode(randomInt(1))
80-
result = inject.checkBooleanExpression("%s::int=%s" % (randInt, randInt))
77+
result = inject.checkBooleanExpression("[RANDNUM]::int=[RANDNUM]")
8178

8279
if result:
8380
infoMsg = "confirming %s" % DBMS.PGSQL
8481
logger.info(infoMsg)
8582

86-
result = inject.checkBooleanExpression("COALESCE(%s, NULL)=%s" % (randInt, randInt))
83+
result = inject.checkBooleanExpression("COALESCE([RANDNUM], NULL)=[RANDNUM]")
8784

8885
if not result:
8986
warnMsg = "the back-end DBMS is not %s" % DBMS.PGSQL

0 commit comments

Comments
 (0)