ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙimport re from logger_config import get_logger def get_csf_config_value( var_name: str, config_file="/etc/csf/csf.conf" ) -> str | None: logger = get_logger() try: with open(config_file, "r") as f: for line in f: # Strip whitespace and skip empty lines and comments line = line.strip() if not line or line.startswith("#"): continue # Match pattern: VAR_NAME = "value" (with flexible whitespace) # This regex handles: # - Optional whitespace around = (e.g. VAR_NAME="value" or VAR_NAME= "value") # - Quoted values (double quotes, single quotes are not valid in CSF config) # - Captures the value inside quotes (e.g. "value") pattern = rf'^{re.escape(var_name)}\s*=\s*["]([^"]*)["]' match = re.match(pattern, line) if match: return match.group(1) # Variable not found return None except FileNotFoundError: logger.error(f"Config file {config_file} not found") return None except PermissionError: logger.error(f"Permission denied reading {config_file}") return None except Exception as e: logger.error(f"Error reading config file: {e}") return None