Files
fuzzforge_ai/sdk/examples/save_findings_demo.py
tduhamel42 09951d68d7 fix: resolve live monitoring bug, remove deprecated parameters, and auto-start Python worker
- Fix live monitoring style error by calling _live_monitor() helper directly
- Remove default_parameters duplication from 10 workflow metadata files
- Remove deprecated volume_mode parameter from 26 files across CLI, SDK, backend, and docs
- Configure Python worker to start automatically with docker compose up
- Clean up constants, validation, completion, and example files

Fixes #
- Live monitoring now works correctly with --live flag
- Workflow metadata follows JSON Schema standard
- Cleaner codebase without deprecated volume_mode
- Python worker (most commonly used) starts by default
2025-10-22 16:26:58 +02:00

69 lines
2.2 KiB
Python

#!/usr/bin/env python3
# Copyright (c) 2025 FuzzingLabs
#
# Licensed under the Business Source License 1.1 (BSL). See the LICENSE file
# at the root of this repository for details.
#
# After the Change Date (four years from publication), this version of the
# Licensed Work will be made available under the Apache License, Version 2.0.
# See the LICENSE-APACHE file or http://www.apache.org/licenses/LICENSE-2.0
#
# Additional attribution and requirements are provided in the NOTICE file.
"""
Quick demo to save findings to a SARIF file.
"""
from pathlib import Path
from fuzzforge_sdk import FuzzForgeClient
from fuzzforge_sdk.utils import create_workflow_submission, save_sarif_to_file, format_sarif_summary
def main():
"""Save findings demo."""
client = FuzzForgeClient(base_url="http://localhost:8000")
try:
# List workflows
workflows = client.list_workflows()
if not workflows:
print("❌ No workflows available")
return
# Submit workflow
workflow_name = workflows[0].name
submission = create_workflow_submission(
target_path=Path.cwd().absolute(),
timeout=300
)
print(f"🚀 Submitting {workflow_name}...")
response = client.submit_workflow(workflow_name, submission)
# Wait for completion
print("⏱️ Waiting for completion...")
final_status = client.wait_for_completion(response.run_id)
if final_status.is_completed:
# Get findings
findings = client.get_run_findings(response.run_id)
summary = format_sarif_summary(findings.sarif)
print(f"📈 {summary}")
# Save to file
output_file = Path("fuzzforge_findings.sarif.json")
save_sarif_to_file(findings.sarif, output_file)
print(f"💾 Findings saved to: {output_file.absolute()}")
# Show file info
print(f"📄 File size: {output_file.stat().st_size:,} bytes")
else:
print(f"❌ Workflow failed: {final_status.status}")
except Exception as e:
print(f"❌ Error: {e}")
finally:
client.close()
if __name__ == "__main__":
main()