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

Function readCachedFileContent

lib/core/common.py:2468–2488  ·  view source on GitHub ↗

Cached reading of file content (avoiding multiple same file reading) >>> "readCachedFileContent" in readCachedFileContent(__file__) True

(filename, mode="rb")

Source from the content-addressed store, hash-verified

2466 return retVal
2467
2468def readCachedFileContent(filename, mode="rb"):
2469 """
2470 Cached reading of file content (avoiding multiple same file reading)
2471
2472 >>> "readCachedFileContent" in readCachedFileContent(__file__)
2473 True
2474 """
2475
2476 if filename not in kb.cache.content:
2477 with kb.locks.cache:
2478 if filename not in kb.cache.content:
2479 checkFile(filename)
2480 try:
2481 with openFile(filename, mode) as f:
2482 kb.cache.content[filename] = f.read()
2483 except (IOError, OSError, MemoryError) as ex:
2484 errMsg = "something went wrong while trying "
2485 errMsg += "to read the content of file '%s' ('%s')" % (filename, getSafeExString(ex))
2486 raise SqlmapSystemException(errMsg)
2487
2488 return kb.cache.content[filename]
2489
2490def average(values):
2491 """

Callers 7

_setSafeVisitFunction · 0.90
_setProxyListFunction · 0.90
parseXmlFileFunction · 0.85
getSQLSnippetFunction · 0.85
openFileFunction · 0.85
resetCookieJarFunction · 0.85
parseRequestFileFunction · 0.85

Calls 5

checkFileFunction · 0.85
openFileFunction · 0.85
getSafeExStringFunction · 0.70
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…