SDK for developing NetKitX plugins
Project description
NetKitX SDK
Base classes and local testing utilities for NetKitX plugin development.
Install
pip install netkitx-sdk
With testing extras:
pip install "netkitx-sdk[testing]"
Quick Start
1. Write your plugin
# my_plugin/main.py
from netkitx_sdk import PluginBase, PluginEvent, PluginMeta
class Plugin(PluginBase):
meta = PluginMeta(
name="my-plugin",
version="1.0.0",
description="Does something useful",
category="recon",
)
async def execute(self, params):
target = params["target"]
yield PluginEvent("progress", {"percent": 0, "msg": f"Scanning {target}..."})
# ... your logic ...
yield PluginEvent("result", {"host": target, "alive": True})
yield PluginEvent("progress", {"percent": 100})
2. Write tests
# tests/test_my_plugin.py
import pytest
from netkitx_sdk.testing import run_plugin, collect_results, last_progress
from my_plugin.main import Plugin
@pytest.mark.asyncio
async def test_basic():
events = await run_plugin(Plugin(), {"target": "127.0.0.1"})
results = collect_results(events)
assert len(results) == 1
assert results[0]["host"] == "127.0.0.1"
assert last_progress(events) == 100
3. Run tests locally
pytest tests/ -v
4. Upload to NetKitX
zip my-plugin.zip plugin.yaml main.py
# Then upload via the Plugins page, or use netkitx-cli
API Reference
PluginBase
Abstract base class. Subclass it and implement execute().
| Method | Required | Description |
|---|---|---|
execute(params) |
✅ | Async generator, yield PluginEvent objects |
validate_params(params) |
❌ | Validate/transform params before execution |
cleanup() |
❌ | Release resources, called even on error |
PluginEvent
PluginEvent(type="progress", data={"percent": 50, "msg": "Half done"})
PluginEvent(type="result", data={"host": "10.0.0.1", "port": 80})
PluginEvent(type="log", data={"msg": "Connecting..."})
PluginEvent(type="error", data={"error": "Connection refused"})
PluginMeta
PluginMeta(
name="my-plugin", # unique identifier, matches plugin.yaml
version="1.0.0", # SemVer
description="...",
category="recon", # recon | vuln | exploit | utils
)
Testing helpers
from netkitx_sdk.testing import (
run_plugin, # run plugin, return list[PluginEvent]
collect_results, # filter type=="result" → list[dict]
collect_logs, # filter type=="log" → list[str]
last_progress, # last progress percent → int | None
has_error, # any error event? → bool
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
netkitx_sdk-0.1.0.tar.gz
(5.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netkitx_sdk-0.1.0.tar.gz.
File metadata
- Download URL: netkitx_sdk-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1712afbe2db7dddfa5903f741ca8f511d556797f7048e12a14278dde6e5f140e
|
|
| MD5 |
6b1a82768fa78f150ddd16445192ffe8
|
|
| BLAKE2b-256 |
3ea0366cc92e58c8f917bd4144c51ea792b19a90efe3e4cd537bd5f9eb8365d8
|
File details
Details for the file netkitx_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: netkitx_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2e4b087a87e9968a972ae248ffd85659a606b3bb797c7c856e1b3d498245d18
|
|
| MD5 |
b3383225e7c2722cc9226f555fc12281
|
|
| BLAKE2b-256 |
e7f7eed371036cebcc83e5c2e0581f950c9b86fff5b5ec2e8fae1c2e45697981
|