Spaces:
Configuration error
Configuration error
Update blackgat/app/main.py
Browse files- blackgat/app/main.py +49 -21
blackgat/app/main.py
CHANGED
|
@@ -1,29 +1,57 @@
|
|
| 1 |
-
|
| 2 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
app = FastAPI(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
data = await request.json()
|
| 14 |
-
return scribe_generate(data)
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@app.post("/recon")
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
return recon_gpt(data["prompt"])
|
| 25 |
|
| 26 |
@app.post("/exploit")
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
return exploit_suggestion(data)
|
|
|
|
| 1 |
+
# main.py
|
| 2 |
+
from fastapi import FastAPI
|
| 3 |
+
from pydantic import BaseModel
|
| 4 |
+
from typing import Dict
|
| 5 |
+
from ai_models import (
|
| 6 |
+
scribe_generate, killchain_ai,
|
| 7 |
+
heatseeker_score, recon_gpt,
|
| 8 |
+
exploit_suggestion
|
| 9 |
+
)
|
| 10 |
|
| 11 |
+
app = FastAPI(
|
| 12 |
+
title="BlackGat AI",
|
| 13 |
+
description="Cloud-based AI for bug bounty automation",
|
| 14 |
+
version="1.0.0"
|
| 15 |
+
)
|
| 16 |
|
| 17 |
+
# Models
|
| 18 |
+
class VulnReport(BaseModel):
|
| 19 |
+
type: str
|
| 20 |
+
url: str
|
| 21 |
+
payload: str
|
| 22 |
+
impact: str
|
| 23 |
+
|
| 24 |
+
class Finding(BaseModel):
|
| 25 |
+
data: str
|
| 26 |
+
|
| 27 |
+
class ExploitRequest(BaseModel):
|
| 28 |
+
data: str
|
| 29 |
+
|
| 30 |
+
class HeatInput(BaseModel):
|
| 31 |
+
url: str
|
| 32 |
+
params: Dict[str, str]
|
| 33 |
+
status_code: int
|
| 34 |
|
| 35 |
+
class ReconPrompt(BaseModel):
|
| 36 |
+
prompt: str
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
# API Routes
|
| 39 |
+
@app.post("/scribe")
|
| 40 |
+
def scribe(data: VulnReport):
|
| 41 |
+
return scribe_generate(data.dict())
|
| 42 |
+
|
| 43 |
+
@app.post("/killchain")
|
| 44 |
+
def killchain(data: Finding):
|
| 45 |
+
return killchain_ai(data.data)
|
| 46 |
+
|
| 47 |
+
@app.post("/score")
|
| 48 |
+
def score(data: HeatInput):
|
| 49 |
+
return heatseeker_score(data.dict())
|
| 50 |
|
| 51 |
@app.post("/recon")
|
| 52 |
+
def recon(data: ReconPrompt):
|
| 53 |
+
return recon_gpt(data.prompt)
|
|
|
|
| 54 |
|
| 55 |
@app.post("/exploit")
|
| 56 |
+
def exploit(data: ExploitRequest):
|
| 57 |
+
return exploit_suggestion(data.data)
|
|
|