cordkit

package module
v0.0.0-...-42f0641 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2025 License: MIT Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

CordKit

CordKit connects your C2 infrastructure with Discord, delivering real-time notifications, session management, and logging for effortless control from anywhere.

It includes dynamic slash command management that lets you easily extend the bot with your own custom commands.

Features

Custom Commands
  • Dynamic slash command registration with a built in management system.
  • Default Commands:
    • /start - Enable Bot
    • /stop - Disable Bot
    • /purge - Clean up dead session channels
    • /nuke - Complete server cleanup and stop the server process
Session Management
  • Organized session channels (active, dead)
  • Configurable naming conventions!
Logging
  • Automatic transcript archiving for logging your operations.
  • Info & Error Logging

Configuration

CordKit requires the following configuration parameters:

  • Discord Bot Token
  • The Guild ID of your Server
  • Category IDs (Active Connections, Dead Connections, Transcripts)
  • Channel Prefixes (Active, Dead)

TODO

  1. Integrate with Stellarlink ✅
  2. Make server setup script for a quick setup
  3. Integrate with larger projects:
    • Sliver
    • Evilginx
    • Ligolo
    • Tracescout

Usage

// Basic Setup
clientSettings := cordkit.NewClient(
    "BOT_TOKEN",              // Discord Bot Token
    "GUILD_ID",               // Discord Server ID
    "ACTIVE_CATEGORY_ID",     // ID of your active category
    "DEAD_CATEGORY_ID",       // ID of your dead category
    "TRANSCRIPT_CATEGORY_ID", // ID of your transcript category
    "active",                 // Prefix for active connections
    "dead",                   // Prefix for dead connections
)

// Start bot with client settings & logging enabled
bot := cordkit.NewBot(clientSettings, true)
bot.CustomCommands = true

// Add a custom command with options
bot.Commands = append(bot.Commands, cordkit.Command{
    Name:        "ping",
    Description: "Responds with pong",
    Options: []*dc.ApplicationCommandOption{
        {
            Type:        dc.ApplicationCommandOptionString,
            Name:        "message",
            Description: "Custom message to reply with",
            Required:    false,
        },
    },
    Action: func(b *cordkit.Bot, i *dc.InteractionCreate) {
        opts := i.ApplicationCommandData().Options
        if len(opts) > 0 {
            msg := opts[0].StringValue()
            b.SendMsg(i.ChannelID, msg)
        } else {
            b.SendMsg(i.ChannelID, "Pong!")
        }
    },
})

defer bot.Stop()
bot.Start()

// Session Management
conn := bot.HandleConnection("connection_name")
time.Sleep(time.Second * 1)
bot.KillConnection(conn)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	Client         *Client
	Running        bool
	Logging        bool
	LogChannelID   string
	CustomCommands bool
	Commands       []Command
	// contains filtered or unexported fields
}

func NewBot

func NewBot(configPath string) (*Bot, error)

func (*Bot) BotRespond

func (b *Bot) BotRespond(i *dc.InteractionCreate, msg string)

func (*Bot) CreateChannel

func (b *Bot) CreateChannel(name string) (*dc.Channel, error)

func (*Bot) DeleteChannel

func (b *Bot) DeleteChannel(channelID string) (*dc.Channel, error)

func (*Bot) HandleConnection

func (b *Bot) HandleConnection(id string) *Connection

func (*Bot) IsRunning

func (b *Bot) IsRunning() bool

func (*Bot) KillConnection

func (b *Bot) KillConnection(conn *Connection) *Connection

func (*Bot) MakeChannelActive

func (b *Bot) MakeChannelActive(channelID string) (*dc.Channel, error)

func (*Bot) MakeChannelDead

func (b *Bot) MakeChannelDead(channelID string) (*dc.Channel, error)

func (*Bot) SendErrorLog

func (b *Bot) SendErrorLog(content string) (*dc.Message, error)

func (*Bot) SendInfoLog

func (b *Bot) SendInfoLog(content string) (*dc.Message, error)

func (*Bot) SendMsg

func (b *Bot) SendMsg(channelID, content string) (*dc.Message, error)

func (*Bot) Start

func (b *Bot) Start()

func (*Bot) Stop

func (b *Bot) Stop() error

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(token string, guildID string, activeCategory string, deadCategory string, transcriptCategory string, activeChannelPrefix string, deadChannelPrefix string) *Client

type Command

type Command struct {
	Name        string
	Description string
	Options     []*dc.ApplicationCommandOption
	Action      func(*Bot, *dc.InteractionCreate)
}

type Config

type Config struct {
	BotToken              string `json:"bot_token"`
	GuildID               string `json:"guild_id"`
	ActiveCategoryID      string `json:"active_category_id"`
	DeadCategoryID        string `json:"dead_category_id"`
	TranscriptCategoryID  string `json:"transcript_category_id"`
	ActiveChannelPrefix   string `json:"active_channel_prefix"`
	DeadChannelPrefix     string `json:"dead_channel_prefix"`
	LoggingEnabled        bool   `json:"logging_enabled"`
	CustomCommandsEnabled bool   `json:"custom_commands_enabled"`
}

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL