mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00

- policy/ renamed to scripts/ - By default BROPATH now contains: - scripts/ - scripts/policy - scripts/site - *Nearly* all tests pass. - All of scripts/base/ is loaded by main.cc - Can be disabled by setting $BRO_NO_BASE_SCRIPTS - Scripts in scripts/base/ don't use relative path loading to ease use of BRO_NO_BASE_SCRIPTS (to copy and paste that script). - The scripts in scripts/base/protocols/ only (or soon will only) do logging and state building. - The scripts in scripts/base/frameworks/ add functionality without causing any additional overhead. - All "detection" activity happens through scripts in scripts/policy/. - Communications framework modified temporarily to need an environment variable to actually enable (ENABLE_COMMUNICATION=1) - This is so the communications framework can be loaded as part of the base without causing trouble when it's not needed. - This will be removed once a resolution to ticket #540 is reached.
45 lines
1.3 KiB
Text
45 lines
1.3 KiB
Text
|
|
module HTTP;
|
|
|
|
redef signature_files += "protocols/http/detect-webapps.sig";
|
|
# Ignore the signatures used to match webapps
|
|
redef Signatures::ignored_ids += /^webapp-/;
|
|
|
|
export {
|
|
redef enum Software::Type += {
|
|
WEB_APPLICATION,
|
|
};
|
|
|
|
redef record Software::Info += {
|
|
url: string &optional &log;
|
|
};
|
|
}
|
|
|
|
event signature_match(state: signature_state, msg: string, data: string) &priority=5
|
|
{
|
|
if ( /^webapp-/ !in state$sig_id ) return;
|
|
|
|
local c = state$conn;
|
|
local si = Software::parse(msg, c$id$resp_h, WEB_APPLICATION);
|
|
si$url = build_url_http(c$http);
|
|
if ( c$id$resp_h in Software::tracked &&
|
|
si$name in Software::tracked[c$id$resp_h] )
|
|
{
|
|
# If the new url is a substring of an existing, known url then let's
|
|
# use that as the new url for the software.
|
|
# PROBLEM: different version of the same software on the same server with a shared root path
|
|
local is_substring = 0;
|
|
if ( Software::tracked[c$id$resp_h][si$name]?$url )
|
|
is_substring = strstr(Software::tracked[c$id$resp_h][si$name]$url, si$url);
|
|
|
|
if ( is_substring == 1 )
|
|
{
|
|
Software::tracked[c$id$resp_h][si$name]$url = si$url;
|
|
# Force the software to be logged because it indicates a URL
|
|
# closer to the root of the site.
|
|
si$force_log = T;
|
|
}
|
|
}
|
|
|
|
Software::found(c$id, si);
|
|
}
|