Move files
This commit is contained in:
parent
582b85bb07
commit
a2ff9f1fb9
@ -1 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
@ -1,71 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import re
|
|
||||||
from json import dumps
|
|
||||||
from parsing.base import ParsingBase
|
|
||||||
|
|
||||||
|
|
||||||
class Parsing(ParsingBase):
|
|
||||||
def __init__(self, objects, arguments):
|
|
||||||
self._parsing = dict()
|
|
||||||
self._reports = dict()
|
|
||||||
self._objects = objects
|
|
||||||
self._postfix_file = arguments["postfix_file"]
|
|
||||||
|
|
||||||
def runParsing(self):
|
|
||||||
# Generate report
|
|
||||||
self._constructReports()
|
|
||||||
|
|
||||||
# Check if the file exist
|
|
||||||
try:
|
|
||||||
with open(self._postfix_file, 'rb') as fdata:
|
|
||||||
self._parseFile(fdata)
|
|
||||||
except FileNotFoundError:
|
|
||||||
print("No postfix file found. Add into the report")
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _parseFile(self, fdata):
|
|
||||||
data = fdata.read()
|
|
||||||
lines = data.splitlines()
|
|
||||||
|
|
||||||
obj = self._objects['regexp'].split("=")
|
|
||||||
directive = obj[0].strip()
|
|
||||||
value = obj[1].strip()
|
|
||||||
print(self._objects)
|
|
||||||
|
|
||||||
for line in lines:
|
|
||||||
line = line.decode('utf-8')
|
|
||||||
grDirective = re.search(directive, line)
|
|
||||||
if grDirective:
|
|
||||||
grValue = re.search(value, line)
|
|
||||||
if grValue:
|
|
||||||
print(line)
|
|
||||||
|
|
||||||
def _generateReport(self, objects):
|
|
||||||
# We can generate the report
|
|
||||||
for postfix in self._reports['postfix']:
|
|
||||||
self._reports['postfix'][postfix] = objects[postfix]
|
|
||||||
|
|
||||||
def _parsingFile(self, line, obj, vulnerabilityFound) -> bool:
|
|
||||||
"""
|
|
||||||
This function parse the line and try to find the item in it
|
|
||||||
"""
|
|
||||||
result = bool()
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def _constructReports(self):
|
|
||||||
"""
|
|
||||||
Construct dictionary for result of the tests
|
|
||||||
Each entry contains:
|
|
||||||
Key:
|
|
||||||
- filename: filename of the test
|
|
||||||
- line: line of the test
|
|
||||||
- parse: Display the line where the vulnerabilites has been found
|
|
||||||
- description: description of the vulnerability
|
|
||||||
- level: high, medium or low
|
|
||||||
"""
|
|
||||||
self._reports['postfix'] = dict()
|
|
||||||
|
|
||||||
def getResults(self) -> dict:
|
|
||||||
return self._reports
|
|
@ -3,7 +3,7 @@
|
|||||||
import re
|
import re
|
||||||
from os import listdir
|
from os import listdir
|
||||||
from os.path import isdir
|
from os.path import isdir
|
||||||
from audit.system.plugins.apache.apache import apache
|
from audit.system.plugins.apache import apache
|
||||||
|
|
||||||
|
|
||||||
class Apache:
|
class Apache:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from audit.system.plugins.postfix.postfix import postfix
|
from audit.system.plugins.postfix import postfix
|
||||||
|
|
||||||
|
|
||||||
class Postfix:
|
class Postfix:
|
||||||
|
Loading…
Reference in New Issue
Block a user