Spaces:
Sleeping
Sleeping
edit yara response
Browse files
app.py
CHANGED
|
@@ -372,17 +372,18 @@ async def analyse_yara(file_name: str):
|
|
| 372 |
app.state.yara_rules.match,
|
| 373 |
file_path
|
| 374 |
)
|
| 375 |
-
|
| 376 |
-
"
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
|
|
|
| 386 |
except Exception as e:
|
| 387 |
logger.error(f"YARA analysis failed: {str(e)}")
|
| 388 |
raise HTTPException(
|
|
|
|
| 372 |
app.state.yara_rules.match,
|
| 373 |
file_path
|
| 374 |
)
|
| 375 |
+
if matches:
|
| 376 |
+
return {"result": "Found",
|
| 377 |
+
"matches": [{
|
| 378 |
+
"rule": match.rule,
|
| 379 |
+
"namespace": match.namespace,
|
| 380 |
+
"tags": match.tags,
|
| 381 |
+
"meta": match.meta,
|
| 382 |
+
"strings": [s for s in match.strings]
|
| 383 |
+
} for match in matches]
|
| 384 |
+
}
|
| 385 |
+
else:
|
| 386 |
+
return {"result": "Does not match"}
|
| 387 |
except Exception as e:
|
| 388 |
logger.error(f"YARA analysis failed: {str(e)}")
|
| 389 |
raise HTTPException(
|