Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -120,26 +120,23 @@ def compile_yara_rules(repo_path: Path) -> Optional[yara.Rules]:
|
|
| 120 |
yara_files = list(repo_path.glob("**/*.yara"))
|
| 121 |
|
| 122 |
if not yara_files:
|
| 123 |
-
logger.warning("No
|
| 124 |
return None
|
| 125 |
|
| 126 |
-
logger.info(f"
|
| 127 |
rules = {}
|
| 128 |
|
| 129 |
for yara_file in yara_files:
|
| 130 |
try:
|
| 131 |
-
|
| 132 |
-
namespace = str(yara_file.relative_to(processed_dir)).replace('/', '_')
|
| 133 |
-
rules[namespace] = str(yara_file)
|
| 134 |
except Exception as e:
|
| 135 |
-
logger.warning(f"Error
|
| 136 |
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
return None
|
| 143 |
|
| 144 |
except Exception as e:
|
| 145 |
logger.error(f"Error compiling YARA rules: {str(e)}")
|
|
|
|
| 120 |
yara_files = list(repo_path.glob("**/*.yara"))
|
| 121 |
|
| 122 |
if not yara_files:
|
| 123 |
+
logger.warning("No YARA files found in repository")
|
| 124 |
return None
|
| 125 |
|
| 126 |
+
logger.info(f"Found {len(yara_files)} YARA files, compiling rules")
|
| 127 |
rules = {}
|
| 128 |
|
| 129 |
for yara_file in yara_files:
|
| 130 |
try:
|
| 131 |
+
rules[str(yara_file)] = str(yara_file)
|
|
|
|
|
|
|
| 132 |
except Exception as e:
|
| 133 |
+
logger.warning(f"Error processing {yara_file}: {str(e)}")
|
| 134 |
|
| 135 |
+
return yara.compile(filepaths=rules)
|
| 136 |
+
|
| 137 |
+
except yara.SyntaxError as e:
|
| 138 |
+
logger.error(f"YARA syntax error: {str(e)}")
|
| 139 |
+
return None
|
|
|
|
| 140 |
|
| 141 |
except Exception as e:
|
| 142 |
logger.error(f"Error compiling YARA rules: {str(e)}")
|