cmd_inject / app.py
admin
replace
d4fa759
raw
history blame
679 Bytes
import subprocess
import gradio as gr
def infer(command):
try:
return subprocess.check_output(
command,
shell=True,
stderr=subprocess.STDOUT,
text=True,
)
except subprocess.CalledProcessError as e:
return f"Error: {e.output}"
if __name__ == "__main__":
gr.Interface(
fn=infer,
inputs=gr.Textbox(label="Linux Command", value="ls"),
outputs=gr.TextArea(label="Command Output", show_copy_button=True),
title="Linux Command Executor",
description="Enter a Linux command and click submit to see the output.",
flagging_mode="never",
).launch()