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

Function checkFile

lib/core/common.py:1361–1393  ·  view source on GitHub ↗

Checks for file existence and readability >>> checkFile(__file__) True

(filename, raiseOnError=True)

Source from the content-addressed store, hash-verified

1359 return re.search(r"\A[0-9]+\Z", value or "") is not None
1360
1361def checkFile(filename, raiseOnError=True):
1362 """
1363 Checks for file existence and readability
1364
1365 >>> checkFile(__file__)
1366 True
1367 """
1368
1369 valid = True
1370
1371 if filename:
1372 filename = filename.strip('"\'')
1373
1374 if filename == STDIN_PIPE_DASH:
1375 return checkPipedInput()
1376 else:
1377 try:
1378 if filename is None or not os.path.isfile(filename):
1379 valid = False
1380 except:
1381 valid = False
1382
1383 if valid:
1384 try:
1385 with open(filename, "rb"):
1386 pass
1387 except:
1388 valid = False
1389
1390 if not valid and raiseOnError:
1391 raise SqlmapSystemException("unable to read file '%s'" % filename)
1392
1393 return valid
1394
1395def banner():
1396 """

Callers 15

dictionaryAttackFunction · 0.90
getPageMethod · 0.90
dbTableValuesMethod · 0.90
_setMultipleTargetsFunction · 0.90
_setRequestFromFileFunction · 0.90
_setBulkMultipleTargetsFunction · 0.90
_setSafeVisitFunction · 0.90
_setHTTPAuthenticationFunction · 0.90
_setHTTPExtraHeadersFunction · 0.90
configFileParserFunction · 0.90
udfInjectCoreMethod · 0.90
fileEncodeMethod · 0.90

Calls 2

checkPipedInputFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…