INNER CODE UNIT · Python

get_results

stanfrbd/cyberbro · app.py:403

def get_results(analysis_id: str) -> tuple[Response, int]:
    """Get the results of the analysis."""
    analysis_results = db.session.get(AnalysisResult, analysis_id)
    if analysis_results:
        return jsonify(analysis_results.results), 200
    return jsonify({"error": "Analysis not found."}), 404


@app.route(f"/{API_PREFIX}/analyze", methods=["POST"])
def analyze_api() -> tuple[Response, int]:
    """Handle the analyze request via API with caching and hashing."""
    data: dict = request.get_json()
    form_data: str = ioc_fanger.fang(data.get("text", ""))
    selected_engines: list[str] = data.get("engines", [])
    ignore_cache: bool = data.get("ignore_cache", False)

    # Generate a secure hash for form data and engines using SHA-256
    combined_data: str = f"{form_data}|{','.join(selected_engines)}"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…