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.
55 lines
No EOL
1.6 KiB
Text
55 lines
No EOL
1.6 KiB
Text
##! Software identification and extraction for HTTP traffic.
|
|
|
|
module HTTP;
|
|
|
|
export {
|
|
redef enum Software::Type += {
|
|
WEB_SERVER,
|
|
WEB_APPSERVER,
|
|
WEB_BROWSER,
|
|
WEB_BROWSER_PLUGIN
|
|
};
|
|
|
|
## The pattern of HTTP User-Agents which you would like to ignore.
|
|
const ignored_user_agents = /NO_DEFAULT/ &redef;
|
|
|
|
## These are patterns to identify browser plugins (including toolbars)
|
|
## based on the User-Agent header.
|
|
const plugin_user_agents = /BingBar [0-9\.]*/ ##< Bing toolbar
|
|
| /GoogleToolbar [0-9\.]*;/ &redef; ##< Google toolbar
|
|
}
|
|
|
|
event http_header(c: connection, is_orig: bool, name: string, value: string) &priority=2
|
|
{
|
|
if ( is_orig )
|
|
{
|
|
if ( name == "USER-AGENT" && ignored_user_agents !in value )
|
|
{
|
|
local ua_type = WEB_BROWSER;
|
|
if ( plugin_user_agents in value )
|
|
ua_type = WEB_BROWSER_PLUGIN;
|
|
|
|
Software::found(c$id, Software::parse(value, c$id$orig_h, ua_type));
|
|
}
|
|
else if ( name == "X-FLASH-VERSION" )
|
|
{
|
|
# Flash doesn't include it's name so we'll add it here since it
|
|
# simplifies the version parsing.
|
|
value = cat("Flash/", value);
|
|
local flash_version = Software::parse(value, c$id$orig_h, WEB_BROWSER_PLUGIN);
|
|
Software::found(c$id, flash_version);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ( name == "SERVER" )
|
|
Software::found(c$id, Software::parse(value, c$id$resp_h, WEB_SERVER));
|
|
else if ( name == "X-POWERED-BY" )
|
|
Software::found(c$id, Software::parse(value, c$id$resp_h, WEB_APPSERVER));
|
|
else if ( name == "MICROSOFTSHAREPOINTTEAMSERVICES" )
|
|
{
|
|
value = cat("SharePoint/", value);
|
|
Software::found(c$id, Software::parse(value, c$id$resp_h, WEB_APPSERVER));
|
|
}
|
|
}
|
|
} |