add jsonpickle and pexpect libs in case of unsafe decoding and secondary command execution, add proper test cases

This commit is contained in:
amammad
2024-02-25 17:15:35 +04:00
committed by Taus
parent 7e93102097
commit 0a765cc94a
13 changed files with 169 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env python
from fastapi import FastAPI
from pexpect import pxssh
ssh = pxssh.pxssh()
hostname = "localhost"
username = "username"
password = "password"
ssh.login(hostname, username, password)
app = FastAPI()
@app.get("/bad1")
async def bad1(cmd: str):
ssh.send(cmd) # $ result=BAD getSecondaryCommand=cmd
ssh.prompt()
ssh.sendline(cmd) # $ result=BAD getSecondaryCommand=cmd
ssh.prompt()
ssh.logout()
return {"success": stdout}