MCPcopy
hub / github.com/dreadl0ck/netcap / ExtractDCCDataChannel

Function ExtractDCCDataChannel

decoder/stream/irc/irc_data.go:157–177  ·  view source on GitHub ↗

ExtractDCCDataChannel extracts file from IRC DCC data channel

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

Source from the content-addressed store, hash-verified

155
156// ExtractDCCDataChannel extracts file from IRC DCC data channel
157func ExtractDCCDataChannel(conv *core.ConversationInfo, data []byte, conn *IRCDCCConnection) error {
158 if len(data) == 0 {
159 return nil
160 }
161
162 // Use file extraction framework
163 extractor, ok := file.GetExtractor("IRC")
164 if !ok {
165 ircLog.Error("IRC file extractor not registered")
166 return nil
167 }
168
169 metadata := file.FileMetadata{
170 ConnectionUID: conv.Ident,
171 FlowDirection: "server_to_client", // DCC SEND is typically download
172 Filename: filepath.Base(conn.Filename),
173 Host: conn.IP,
174 }
175
176 return extractor.ExtractFile(conv, data, metadata)
177}
178
179// RemoveDCCConnection removes a tracked DCC connection
180func RemoveDCCConnection(key string) {

Callers 1

DecodeMethod · 0.85

Calls 3

GetExtractorFunction · 0.92
ExtractFileMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected