CALDERA入门(2)(构建插件入门)

本文档介绍了如何创建并启用一个名为'test'的CALDERA插件,该插件包含一个GUI界面用于展示能力。首先,在caldera/plugins下创建test文件夹和hook.py文件,编写启用插件的代码,包括路由和获取能力的方法。接着,创建templates文件夹和test.html文件,用于显示表格形式的能力列表。最后,通过在local.yml中配置启用插件,并重启服务来完成设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CALDERA入门(2)(构建插件入门)

一、编写插件代码

1.在caldera/plugins文件夹中创建文件夹test
在这里插入图片描述
2.在test文件夹中创建hook.py文件,以下是hook.py此次用的代码

from aiohttp_jinja2 import template, web

from app.service.auth_svc import check_authorization

name = 'test'
description = 'A sample plugin for demonstration purposes'
address = '/plugin/abilities/gui'


async def enable(services):
    app = services.get('app_svc').application
    fetcher = AbilityFetcher(services)
    app.router.add_route('*', '/plugin/abilities/gui', fetcher.splash)
    app.router.add_route('GET', '/get/abilities', fetcher.get_abilities)


class AbilityFetcher:
    
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值