目录
安装
pip install cool-login-banner
描述
Cool Login Banner 设置主机登陆界面最快只需要2步:
创建 BannerSetter 对象。
调用不同的方法设置对应的登陆banner。
from cool_login_banner import BannerSetter, CowsayEngine
bs = BannerSetter(CowsayEngine, host='192.168.44.131', user='username', port=22, password='password')
bs.set_ssh_banner(text="A python enthusiast's site", pattern='cow', fore_color='lightyellow_ex', styles=['blink'])
登录主机,登录页面就变成这样了:
恢复也很容易:
bs.clear_ssh_banner()
基于 colorama, pyfiglet 和 cowsay, 一共有三种不同风格的banner引擎:
基本用法
远程或本地
BannerSetter 类会根据是否传递 host 参数来判断是远程连接还是本地执行。
如果是远程登陆,所有关键字参数都会送给 fabric.Connection, 除了 password 参数。因为 Connection 如果需要设置登陆密码,需要在 connect_kwargs 这个关键字参数里面设置,我觉得很不方便,进行了合并。
本机执行程序的话,除了 engine, 就不用传递额外参数了。不过不管是远程还是本机,账号需要有sudo的权限,如果sudo 需要密码,则需要提供 password 参数。
说明
Cool Login Banner 只是简单的进行了组合。感谢超级cool的 pyfiglet, cowsay-python, colorama 。
Metadata
Release files for cool-login-banner 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cool_login_banner-0.1.2.tar.gz | 6.3 kB | Without provenance | Details for cool_login_banner-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cool_login_banner-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for cool_login_banner-0.1.2-py3-none-any.whl |
Total release size: 13.2 kB
Security for cool-login-banner 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.