远程命令执行变得很容易。

thqm的Python项目详细描述


thqm takes its name from the arabic تحكم, pronounced tahakum, meaning control.

thqm使在主机上设置一个简单的远程控制接口变得非常容易。在

thqm是一个漂亮的小HTTP服务器,它从标准输入读取数据。它根据提供的stdin动态生成一个简单的按钮菜单,并将用户按下的任何按钮输出到stdout。 在某种意义上,它有点像HTTP服务器的^{}/^{}。在

这使得它非常灵活和脚本友好。查看examples文件夹中的一些脚本。在

安装

pip install thqm

或使用pyqrcode

^{pr2}$

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文件夹中添加自定义样式。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何从java中链接到数组的数组中删除值。jar文件?   性能记录屏幕Java磁盘速度   java Elastic APM Tomcat zip文件或JAR清单丢失   java无法在eclipse控制台上打印结果   java如何在Android中解析json对象?   java如何更改边缘根类型   java根据一些规则替换EditText中的字母   java项目反应器:是否有类似Nosideeffect finally的方法(不是sideeffect方法doFinally)   java连接Cassandra节点和spark   开源Java作业调度器:远程处理、负载平衡、故障切换、依赖DAG?   使用矢量汇编程序(Java)在Spark中设置输入和输出时出现问题   swing如何在Java中为文本字段创建右键单击菜单?   java查找最近的邻居/纬度和经度   java计算完成的数独板的行和列