mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Forgot a file.
This commit is contained in:
parent
0bfdcc1fbc
commit
eb7ceb3e9a
1 changed files with 47 additions and 0 deletions
47
scripts/base/protocols/ftp/utils.bro
Normal file
47
scripts/base/protocols/ftp/utils.bro
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
##! Utilities specific for FTP processing.
|
||||||
|
|
||||||
|
@load ./main
|
||||||
|
@load base/utils/addrs
|
||||||
|
|
||||||
|
module FTP;
|
||||||
|
|
||||||
|
export {
|
||||||
|
## Creates a URL from an :bro:type:`FTP::Info` record.
|
||||||
|
##
|
||||||
|
## rec: An :bro:type:`FTP::Info` record.
|
||||||
|
##
|
||||||
|
## Returns: A URL, not prefixed by "ftp://".
|
||||||
|
global build_url: function(rec: Info): string;
|
||||||
|
|
||||||
|
## Creates a URL from an :bro:type:`FTP::Info` record.
|
||||||
|
##
|
||||||
|
## rec: An :bro:type:`FTP::Info` record.
|
||||||
|
##
|
||||||
|
## Returns: A URL prefixed with "ftp://".
|
||||||
|
global build_url_ftp: function(rec: Info): string;
|
||||||
|
|
||||||
|
## Create an extremely shortened representation of a log line.
|
||||||
|
global describe: function(rec: Info): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function build_url(rec: Info): string
|
||||||
|
{
|
||||||
|
if ( !rec?$arg )
|
||||||
|
return "";
|
||||||
|
|
||||||
|
local comp_path = build_path_compressed(rec$cwd, rec$arg);
|
||||||
|
if ( comp_path[0] != "/" )
|
||||||
|
comp_path = cat("/", comp_path);
|
||||||
|
|
||||||
|
return fmt("%s%s", addr_to_uri(rec$id$resp_h), comp_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
function build_url_ftp(rec: Info): string
|
||||||
|
{
|
||||||
|
return fmt("ftp://%s", build_url(rec));
|
||||||
|
}
|
||||||
|
|
||||||
|
function describe(rec: Info): string
|
||||||
|
{
|
||||||
|
return build_url_ftp(rec);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue