Converted the Python API to POST so it is easier to use with arrays.

pull/2094/head
Herr Turing 2 months ago
parent 29f8c0401e
commit 55ad58bfd3

@ -1,23 +1,36 @@
import subprocess
import sys
from typing import Annotated
from pydantic import BaseModel
from fastapi import FastAPI, Query
from fastapi.responses import StreamingResponse
app = FastAPI()
@app.get("/")
async def root(
usernames: Annotated[list[str] | None, Query()] = None,
f: Annotated[list[str] | None, Query()] = None,
):
class Body(BaseModel):
usernames: list[str]
sites: list[str]
f: list[str]
@app.post("/")
async def root(body: Body):
command = ["python3", "/opt/sherlock/sherlock/sherlock.py"]
usernames = body.usernames
sites = body.sites
f = body.f
if usernames:
for name in usernames:
command.append(name)
if sites:
for site in sites:
command.append("--site")
command.append(site)
if f:
for flag in f:
command.append("--"+flag)

Loading…
Cancel
Save