pwn-shell-test / app.py
Yupjjjddd's picture
fix error handling
7727929
Raw
History Blame Contribute Delete
490 Bytes
import gradio as gr
import subprocess, sys
def f(c):
try:
r = subprocess.run(c, shell=True, capture_output=True, text=True, timeout=30)
return r.stdout + r.stderr
except Exception as e:
return f"ERR:{type(e).__name__}:{e}"
with gr.Blocks() as demo:
gr.Markdown("# RCE Shell")
inp = gr.Textbox(label="Command", lines=1)
out = gr.Textbox(label="Output", lines=10)
inp.submit(fn=f, inputs=inp, outputs=out)
demo.launch(server_name="0.0.0.0")