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

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筛选hibernate中引用的属性   java如何在Bluej中创建以long(integer)为参数的对象   java如何通过JDBC在access中创建新字段   java如何获取格式化日期?   用模板方法模式设计过滤器接口   java编译错误:缺少返回语句   java从JOOQ中的代码生成中排除特定的模式   java小程序生命周期:init()和start()与destroy()和stop()之间的实际区别是什么?   如何在Java中获取类的所有公共静态方法?   匿名onClick方法内的java活动结果   java如何从数千个具有良好性能的寄存器构建excel工作表?   标记Java中多级中断的适当使用   网络化基于Java的Telnet代理服务器,支持TLS。但为什么是java。网SocketException:连接被拒绝   java将magnolia升级到5.6.1,vaadin资源   springcloudnetflixhystrix中的java重写HystrixCommandSpect bean