命令行客户机和库与黑盒子.eu网站
HTBClient的Python项目详细描述
HTB客户端
HTBClient
是一个python模块和与黑盒子.eu通过他们的restapi。
由于他们的API似乎并不完整,因此目前还缺少一些功能,比如挑战。
一旦它们有了REST端点,它们将被添加,但是我决定现在不通过像我一样抓取站点来实现它们
感觉太脆弱了,会添加大量的废弃代码。在
概述视频
View a demonstration video on YouTube
安装
安装有几个选项,下面我将介绍常见的选项。在
通过pip在PyPi中安装最新版本
python3 -m pip install htbclient
在github存储库中安装最新版本
^{pr2}$使用
HTBClient
可以用作独立脚本或导入到您自己的项目中。一个例子是我的htb-repo
这个项目是一个框架,我用它来组织所有的挑战和盒子黑盒子.eu. 本次回购
它的工作原理是有一个基本的文件夹布局来组织挑战和机器,然后使用HTBClient
连接到
网站restapi并为每个在站点上找到的机器创建一个文件夹,而不是在文件系统上
还创建一些元数据文件和脚本,以帮助跟踪和控制机器。了解更多关于
htb-repo
项目单击this link访问存储库。在
设置用户名/密码
如果您使用HTBClient
作为模块,则需要在
创建实例。当使用HTBClient
作为模块时,建议您获取用户名
以及来自环境变量或其他地方的密码,而不是硬编码在源代码中
这样,如果源代码是共享的,就不会意外地发布您的凭据。在
从终端运行htb
命令时,应该将凭据设置为环境变量
运行htb
命令,如下所示
示例
export HTB_USER=bob@somewebsite.net
export HTB_PASS=2jli9z9e2l34jlz98890@skx9!2a&
htb <arguments>
命令行工具
命令行工具htb
有以下选项
--assigned # Show your currently assigned machine --list all # Show all machines --list todo # Show machines in your todo list --list spawned # Show all machines that are currently running --list active # Show all machines that have not been retired --list retired # Show all machines that have been retired --list owned # Show all machines that you have gotten root and user on --list roots # Show all machines that you have gotten root on --list users # Show all machines that you have gotten user on --list incomplete # Show all machines that you have not yet owned --start <machine> # Start the specified machine --stop # Stop the machine assigned to you --reset <machine> # Restart the specified machine --todo <machine> # Toggle the specified machines todo status --username <user> # HTB Username (only needed if you don't use variables) --password <pass> # HTB Password (only needed if you don't use variables)
命令行工具作为htb
安装到系统路径中,因此您可以执行上面的命令,如中所示
下面的例子
列出所有机器
htb --list all
列出拥有的计算机
htb --list owned
启动盒子艾林森
htb --start ellingson
- 项目
标签: