def check_all(printRes=False, ftype="all"): global results title = "File" files_arr = [] if ftype == "gw": files_arr = files_fwd if ftype == "mgmt": files_arr = files_fwm if ftype == "all": if func.isFirewall(): files_arr = files_arr + files_fwd if func.isManagement(): files_arr = files_arr + files_fwm i = 0 while i < len(files_arr): state = "PASS" detail = "" try: with open(files_arr[i][0], "rb") as f: bytes = f.read() fhash = hashlib.md5(bytes).hexdigest() if fhash != files_arr[i][1]: state = "WARN" detail = "Wrong Hash!" except: if files_arr[i][1] != "1": state = "FAIL" detail = "not found!" results.append([ title + " (" + files_arr[i][0] + ")", detail, state, "Filesystem" ]) i = i + 1 if printRes: logme.results(results) results = []
def print_results(): global results logme.results(results) results = []
def make_report_cli(): logme.results(make_check_all())