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

Skip to content

Commit b1babee

Browse files
committed
update regarding dumping of tables with blind on Sqlite
1 parent f7344a5 commit b1babee

3 files changed

Lines changed: 24 additions & 7 deletions

File tree

lib/core/common.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,3 +1729,13 @@ def isDBMSVersionAtLeast(version):
17291729
retVal = value >= version
17301730

17311731
return retVal
1732+
1733+
def parseSqliteTableSchema(value):
1734+
table = {}
1735+
columns = {}
1736+
1737+
for match in re.finditer(getCompiledRegex(r"(\w+) ([A-Z]+)[,\r\n]"), value):
1738+
columns[match.group(1)] = match.group(2)
1739+
1740+
table[conf.tbl] = columns
1741+
kb.data.cachedColumns[conf.db] = table

plugins/generic/enumeration.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from lib.core.common import getUnicode
2020
from lib.core.common import isNumPosStrValue
2121
from lib.core.common import parsePasswordHash
22+
from lib.core.common import parseSqliteTableSchema
2223
from lib.core.common import popValue
2324
from lib.core.common import pushValue
2425
from lib.core.common import randomStr
@@ -949,16 +950,14 @@ def getColumns(self, onlyColNames=False):
949950

950951
value = inject.getValue(query, blind=False, error=False)
951952

952-
if value:
953+
if kb.dbms == DBMS.SQLITE:
954+
parseSqliteTableSchema(value)
955+
elif value:
953956
table = {}
954957
columns = {}
955958

956-
if kb.dbms == DBMS.SQLITE:
957-
for match in re.finditer(getCompiledRegex(r"(\w+) ([A-Z]+)[,\r\n]"), value):
958-
columns[match.group(1)] = match.group(2)
959-
else:
960-
for column, colType in value:
961-
columns[column] = colType
959+
for column, colType in value:
960+
columns[column] = colType
962961

963962
table[conf.tbl] = columns
964963
kb.data.cachedColumns[conf.db] = table
@@ -981,6 +980,13 @@ def getColumns(self, onlyColNames=False):
981980
elif kb.dbms == DBMS.FIREBIRD:
982981
query = rootQuery.blind.count % (conf.tbl)
983982
query += condQuery
983+
elif kb.dbms == DBMS.SQLITE:
984+
query = rootQuery.blind.query % conf.tbl
985+
value = inject.getValue(query, inband=False)
986+
987+
parseSqliteTableSchema(value)
988+
989+
return kb.data.cachedColumns
984990

985991
count = inject.getValue(query, inband=False, expected=EXPECTED.INT, charsetType=2)
986992

xml/queries.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@
320320
</tables>
321321
<columns>
322322
<inband query="SELECT sql FROM sqlite_master WHERE tbl_name='%s'"/>
323+
<blind query="SELECT sql FROM sqlite_master WHERE tbl_name='%s'" condition=""/>
323324
</columns>
324325
<dump_table>
325326
<inband query="SELECT %s FROM %s"/>

0 commit comments

Comments
 (0)