irc

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 18 Imported by: 0 modules, 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.

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
	},

	Specificity: core.SpecificityWeak,

	CanDecode: func(client, server []byte) bool {

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

		return hasIRCReply(server, []byte(" 001 ")) || hasIRCReply(server, []byte(" NOTICE "))
	},
	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