velo return all artifacts (#97)
taylor_socfortress committed
Sep 15, 2023 at 06:58 UTC
e3be5ee4399cfc869ad622ec7f3b1e533b45e988
2 files changed
+37
-1
backend/app/routes/velociraptor.py
+14
-1
@@ -39,6 +39,19 @@ def get_client_info(client_name: str) -> Tuple[Union[str, None], Union[str, None
39
return client_info["client_id"], client_info["os_info"]["system"], None
40
41
42
+@bp.route("/velociraptor/artifacts", methods=["GET"])
43
+def get_all_artifacts() -> Response:
44
+ """
45
+ Fetch all artifacts.
46
+
47
+ Returns:
48
+ Response: A Flask JSON response containing the artifacts.
49
+ """
50
+ service = ArtifactsService()
51
+ artifacts = service.collect_artifacts()
52
+ return artifacts
53
+
54
+
55
@bp.route("/velociraptor/artifacts/os/<filter_os>", methods=["GET"])
56
def get_artifacts(filter_os: str = None) -> Response:
57
"""
@@ -54,7 +67,7 @@ def get_artifacts(filter_os: str = None) -> Response:
67
if filter_os:
68
artifacts = service.collect_artifacts_filtered(filter_os)
69
else:
57
- artifacts = service.collect_artifacts()
70
+ return jsonify({"message": "OS filter is required.", "success": False}), 500
71
return artifacts
72
73
backend/app/static/swagger.json
+23
@@ -3812,6 +3812,29 @@
3812
"tags": ["Shuffle"]
3813
}
3814
},
3815
+ "/velociraptor/artifacts": {
3816
+ "get": {
3817
+ "summary": "Get all artifacts",
3818
+ "description": "Endpoint to get all artifacts.",
3819
+ "responses": {
3820
+ "200": {
3821
+ "description": "Successful operation",
3822
+ "content": {
3823
+ "application/json": {
3824
+ "schema": {
3825
+ "$ref": "#/components/schemas/Artifacts"
3826
+ }
3827
+ }
3828
+ }
3829
+ },
3830
+ "default": {
3831
+ "description": "Unexpected error"
3832
+ }
3833
+ },
3834
+ "operationId": "getAllArtifacts",
3835
+ "tags": ["Velociraptor"]
3836
+ }
3837
+ },
3838
"/velociraptor/artifacts/os/{filter_os}": {
3839
"get": {
3840
"summary": "Get artifacts filtered by OS",