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

Skip to content

Commit 2c8115e

Browse files
committed
further improvement for ms access table dumping
1 parent 6452321 commit 2c8115e

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

plugins/generic/enumeration.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,10 +1212,18 @@ def dumpTable(self):
12121212

12131213
if kb.dbms == DBMS.ACCESS:
12141214
for column in colList:
1215-
# It would be good to have a numeric column as a pivot
1216-
result = inject.checkBooleanExpression("%s" % safeStringFormat("EXISTS(SELECT %s FROM %s WHERE RND(%s)>0)", (column, conf.tbl, column)))
1215+
infoMsg = "fetching number of distinct "
1216+
infoMsg += "values for column '%s'" % column
1217+
logger.info(infoMsg)
1218+
1219+
query = rootQuery.blind.count2 % (column, conf.tbl)
1220+
value = inject.getValue(query, inband=False)
1221+
1222+
if isNumPosStrValue(value) and value == count:
1223+
infoMsg = "using column '%s' as a pivot " % column
1224+
infoMsg += "for retrieving row data"
1225+
logger.info(infoMsg)
12171226

1218-
if result:
12191227
colList.remove(column)
12201228
colList.insert(0, column)
12211229
break

xml/queries.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@
359359
<tables/>
360360
<dump_table>
361361
<inband query="SELECT %s FROM %s"/>
362-
<blind query="SELECT MIN(%s) FROM %s WHERE CVAR(%s) > '%s'" query2="SELECT TOP 1 %s FROM %s WHERE CVAR(%s) LIKE '%s'" count="SELECT COUNT(*) FROM %s"/>
362+
<blind query="SELECT MIN(%s) FROM %s WHERE CVAR(%s) > '%s'" query2="SELECT TOP 1 %s FROM %s WHERE CVAR(%s) LIKE '%s'" count="SELECT COUNT(*) FROM %s" count2="SELECT COUNT(*) FROM (SELECT DISTINCT %s FROM %s)"/>
363363
</dump_table>
364364
</dbms>
365365

0 commit comments

Comments
 (0)