Update apache module

This commit is contained in:
geoffrey 2023-09-18 20:59:49 +02:00
parent 274b361a63
commit c290ec6e18

@ -222,16 +222,8 @@ class Apache:
for d in directories: for d in directories:
for entry in d: for entry in d:
# We get the directory path # We get the directory path
grDirectory = re.search( path = self._getDirectoryPath(entry)
f"<Directory", report["directories"][path] = dict()
entry,
re.IGNORECASE
)
if grDirectory:
path = entry.replace("<Directory", "")
path = path.replace(">", "")
path = path.replace("\"", "")
report["directories"][path] = dict()
# Try to find the Option flag # Try to find the Option flag
grFlag = re.search( grFlag = re.search(
@ -248,7 +240,6 @@ class Apache:
) )
if grOption: if grOption:
optsFound.append(opt) optsFound.append(opt)
#print(d[0])
report["audit"] = True report["audit"] = True
report["options"] = dict() report["options"] = dict()
@ -266,6 +257,22 @@ class Apache:
print(report) print(report)
return report return report
def _getDirectoryPath(self, line) -> str:
"""
This function return the directory path
"""
path = None
grDirectory = re.search(
f"<Directory",
line,
re.IGNORECASE
)
if grDirectory:
path = line.replace("<Directory", "")
path = path.replace(">", "")
path = path.replace("\"", "")
return path
def _constructReports(self): def _constructReports(self):
""" """
Construct dictionary for result of the tests Construct dictionary for result of the tests