.. image:: https://img.shields.io/pypi/v/teatime.svg :target: https://pypi.python.org/pypi/teatime
.. image:: https://img.shields.io/travis/dmuhs/teatime.svg :target: https://travis-ci.com/dmuhs/teatime
.. image:: https://codecov.io/gh/dmuhs/teatime/branch/master/graph/badge.svg?token=RP0WZ6NXUP :target: https://codecov.io/gh/dmuhs/teatime
.. image:: https://readthedocs.org/projects/teatime/badge/?version=latest :target: https://teatime.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status
Teatime 是一个 RPC 攻击框架,旨在帮助您轻松发现区块链节点中的配置错误。它能检测大量问题,从信息泄露到开放账户,以及配置操纵。
目标是提供工具,用于扫描易受攻击的节点,并最大限度地降低因常见漏洞而遭受节点攻击的风险。Teatime 采用基于插件的架构,因此扩展库以添加自己的检查非常简单。
请注意,此库仍是一个概念验证(PoC),缺少文档。如果您希望看到某些插件,欢迎在 Twitter 上联系我!
Teatime 运行在 Python 3.6+ 上。
要开始使用,只需运行
.. code-block:: console
$ pip3 install teatime
或者,克隆仓库并运行
.. code-block:: console
$ pip3 install .
或者直接通过 Python 的 :code:setuptools:
.. code-block:: console
$ python3 setup.py install
要开始使用,只需实例化一个 :code:Scanner 类,并传入目标 IP、端口、节点类型以及一个实例化插件的列表。以下示例检查节点是否已同步并进行挖矿:
.. code-block:: python
from teatime.scanner import Scanner
from teatime.plugins.context import NodeType
from teatime.plugins.eth1 import NodeSync, MiningStatus
TARGET_IP = "127.0.0.1"
TARGET_PORT = 8545
INFURA_URL = "Infura API Endpoint"
def get_scanner():
return Scanner(
ip=TARGET_IP,
port=TARGET_PORT,
node_type=NodeType.GETH,
plugins=[
NodeSync(infura_url=INFURA_URL, block_threshold=10),
MiningStatus(should_mine=False)
]
)
if __name__ == '__main__':
scanner = get_scanner()
report = scanner.run()
print(report.to_dict())
更多小例子请查看 examples 目录!Teatime 完全带有类型注解,因此如果您不喜欢阅读文档,也可以随意在 IDE 中探索选项。:)
Teatime 的未来尚不确定,尽管我很希望能够添加超越 RPC 接口的更广泛检查,特别是针对以下技术:
如果您想为较小的、不太重要的链(如比特币或以太坊的仿制品)集成插件,欢迎 fork 项目并单独集成它们。