Skip to main content
  1. Documentation/
  2. Reference/

Client Library

Table of Contents
The TantoC2 client library provides typed methods for all API endpoints.

Installation
#

1
pip install tantoc2-cli  # includes the client library

Basic Usage
#

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
from tantoc2.client import TantoC2Client

client = TantoC2Client("http://localhost:8443")
client.login("admin", "<password>")

# List engagements
engagements = client.engagements.list()

# Activate an engagement
client.engagements.activate(engagements[0]["id"])

# List agents
agents = client.agents.list()

# Create a task
task = client.agents.create_task(agents[0]["id"], "survey")

# Get results
result = client.agents.get_task_result(agents[0]["id"], task["id"])

Building Agents
#

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
build = client.builds.create(
    package_name="dev_agent",
    template_name="dev_beacon",
    callbacks=[{"host": "10.0.0.1", "port": 8080, "protocol": "https"}],
    kill_date="2026-04-15",
)

# Download the binary
binary = client.builds.download(build["id"])
with open("agent.bin", "wb") as f:
    f.write(binary)

WebSocket Events
#

1
2
3
4
client.on_event("agent_registered",
    lambda data: print(f"New agent: {data['agent_id']}"))
client.on_event("task_result_received",
    lambda data: print(f"Result: {data['task_id']}"))

API Namespaces
#

The client organizes methods by resource:

NamespaceMethods
client.engagementslist(), create(), activate(), deactivate(), archive(), import_archive()
client.agentslist(), get(), create_task(), list_tasks(), get_task_result(), kill()
client.agent_moduleslist(), get(), get_compatible(), refresh()
client.moduleslist(), get(), execute(), refresh()
client.credentialslist(), get(), create(), update(), delete(), export()
client.listenerslist(), get(), create(), start(), stop(), delete()
client.buildslist_packages(), list_templates(), get_schema(), create(), list(), get(), download()
client.agentlesslist_modules(), get_module(), execute(), refresh(), list_executions(), get_execution(), list_proxies(), create_proxy(), get_proxy(), update_proxy(), delete_proxy(), create_session(), list_sessions(), delete_session(), get_session_output(), send_session_input()
client.file_transfersupload(), download(), list_transfers(), get_transfer(), download_content()
client.collection_requestscreate(), list(), get(), approve(), deny(), pending_count()
client.operatorslist(), get(), create(), update(), delete(), grant_access(), revoke_access()