From 38c261bc9f19de06a4f50397bb90f8206d4d93e8 Mon Sep 17 00:00:00 2001 From: 622ff545dfef6c4fdb84ccec <622ff545dfef6c4fdb84ccec@devide> Date: Mon, 8 May 2023 09:15:57 +0000 Subject: [PATCH] Auto commit --- stui.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/stui.py b/stui.py index 513d7e3..12b7d66 100644 --- a/stui.py +++ b/stui.py @@ -10,10 +10,13 @@ user_input = st.text_input('输入域名http://') # 判断用户是否有输入,并输出一句问候语 if user_input != '': st.write('正在解析:,', user_input, '......') - # 定义dig命令 - # result = subprocess.run(["python", "dig.py"],capture_output=True) - # 假设你要查询的域名是example.com - # domain = "example.com" + # 检测dig是否安装 + try: + subprocess.check_output(["dig", "-v"]) + except subprocess.CalledProcessError: + # 如果未安装,则安装dig + subprocess.call(["sudo", "apt-get", "update"]) + subprocess.call(["sudo", "apt-get", "install", "-y", "dnsutils"]) # 使用subprocess运行dig命令并获取输出 result = subprocess.run(["dig", "+noall", "+answer", user_input ], capture_output=True) @@ -25,4 +28,4 @@ if user_input != '': # 将表格输出到streamlit界面 st.table(table) else: - st.write('Please enter your name.') + st.write('这是一个dig的UI界面,Stremlit太强到了') -- GitLab