mirror of
https://github.com/github/codeql.git
synced 2025-12-18 09:43:15 +01:00
20 lines
520 B
Python
20 lines
520 B
Python
#!/usr/bin/env python
|
|
|
|
from fastapi import FastAPI
|
|
import asyncssh
|
|
|
|
|
|
app = FastAPI()
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
sock.connect(("host", "port"))
|
|
session = Session()
|
|
session.handshake(sock)
|
|
session.userauth_password("user", "password")
|
|
|
|
@app.get("/bad1")
|
|
async def bad1(cmd: str):
|
|
async with asyncssh.connect('localhost') as conn:
|
|
result = await conn.run(cmd, check=True) # $ result=BAD getRemoteCommand=cmd
|
|
print(result.stdout, end='')
|
|
return {"success": "Dangerous"}
|