远程命令执行变得很容易。
thqm的Python项目详细描述
thqm
takes its name from the arabic تحكم, pronounced tahakum, meaning control.
thqm
使在主机上设置一个简单的远程控制接口变得非常容易。在
thqm
是一个漂亮的小HTTP服务器,它从标准输入读取数据。它根据提供的stdin
动态生成一个简单的按钮菜单,并将用户按下的任何按钮输出到stdout
。
在某种意义上,它有点像HTTP服务器的^{
这使得它非常灵活和脚本友好。查看examples文件夹中的一些脚本。在
在
在
安装
pip install thqm
或使用pyqrcode
thqm
应该可以在linux、MacOS和Windows上运行。在
使用虚拟环境通常是个好主意,或者考虑使用pipx。在
依赖关系
thqm
需要以下命令才能运行:
python3
jinja
可选:
pyqrcode
生成qrcode。在
配置
thqm
将创建一个配置文件夹:
- Linux:
$XDG_CONFIG_HOME/thqm
(或者$HOME/.config/thqm
,如果$XDG_CONFIG_HOME
未设置) - 苹果操作系统:
~/Library/Application Support/thqm
- 窗口:
%LOCALAPPDATA%/thqm
(或~/thqm
)
此文件夹保存thqm
的自定义样式。将创建一个裸体示例pure_html
。在
要添加您自己的自定义样式,请遵循所提供示例的文件夹结构。也许可以看看^{
注意:服务器的基本文件夹将是样式的文件夹。因此,要从您的index.html
访问static
文件夹中的文件:
<linkrel="stylesheet"type="text/css"href="static/index.css">
使用
查看examples文件夹中的一些用法示例。在
$ thqm --help
usage: thqm [-h] [-p PORT] [-q] [-pw PASSWORD] [-u USERNAME] [-s SEPERATOR] [-o] [-t TITLE]
[--no-shutdown] [--no-qrcode] [--style {default,pure_html}]
Remote command execution made easy.
Custom styles should be added to /home/lcoyle/.config/thqm
optional arguments:
-h, --help show this help message and exit
-p PORT, --port PORT Port number. (default: 8901)
-u USERNAME, --username USERNAME
Authentication username, only used if a PASSWORD is provided. (default: 'thqm')
-pw PASSWORD, --password PASSWORD
Authentication password. (default: None)
-s SEPERATOR, --seperator SEPERATOR
Entry seperator pattern. (default: '\n')
-t TITLE, --title TITLE
Page title. (default: 'thqm')
--style {default,pure_html}
Page style. (default: 'default')
--extra-template-args JSON
Extra template arguments, json string. (default: '{}')
-q, --show-qrcode Show the qrcode in terminal, requires "pyqrcode". (default: False)
-l, --show-url Show the page url. (default: False)
-o, --oneshot Shutdown server after first click. (default: False)
--no-shutdown Remove server shutdown button. (default: False)
--no-qrcode Remove qrcode button. (default: False)
--version Show version and exit. (default: False)
使用-u
和-pw
参数设置用户名和密码以限制访问。身份验证是用HTTP basic authentication处理的。在
使用-s
参数,您可以定义分割stdin
的模式。在
第一次按下按钮后,-o
标志将停止服务器。在
-q
(需要pyqrcode
)标志将在终端中打印一个二维码,该二维码包含凭证,因此它将绕过任何身份验证,浏览器内二维码也是如此。这使得与他人共享访问权限变得特别容易。在
使用-t
更改页面标题。在
--no-shutdown
删除关闭服务器按钮。在
--no-qrcode
删除qrcode按钮。在
使用--style
参数选择页面样式。您可以在thqm
的config文件夹中添加自定义样式。在
- 项目
标签: