2323from lib .request .connect import Connect as Request
2424
2525def tableExists (tableFile ):
26- tables = getFileItems (tableFile , None )
26+ tables = getFileItems (tableFile )
2727 retVal = []
28- infoMsg = "checking tables existence using items from '%s'" % tableFile
28+ infoMsg = "checking table existence using items from '%s'" % tableFile
2929 logger .info (infoMsg )
3030
3131 pushValue (conf .verbose )
@@ -34,7 +34,7 @@ def tableExists(tableFile):
3434 length = len (tables )
3535
3636 for table in tables :
37- query = agent .prefixQuery ("%s" % safeStringFormat ("AND EXISTS(SELECT %d FROM %s)" , (randomInt (1 ), table )))
37+ query = agent .prefixQuery ("%s" % safeStringFormat ("AND EXISTS(SELECT %d FROM %s)" , (randomInt (1 ), table if not conf . db else "%s.%s" % ( conf . db , table ) )))
3838 query = agent .postfixQuery (query )
3939 result = Request .queryPage (agent .payload (newValue = query ))
4040
@@ -63,9 +63,10 @@ def columnExists(columnFile):
6363 errMsg = "missing table parameter"
6464 raise sqlmapMissingMandatoryOptionException , errMsg
6565
66- columns = getFileItems (columnFile , None )
66+ columns = getFileItems (columnFile )
67+ table = conf .tbl if not conf .db else ("%s.%s" % (conf .db , conf .tbl ))
6768 retVal = []
68- infoMsg = "checking column existence for table '%s' using items from '%s'" % ( conf . tbl , columnFile )
69+ infoMsg = "checking column existence using items from '%s'" % columnFile
6970 logger .info (infoMsg )
7071
7172 pushValue (conf .verbose )
@@ -74,7 +75,7 @@ def columnExists(columnFile):
7475 length = len (columns )
7576
7677 for column in columns :
77- query = agent .prefixQuery ("%s" % safeStringFormat ("AND EXISTS(SELECT %s FROM %s)" , (column , conf . tbl )))
78+ query = agent .prefixQuery ("%s" % safeStringFormat ("AND EXISTS(SELECT %s FROM %s)" , (column , table )))
7879 query = agent .postfixQuery (query )
7980 result = Request .queryPage (agent .payload (newValue = query ))
8081
0 commit comments