irc

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DataDecoder = &decoder.StreamDecoder{
	Type:        types.Type_NC_IRC,
	Name:        "IRC-DCC",
	Description: "IRC DCC file transfer data channel",
	PostInit: func(sd *decoder.StreamDecoder) error {
		return nil
	},
	CanDecode: func(client, server []byte) bool {

		return false
	},
	DeInit: func(sd *decoder.StreamDecoder) error {
		return nil
	},
	Factory: &ircDCCDataReader{},
	Typ:     core.TCP,
}

DataDecoder for IRC DCC data channel analysis

View Source
var Decoder = &decoder.StreamDecoder{
	Type:        types.Type_NC_IRC,
	Name:        "IRC",
	Description: "Internet Relay Chat protocol",
	PostInit: func(sd *decoder.StreamDecoder) error {
		var err error
		ircLog, _, err = logging.InitZapLogger(
			decoderconfig.Instance.Out,
			"irc",
			decoderconfig.Instance.Debug,
		)
		if err != nil {
			return err
		}

		initIRCConnectionTracker()
		return nil
	},
	CanDecode: func(client, server []byte) bool {

		if bytes.Contains(server, []byte(":")) && bytes.Contains(client, []byte("NICK")) {
			return true
		}

		if bytes.Contains(server, []byte("001")) || bytes.Contains(server, []byte("NOTICE")) {
			return true
		}
		return false
	},
	DeInit: func(sd *decoder.StreamDecoder) error {
		return ircLog.Sync()
	},
	Factory: &ircReader{},
	Typ:     core.TCP,
}

Decoder for IRC protocol analysis

Functions

func CleanupExpiredDCCConnections

func CleanupExpiredDCCConnections()

CleanupExpiredDCCConnections removes stale DCC connection expectations

func ExtractDCCDataChannel

func ExtractDCCDataChannel(conv *core.ConversationInfo, data []byte, conn *IRCDCCConnection) error

ExtractDCCDataChannel extracts file from IRC DCC data channel

func RemoveDCCConnection

func RemoveDCCConnection(key string)

RemoveDCCConnection removes a tracked DCC connection

func ShouldDecodeAsDCCData

func ShouldDecodeAsDCCData(conv *core.ConversationInfo) bool

ShouldDecodeAsDCCData checks if a conversation should be decoded as IRC DCC DATA

Types

type IRCDCCConnection

type IRCDCCConnection struct {
	IP        string
	Port      int
	Filename  string
	Filesize  int64
	Type      string // SEND, CHAT, etc.
	Nick      string
	CreatedAt time.Time
}

IRCDCCConnection tracks expected IRC DCC data connections

func CheckDCCConnection

func CheckDCCConnection(key string) (*IRCDCCConnection, bool)

CheckDCCConnection checks if a connection matches an expected IRC DCC connection

type IRCFileExtractor

type IRCFileExtractor struct{}

IRCFileExtractor implements file extraction for IRC DCC file transfers

func (*IRCFileExtractor) DescribeFile

func (i *IRCFileExtractor) DescribeFile(handle *file.FileHandle) string

DescribeFile returns a human-readable description of the IRC DCC transfer

func (*IRCFileExtractor) ExtractFile

func (i *IRCFileExtractor) ExtractFile(conv *core.ConversationInfo, data []byte, metadata file.FileMetadata) error

ExtractFile performs IRC DCC file extraction

func (*IRCFileExtractor) GetFileHandle

func (i *IRCFileExtractor) GetFileHandle(conv *core.ConversationInfo, isOrigin bool, depth int) string

GetFileHandle generates a unique identifier for an IRC DCC file transfer

func (*IRCFileExtractor) ProtocolName

func (i *IRCFileExtractor) ProtocolName() string

ProtocolName returns the protocol name

Jump to

Keyboard shortcuts

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