mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 15:18:20 +00:00

Thanks to git this merge was less troublesome that I was afraid it would be. Not all tests pass yet though (and file hashes have changed unfortunately). Conflicts: cmake doc/scripts/DocSourcesList.cmake scripts/base/init-bare.bro scripts/base/protocols/ftp/main.bro scripts/base/protocols/irc/dcc-send.bro scripts/test-all-policy.bro src/AnalyzerTags.h src/CMakeLists.txt src/analyzer/Analyzer.cc src/analyzer/protocol/file/File.cc src/analyzer/protocol/file/File.h src/analyzer/protocol/http/HTTP.cc src/analyzer/protocol/http/HTTP.h src/analyzer/protocol/mime/MIME.cc src/event.bif src/main.cc src/util-config.h.in testing/btest/Baseline/coverage.bare-load-baseline/canonified_loaded_scripts.log testing/btest/Baseline/coverage.default-load-baseline/canonified_loaded_scripts.log testing/btest/Baseline/istate.events-ssl/receiver.http.log testing/btest/Baseline/istate.events-ssl/sender.http.log testing/btest/Baseline/istate.events/receiver.http.log testing/btest/Baseline/istate.events/sender.http.log
47 lines
1.1 KiB
Text
47 lines
1.1 KiB
Text
@load ./main
|
|
@load base/utils/conn-ids
|
|
@load base/frameworks/file-analysis/main
|
|
|
|
module FTP;
|
|
|
|
export {
|
|
## Default file handle provider for FTP.
|
|
global get_file_handle: function(c: connection, is_orig: bool): string;
|
|
}
|
|
|
|
function get_handle_string(c: connection): string
|
|
{
|
|
return cat(Analyzer::ANALYZER_FTP_DATA, " ", c$start_time, " ", id_string(c$id));
|
|
}
|
|
|
|
function get_file_handle(c: connection, is_orig: bool): string
|
|
{
|
|
if ( [c$id$resp_h, c$id$resp_p] !in ftp_data_expected ) return "";
|
|
|
|
local info: FTP::Info = ftp_data_expected[c$id$resp_h, c$id$resp_p];
|
|
|
|
if ( info$passive )
|
|
# FTP client initiates data channel.
|
|
if ( is_orig )
|
|
# Don't care about FTP client data.
|
|
return "";
|
|
else
|
|
# Do care about FTP server data.
|
|
return get_handle_string(c);
|
|
else
|
|
# FTP server initiates dta channel.
|
|
if ( is_orig )
|
|
# Do care about FTP server data.
|
|
return get_handle_string(c);
|
|
else
|
|
# Don't care about FTP client data.
|
|
return "";
|
|
}
|
|
|
|
module GLOBAL;
|
|
|
|
event get_file_handle(tag: Analyzer::Tag, c: connection, is_orig: bool)
|
|
{
|
|
if ( tag != Analyzer::ANALYZER_FTP_DATA ) return;
|
|
set_file_handle(FTP::get_file_handle(c, is_orig));
|
|
}
|