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