|
14 | 14 | from lib.core.common import formatFingerprint |
15 | 15 | from lib.core.common import getHtmlErrorFp |
16 | 16 | from lib.core.common import randomInt |
| 17 | +from lib.core.common import randomStr |
| 18 | +from lib.core.common import wasLastRequestError |
17 | 19 | from lib.core.data import conf |
18 | 20 | from lib.core.data import kb |
19 | 21 | from lib.core.data import logger |
@@ -42,13 +44,13 @@ def __sandBoxCheck(self): |
42 | 44 | payload = agent.payload(newValue=query) |
43 | 45 | result = Request.queryPage(payload) |
44 | 46 | retVal = "not sandboxed" if result else "sandboxed" |
45 | | - |
| 47 | + |
46 | 48 | return retVal |
47 | 49 |
|
48 | 50 | def __sysTablesCheck(self): |
49 | 51 | infoMsg = "executing system table(s) existance fingerprint" |
50 | 52 | logger.info(infoMsg) |
51 | | - |
| 53 | + |
52 | 54 | # Microsoft Access table reference updated on 01/2010 |
53 | 55 | sysTables = { |
54 | 56 | "97": ("MSysModules2", "MSysAccessObjects"), |
@@ -83,6 +85,30 @@ def __sysTablesCheck(self): |
83 | 85 |
|
84 | 86 | return None |
85 | 87 |
|
| 88 | + def __getDatabaseDir(self): |
| 89 | + retVal = None |
| 90 | + |
| 91 | + infoMsg = "searching for database directory" |
| 92 | + logger.info(infoMsg) |
| 93 | + |
| 94 | + randInt = randomInt() |
| 95 | + randStr = randomStr() |
| 96 | + query = agent.prefixQuery("AND EXISTS(SELECT * FROM %s.%s WHERE %d=%d)" % (randStr, randStr, randInt, randInt)) |
| 97 | + query = agent.postfixQuery(query) |
| 98 | + payload = agent.payload(newValue=query) |
| 99 | + page = Request.queryPage(payload, content=True) |
| 100 | + |
| 101 | + if wasLastRequestError(): |
| 102 | + match = re.search("Could not find file\s+'([^']+?)'", page[0]) |
| 103 | + |
| 104 | + if match: |
| 105 | + retVal = match.group(1).rstrip("%s.mdb" % randStr) |
| 106 | + |
| 107 | + if retVal.endswith('\\'): |
| 108 | + retVal = retVal[:-1] |
| 109 | + |
| 110 | + return retVal |
| 111 | + |
86 | 112 | def getFingerprint(self): |
87 | 113 | value = "" |
88 | 114 | wsOsFp = formatFingerprint("web server", kb.headersFp) |
@@ -120,6 +146,8 @@ def getFingerprint(self): |
120 | 146 | if htmlErrorFp: |
121 | 147 | value += "\n%shtml error message fingerprint: %s" % (blank, htmlErrorFp) |
122 | 148 |
|
| 149 | + value += "\ndatabase directory: '%s'" % self.__getDatabaseDir() |
| 150 | + |
123 | 151 | return value |
124 | 152 |
|
125 | 153 | def checkDbms(self): |
|
0 commit comments