Detects (possible) absolute system paths inside the provided page content >>> _ = "/var/www/html/index.php"; parseFilePaths(" Error occurred at line 207 of: %s Please contact your administrator " % _); _ in kb.absFilePaths True
(page)
| 1955 | return data |
| 1956 | |
| 1957 | def parseFilePaths(page): |
| 1958 | """ |
| 1959 | Detects (possible) absolute system paths inside the provided page content |
| 1960 | |
| 1961 | >>> _ = "/var/www/html/index.php"; parseFilePaths("<html>Error occurred at line 207 of: %s<br>Please contact your administrator</html>" % _); _ in kb.absFilePaths |
| 1962 | True |
| 1963 | """ |
| 1964 | |
| 1965 | if page: |
| 1966 | for regex in FILE_PATH_REGEXES: |
| 1967 | for match in re.finditer(regex, page): |
| 1968 | absFilePath = match.group("result").strip() |
| 1969 | page = page.replace(absFilePath, "") |
| 1970 | |
| 1971 | if isWindowsDriveLetterPath(absFilePath): |
| 1972 | absFilePath = posixToNtSlashes(absFilePath) |
| 1973 | |
| 1974 | if absFilePath not in kb.absFilePaths: |
| 1975 | kb.absFilePaths.add(absFilePath) |
| 1976 | |
| 1977 | def getLocalIP(): |
| 1978 | """ |
no test coverage detected
searching dependent graphs…