start reworking interface of software framework. working apart from detect-webapps.bro, which direcly manipulates a no longer available interface...

This commit is contained in:
Bernhard Amann 2011-12-08 15:27:47 -08:00
parent 311cd1b116
commit dcc7fe3c38
7 changed files with 124 additions and 119 deletions

View file

@ -30,6 +30,12 @@ export {
addl: string &optional; ##< Additional version string (e.g. "beta42") addl: string &optional; ##< Additional version string (e.g. "beta42")
} &log; } &log;
type SoftwareDescription: record {
version: Version;
name: string;
unparsed_version: string;
};
type Info: record { type Info: record {
## The time at which the software was first detected. ## The time at which the software was first detected.
ts: time &log; ts: time &log;
@ -48,6 +54,21 @@ export {
## The full unparsed version string found because the version parsing ## The full unparsed version string found because the version parsing
## doesn't work 100% reliably and this acts as a fall back in the logs. ## doesn't work 100% reliably and this acts as a fall back in the logs.
unparsed_version: string &log &optional; unparsed_version: string &log &optional;
};
type AddItem: record {
## The connection
id: conn_id;
## The unparsed string representing the software version
banner: string;
## Pre-parsed version. If this field is present, banner should only contain the name of the software
version: Version &optional;
## The IP address detected running the software.
host: addr;
## The port on which the software is running (if applicable).
host_p: port &optional;
## The type of software detected (e.g. WEB_SERVER)
sw_type: Type;
## This can indicate that this software being detected should ## This can indicate that this software being detected should
## definitely be sent onward to the logging framework. By ## definitely be sent onward to the logging framework. By
@ -68,21 +89,13 @@ export {
## unparsed_version: This is the full string from which the ## unparsed_version: This is the full string from which the
## :bro:type:`Software::Info` was extracted. ## :bro:type:`Software::Info` was extracted.
## Returns: T if the software was logged, F otherwise. ## Returns: T if the software was logged, F otherwise.
global found: function(id: conn_id, info: Software::Info): bool; global found: function(i: AddItem): bool;
## This function can take many software version strings and parse them ## This function can take many software version strings and parse them
## into a sensible :bro:type:`Software::Version` record. There are ## into a sensible :bro:type:`Software::Version` record. There are
## still many cases where scripts may have to have their own specific ## still many cases where scripts may have to have their own specific
## version parsing though. ## version parsing though.
global parse: function(unparsed_version: string, global parse: function(unparsed_version: string): SoftwareDescription;
host: addr,
software_type: Type): Info;
## This function is the equivalent to parse for software that has a specific
## source port (i.e. server software)
global parse_with_port: function(unparsed_version: string,
host: addr, host_p: port,
software_type: Type): Info;
## Compare two versions. ## Compare two versions.
## Returns: -1 for v1 < v2, 0 for v1 == v2, 1 for v1 > v2. ## Returns: -1 for v1 < v2, 0 for v1 == v2, 1 for v1 > v2.
@ -116,9 +129,7 @@ event bro_init()
Log::create_stream(Software::LOG, [$columns=Info, $ev=log_software]); Log::create_stream(Software::LOG, [$columns=Info, $ev=log_software]);
} }
function parse_mozilla(unparsed_version: string, function parse_mozilla(unparsed_version: string): SoftwareDescription
host: addr,
software_type: Type): Info
{ {
local software_name = "<unknown browser>"; local software_name = "<unknown browser>";
local v: Version; local v: Version;
@ -129,7 +140,7 @@ function parse_mozilla(unparsed_version: string,
software_name = "Opera"; software_name = "Opera";
parts = split_all(unparsed_version, /Opera [0-9\.]*$/); parts = split_all(unparsed_version, /Opera [0-9\.]*$/);
if ( 2 in parts ) if ( 2 in parts )
v = parse(parts[2], host, software_type)$version; v = parse(parts[2])$version;
} }
else if ( / MSIE / in unparsed_version ) else if ( / MSIE / in unparsed_version )
{ {
@ -144,7 +155,7 @@ function parse_mozilla(unparsed_version: string,
{ {
parts = split_all(unparsed_version, /MSIE [0-9]{1,2}\.*[0-9]*b?[0-9]*/); parts = split_all(unparsed_version, /MSIE [0-9]{1,2}\.*[0-9]*b?[0-9]*/);
if ( 2 in parts ) if ( 2 in parts )
v = parse(parts[2], host, software_type)$version; v = parse(parts[2])$version;
} }
} }
else if ( /Version\/.*Safari\// in unparsed_version ) else if ( /Version\/.*Safari\// in unparsed_version )
@ -153,7 +164,7 @@ function parse_mozilla(unparsed_version: string,
parts = split_all(unparsed_version, /Version\/[0-9\.]*/); parts = split_all(unparsed_version, /Version\/[0-9\.]*/);
if ( 2 in parts ) if ( 2 in parts )
{ {
v = parse(parts[2], host, software_type)$version; v = parse(parts[2])$version;
if ( / Mobile\/?.* Safari/ in unparsed_version ) if ( / Mobile\/?.* Safari/ in unparsed_version )
v$addl = "Mobile"; v$addl = "Mobile";
} }
@ -163,7 +174,7 @@ function parse_mozilla(unparsed_version: string,
parts = split_all(unparsed_version, /(Firefox|Netscape|Thunderbird)\/[0-9\.]*/); parts = split_all(unparsed_version, /(Firefox|Netscape|Thunderbird)\/[0-9\.]*/);
if ( 2 in parts ) if ( 2 in parts )
{ {
local tmp_s = parse(parts[2], host, software_type); local tmp_s = parse(parts[2]);
software_name = tmp_s$name; software_name = tmp_s$name;
v = tmp_s$version; v = tmp_s$version;
} }
@ -173,7 +184,7 @@ function parse_mozilla(unparsed_version: string,
software_name = "Chrome"; software_name = "Chrome";
parts = split_all(unparsed_version, /Chrome\/[0-9\.]*/); parts = split_all(unparsed_version, /Chrome\/[0-9\.]*/);
if ( 2 in parts ) if ( 2 in parts )
v = parse(parts[2], host, software_type)$version; v = parse(parts[2])$version;
} }
else if ( /^Opera\// in unparsed_version ) else if ( /^Opera\// in unparsed_version )
{ {
@ -184,12 +195,12 @@ function parse_mozilla(unparsed_version: string,
software_name = parts[2]; software_name = parts[2];
parts = split_all(unparsed_version, /Version\/[0-9\.]*/); parts = split_all(unparsed_version, /Version\/[0-9\.]*/);
if ( 2 in parts ) if ( 2 in parts )
v = parse(parts[2], host, software_type)$version; v = parse(parts[2])$version;
else else
{ {
parts = split_all(unparsed_version, /Opera Mini\/[0-9\.]*/); parts = split_all(unparsed_version, /Opera Mini\/[0-9\.]*/);
if ( 2 in parts ) if ( 2 in parts )
v = parse(parts[2], host, software_type)$version; v = parse(parts[2])$version;
} }
} }
else else
@ -197,7 +208,7 @@ function parse_mozilla(unparsed_version: string,
software_name = "Opera"; software_name = "Opera";
parts = split_all(unparsed_version, /Version\/[0-9\.]*/); parts = split_all(unparsed_version, /Version\/[0-9\.]*/);
if ( 2 in parts ) if ( 2 in parts )
v = parse(parts[2], host, software_type)$version; v = parse(parts[2])$version;
} }
} }
else if ( /AppleWebKit\/[0-9\.]*/ in unparsed_version ) else if ( /AppleWebKit\/[0-9\.]*/ in unparsed_version )
@ -205,26 +216,24 @@ function parse_mozilla(unparsed_version: string,
software_name = "Unspecified WebKit"; software_name = "Unspecified WebKit";
parts = split_all(unparsed_version, /AppleWebKit\/[0-9\.]*/); parts = split_all(unparsed_version, /AppleWebKit\/[0-9\.]*/);
if ( 2 in parts ) if ( 2 in parts )
v = parse(parts[2], host, software_type)$version; v = parse(parts[2])$version;
} }
return [$ts=network_time(), $host=host, $name=software_name, $version=v, return [$version=v, $unparsed_version=unparsed_version, $name=software_name];
$software_type=software_type, $unparsed_version=unparsed_version];
} }
# Don't even try to understand this now, just make sure the tests are # Don't even try to understand this now, just make sure the tests are
# working. # working.
function parse(unparsed_version: string, function parse(unparsed_version: string): SoftwareDescription
host: addr,
software_type: Type): Info
{ {
local software_name = "<parse error>"; local software_name = "<parse error>";
local v: Version; local v: Version;
# Parse browser-alike versions separately # Parse browser-alike versions separately
if ( /^(Mozilla|Opera)\/[0-9]\./ in unparsed_version ) if ( /^(Mozilla|Opera)\/[0-9]\./ in unparsed_version )
{ {
return parse_mozilla(unparsed_version, host, software_type); return parse_mozilla(unparsed_version);
} }
else else
{ {
@ -286,22 +295,10 @@ function parse(unparsed_version: string,
v$major = extract_count(version_numbers[1]); v$major = extract_count(version_numbers[1]);
} }
} }
return [$ts=network_time(), $host=host, $name=software_name,
$version=v, $unparsed_version=unparsed_version, return [$version=v, $unparsed_version=unparsed_version, $name=software_name];
$software_type=software_type];
} }
function parse_with_port(unparsed_version: string,
host: addr, host_p: port,
software_type: Type): Info
{
local i: Info;
i = parse(unparsed_version, host, software_type);
i$host_p = host_p;
i$proto = get_port_transport_proto(host_p);
return i;
}
function cmp_versions(v1: Version, v2: Version): int function cmp_versions(v1: Version, v2: Version): int
@ -385,7 +382,7 @@ function software_fmt(i: Info): string
# Insert a mapping into the table # Insert a mapping into the table
# Overides old entries for the same software and generates events if needed. # Overides old entries for the same software and generates events if needed.
event software_register(id: conn_id, info: Info) event software_register(id: conn_id, force_log: bool, info: Info)
{ {
# Host already known? # Host already known?
if ( info$host !in tracked ) if ( info$host !in tracked )
@ -401,7 +398,7 @@ event software_register(id: conn_id, info: Info)
# If the version hasn't changed, then we're just redetecting the # If the version hasn't changed, then we're just redetecting the
# same thing, then we don't care. This results in no extra logging. # same thing, then we don't care. This results in no extra logging.
# But if the $force_log value is set then we'll continue. # But if the $force_log value is set then we'll continue.
if ( ! info$force_log && cmp_versions(old$version, info$version) == 0 ) if ( ! force_log && cmp_versions(old$version, info$version) == 0 )
return; return;
} }
ts[info$name] = info; ts[info$name] = info;
@ -409,11 +406,26 @@ event software_register(id: conn_id, info: Info)
Log::write(Software::LOG, info); Log::write(Software::LOG, info);
} }
function found(id: conn_id, info: Info): bool function found(i: AddItem): bool
{ {
if ( info$force_log || addr_matches_host(info$host, asset_tracking) ) if ( i$force_log || addr_matches_host(i$host, asset_tracking) )
{ {
event software_register(id, info);
local sw: SoftwareDescription;
if ( i?$version ) # already fully parsed, banner should contain the software name
{
sw = [$version=i$version, $name=i$banner, $unparsed_version=i$banner];
}
else
{
sw = parse(i$banner);
}
event software_register(i$id, i$force_log, [$ts=network_time(), $host=i$host, $host_p=i$host_p, $name=sw$name,
$version=sw$version, $unparsed_version=sw$unparsed_version,
$software_type=i$sw_type] );
return T; return T;
} }
else else

View file

@ -21,7 +21,6 @@ event ftp_request(c: connection, command: string, arg: string) &priority=4
{ {
if ( command == "CLNT" ) if ( command == "CLNT" )
{ {
local si = Software::parse(arg, c$id$orig_h, FTP_CLIENT); Software::found([$id=c$id, $banner=arg, $host=c$id$orig_h, $sw_type=FTP_CLIENT]);
Software::found(c$id, si);
} }
} }

View file

@ -26,8 +26,7 @@ event http_header(c: connection, is_orig: bool, name: string, value: string) &pr
# Flash doesn't include it's name so we'll add it here since it # Flash doesn't include it's name so we'll add it here since it
# simplifies the version parsing. # simplifies the version parsing.
value = cat("Flash/", value); value = cat("Flash/", value);
local flash_version = Software::parse(value, c$id$orig_h, BROWSER_PLUGIN); Software::found([$id=c$id, $banner=flash_version, $host=c$id$orig_h, $sw_type=BROWSER_PLUGIN]);
Software::found(c$id, flash_version);
} }
} }
else else
@ -54,7 +53,7 @@ event log_http(rec: Info)
local plugins = split(sw, /[[:blank:]]*;[[:blank:]]*/); local plugins = split(sw, /[[:blank:]]*;[[:blank:]]*/);
for ( i in plugins ) for ( i in plugins )
Software::found(rec$id, Software::parse(plugins[i], rec$id$orig_h, BROWSER_PLUGIN)); Software::found([$id=rec$id, $banner=plugins[i], $host=rec$id$orig_h, $sw_type=BROWSER_PLUGIN]);
} }
} }
} }

View file

@ -20,18 +20,18 @@ event http_header(c: connection, is_orig: bool, name: string, value: string) &pr
if ( is_orig ) if ( is_orig )
{ {
if ( name == "USER-AGENT" && ignored_user_agents !in value ) if ( name == "USER-AGENT" && ignored_user_agents !in value )
Software::found(c$id, Software::parse(value, c$id$orig_h, BROWSER)); Software::found([$id=c$id, $banner=value, $host=c$id$orig_h, $sw_type=BROWSER]);
} }
else else
{ {
if ( name == "SERVER" ) if ( name == "SERVER" )
Software::found(c$id, Software::parse_with_port(value, c$id$resp_h, c$id$resp_p, SERVER)); Software::found([$id=c$id, $banner=value, $host=c$id$resp_h, $host_p=c$id$resp_p, $sw_type=SERVER]);
else if ( name == "X-POWERED-BY" ) else if ( name == "X-POWERED-BY" )
Software::found(c$id, Software::parse_with_port(value, c$id$resp_h, c$id$resp_p, APPSERVER)); Software::found([$id=c$id, $banner=value, $host=c$id$resp_h, $host_p=c$id$resp_p, $sw_type=APPSERVER]);
else if ( name == "MICROSOFTSHAREPOINTTEAMSERVICES" ) else if ( name == "MICROSOFTSHAREPOINTTEAMSERVICES" )
{ {
value = cat("SharePoint/", value); value = cat("SharePoint/", value);
Software::found(c$id, Software::parse_with_port(value, c$id$resp_h, c$id$resp_p, APPSERVER)); Software::found([$id=c$id, $banner=value, $host=c$id$resp_h, $host_p=c$id$resp_p, $sw_type=APPSERVER]);
} }
} }
} }

View file

@ -75,8 +75,7 @@ event log_smtp(rec: Info)
if ( addr_matches_host(rec$id$orig_h, if ( addr_matches_host(rec$id$orig_h,
detect_clients_in_messages_from) ) detect_clients_in_messages_from) )
{ {
local s = Software::parse(rec$user_agent, client_ip, s_type); Software::found([$id=rec$id, $banner=rec$user_agent, $host=client_ip, $sw_type=s_type]);
Software::found(rec$id, s);
} }
} }
} }

View file

@ -16,14 +16,12 @@ event ssh_client_version(c: connection, version: string) &priority=4
{ {
# Get rid of the protocol information when passing to the software framework. # Get rid of the protocol information when passing to the software framework.
local cleaned_version = sub(version, /^SSH[0-9\.\-]+/, ""); local cleaned_version = sub(version, /^SSH[0-9\.\-]+/, "");
local si = Software::parse(cleaned_version, c$id$orig_h, CLIENT); Software::found([$id=c$id, $banner=cleaned_version, $host=c$id$orig_h, $sw_type=CLIENT]);
Software::found(c$id, si);
} }
event ssh_server_version(c: connection, version: string) &priority=4 event ssh_server_version(c: connection, version: string) &priority=4
{ {
# Get rid of the protocol information when passing to the software framework. # Get rid of the protocol information when passing to the software framework.
local cleaned_version = sub(version, /SSH[0-9\.\-]{2,}/, ""); local cleaned_version = sub(version, /SSH[0-9\.\-]{2,}/, "");
local si = Software::parse_with_port(cleaned_version, c$id$resp_h, c$id$resp_p, SERVER); Software::found([$id=c$id, $banner=cleaned_version, $host=c$id$resp_h, $host_p=c$id$resp_p, $sw_type=SERVER]);
Software::found(c$id, si);
} }

View file

@ -1,116 +1,114 @@
# @TEST-EXEC: bro %INPUT > output # @TEST-EXEC: bro %INPUT > output
# @TEST-EXEC: btest-diff output # @TEST-EXEC: btest-diff output
global ts = network_time(); global matched_software: table[string] of Software::SoftwareDescription = {
global host = 0.0.0.0;
global matched_software: table[string] of Software::Info = {
["OpenSSH_4.4"] = ["OpenSSH_4.4"] =
[$name="OpenSSH", $version=[$major=4,$minor=4], $host=host, $ts=ts], [$name="OpenSSH", $version=[$major=4,$minor=4], $unparsed_version=""],
["OpenSSH_5.2"] = ["OpenSSH_5.2"] =
[$name="OpenSSH", $version=[$major=5,$minor=2], $host=host, $ts=ts], [$name="OpenSSH", $version=[$major=5,$minor=2], $unparsed_version=""],
["Apache/2.0.63 (Unix) mod_auth_kerb/5.3 mod_ssl/2.0.63 OpenSSL/0.9.7a mod_fastcgi/2.4.2"] = ["Apache/2.0.63 (Unix) mod_auth_kerb/5.3 mod_ssl/2.0.63 OpenSSL/0.9.7a mod_fastcgi/2.4.2"] =
[$name="Apache", $version=[$major=2,$minor=0,$minor2=63,$addl="Unix"], $host=host, $ts=ts], [$name="Apache", $version=[$major=2,$minor=0,$minor2=63,$addl="Unix"], $unparsed_version=""],
["Apache/1.3.19 (Unix)"] = ["Apache/1.3.19 (Unix)"] =
[$name="Apache", $version=[$major=1,$minor=3,$minor2=19,$addl="Unix"], $host=host, $ts=ts], [$name="Apache", $version=[$major=1,$minor=3,$minor2=19,$addl="Unix"], $unparsed_version=""],
["ProFTPD 1.2.5rc1 Server (Debian)"] = ["ProFTPD 1.2.5rc1 Server (Debian)"] =
[$name="ProFTPD", $version=[$major=1,$minor=2,$minor2=5,$addl="rc1"], $host=host, $ts=ts], [$name="ProFTPD", $version=[$major=1,$minor=2,$minor2=5,$addl="rc1"], $unparsed_version=""],
["wu-2.4.2-academ[BETA-18-VR14](1)"] = ["wu-2.4.2-academ[BETA-18-VR14](1)"] =
[$name="wu", $version=[$major=2,$minor=4,$minor2=2,$addl="academ"], $host=host, $ts=ts], [$name="wu", $version=[$major=2,$minor=4,$minor2=2,$addl="academ"], $unparsed_version=""],
["wu-2.6.2(1)"] = ["wu-2.6.2(1)"] =
[$name="wu", $version=[$major=2,$minor=6,$minor2=2,$addl="1"], $host=host, $ts=ts], [$name="wu", $version=[$major=2,$minor=6,$minor2=2,$addl="1"], $unparsed_version=""],
["Java1.2.2-JDeveloper"] = ["Java1.2.2-JDeveloper"] =
[$name="Java", $version=[$major=1,$minor=2,$minor2=2,$addl="JDeveloper"], $host=host, $ts=ts], [$name="Java", $version=[$major=1,$minor=2,$minor2=2,$addl="JDeveloper"], $unparsed_version=""],
["Java/1.6.0_13"] = ["Java/1.6.0_13"] =
[$name="Java", $version=[$major=1,$minor=6,$minor2=0,$addl="13"], $host=host, $ts=ts], [$name="Java", $version=[$major=1,$minor=6,$minor2=0,$addl="13"], $unparsed_version=""],
["Python-urllib/3.1"] = ["Python-urllib/3.1"] =
[$name="Python-urllib", $version=[$major=3,$minor=1], $host=host, $ts=ts], [$name="Python-urllib", $version=[$major=3,$minor=1], $unparsed_version=""],
["libwww-perl/5.820"] = ["libwww-perl/5.820"] =
[$name="libwww-perl", $version=[$major=5,$minor=820], $host=host, $ts=ts], [$name="libwww-perl", $version=[$major=5,$minor=820], $unparsed_version=""],
["Wget/1.9+cvs-stable (Red Hat modified)"] = ["Wget/1.9+cvs-stable (Red Hat modified)"] =
[$name="Wget", $version=[$major=1,$minor=9,$addl="+cvs"], $host=host, $ts=ts], [$name="Wget", $version=[$major=1,$minor=9,$addl="+cvs"], $unparsed_version=""],
["Wget/1.11.4 (Red Hat modified)"] = ["Wget/1.11.4 (Red Hat modified)"] =
[$name="Wget", $version=[$major=1,$minor=11,$minor2=4,$addl="Red Hat modified"], $host=host, $ts=ts], [$name="Wget", $version=[$major=1,$minor=11,$minor2=4,$addl="Red Hat modified"], $unparsed_version=""],
["curl/7.15.1 (i486-pc-linux-gnu) libcurl/7.15.1 OpenSSL/0.9.8a zlib/1.2.3 libidn/0.5.18"] = ["curl/7.15.1 (i486-pc-linux-gnu) libcurl/7.15.1 OpenSSL/0.9.8a zlib/1.2.3 libidn/0.5.18"] =
[$name="curl", $version=[$major=7,$minor=15,$minor2=1,$addl="i486-pc-linux-gnu"], $host=host, $ts=ts], [$name="curl", $version=[$major=7,$minor=15,$minor2=1,$addl="i486-pc-linux-gnu"], $unparsed_version=""],
["Apache"] = ["Apache"] =
[$name="Apache", $host=host, $ts=ts], [$name="Apache", $unparsed_version=""],
["Zope/(Zope 2.7.8-final, python 2.3.5, darwin) ZServer/1.1 Plone/Unknown"] = ["Zope/(Zope 2.7.8-final, python 2.3.5, darwin) ZServer/1.1 Plone/Unknown"] =
[$name="Zope/(Zope", $version=[$major=2,$minor=7,$minor2=8,$addl="final"], $host=host, $ts=ts], [$name="Zope/(Zope", $version=[$major=2,$minor=7,$minor2=8,$addl="final"], $unparsed_version=""],
["The Bat! (v2.00.9) Personal"] = ["The Bat! (v2.00.9) Personal"] =
[$name="The Bat!", $version=[$major=2,$minor=0,$minor2=9,$addl="Personal"], $host=host, $ts=ts], [$name="The Bat!", $version=[$major=2,$minor=0,$minor2=9,$addl="Personal"], $unparsed_version=""],
["Flash/10,2,153,1"] = ["Flash/10,2,153,1"] =
[$name="Flash", $version=[$major=10,$minor=2,$minor2=153,$addl="1"], $host=host, $ts=ts], [$name="Flash", $version=[$major=10,$minor=2,$minor2=153,$addl="1"], $unparsed_version=""],
["mt2/1.2.3.967 Oct 13 2010-13:40:24 ord-pixel-x2 pid 0x35a3 13731"] = ["mt2/1.2.3.967 Oct 13 2010-13:40:24 ord-pixel-x2 pid 0x35a3 13731"] =
[$name="mt2", $version=[$major=1,$minor=2,$minor2=3,$addl="967"], $host=host, $ts=ts], [$name="mt2", $version=[$major=1,$minor=2,$minor2=3,$addl="967"], $unparsed_version=""],
["CacheFlyServe v26b"] = ["CacheFlyServe v26b"] =
[$name="CacheFlyServe", $version=[$major=26,$addl="b"], $host=host, $ts=ts], [$name="CacheFlyServe", $version=[$major=26,$addl="b"], $unparsed_version=""],
["Apache/2.0.46 (Win32) mod_ssl/2.0.46 OpenSSL/0.9.7b mod_jk2/2.0.4"] = ["Apache/2.0.46 (Win32) mod_ssl/2.0.46 OpenSSL/0.9.7b mod_jk2/2.0.4"] =
[$name="Apache", $version=[$major=2,$minor=0,$minor2=46,$addl="Win32"], $host=host, $ts=ts], [$name="Apache", $version=[$major=2,$minor=0,$minor2=46,$addl="Win32"], $unparsed_version=""],
# I have no clue how I'd support this without a special case. # I have no clue how I'd support this without a special case.
#["Apache mod_fcgid/2.3.6 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635"] = #["Apache mod_fcgid/2.3.6 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635"] =
# [$name="Apache", $version=[], $host=host, $ts=ts], # [$name="Apache", $version=[], $unparsed_version=""],
["Apple iPhone v4.3.1 Weather v1.0.0.8G4"] = ["Apple iPhone v4.3.1 Weather v1.0.0.8G4"] =
[$name="Apple iPhone", $version=[$major=4,$minor=3,$minor2=1,$addl="Weather"], $host=host, $ts=ts], [$name="Apple iPhone", $version=[$major=4,$minor=3,$minor2=1,$addl="Weather"], $unparsed_version=""],
["Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5"] = ["Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5"] =
[$name="Safari", $version=[$major=5,$minor=0,$minor2=2,$addl="Mobile"], $host=host, $ts=ts], [$name="Safari", $version=[$major=5,$minor=0,$minor2=2,$addl="Mobile"], $unparsed_version=""],
["Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.205 Safari/534.16"] = ["Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.205 Safari/534.16"] =
[$name="Chrome", $version=[$major=10,$minor=0,$minor2=648,$addl="205"], $host=host, $ts=ts], [$name="Chrome", $version=[$major=10,$minor=0,$minor2=648,$addl="205"], $unparsed_version=""],
["Opera/9.80 (Windows NT 6.1; U; sv) Presto/2.7.62 Version/11.01"] = ["Opera/9.80 (Windows NT 6.1; U; sv) Presto/2.7.62 Version/11.01"] =
[$name="Opera", $version=[$major=11,$minor=1], $host=host, $ts=ts], [$name="Opera", $version=[$major=11,$minor=1], $unparsed_version=""],
["Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.11) Gecko/20101013 Lightning/1.0b2 Thunderbird/3.1.5"] = ["Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.11) Gecko/20101013 Lightning/1.0b2 Thunderbird/3.1.5"] =
[$name="Thunderbird", $version=[$major=3,$minor=1,$minor2=5], $host=host, $ts=ts], [$name="Thunderbird", $version=[$major=3,$minor=1,$minor2=5], $unparsed_version=""],
["iTunes/9.0 (Macintosh; Intel Mac OS X 10.5.8) AppleWebKit/531.9"] = ["iTunes/9.0 (Macintosh; Intel Mac OS X 10.5.8) AppleWebKit/531.9"] =
[$name="iTunes", $version=[$major=9,$minor=0,$addl="Macintosh"], $host=host, $ts=ts], [$name="iTunes", $version=[$major=9,$minor=0,$addl="Macintosh"], $unparsed_version=""],
["Java1.3.1_04"] = ["Java1.3.1_04"] =
[$name="Java", $version=[$major=1,$minor=3,$minor2=1,$addl="04"], $host=host, $ts=ts], [$name="Java", $version=[$major=1,$minor=3,$minor2=1,$addl="04"], $unparsed_version=""],
["Mozilla/5.0 (Linux; U; Android 2.3.3; zh-tw; HTC Pyramid Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"] = ["Mozilla/5.0 (Linux; U; Android 2.3.3; zh-tw; HTC Pyramid Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"] =
[$name="Safari", $version=[$major=4,$minor=0,$addl="Mobile"], $host=host, $ts=ts], [$name="Safari", $version=[$major=4,$minor=0,$addl="Mobile"], $unparsed_version=""],
["Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27"] = ["Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27"] =
[$name="Safari", $version=[$major=5,$minor=0,$minor2=4], $host=host, $ts=ts], [$name="Safari", $version=[$major=5,$minor=0,$minor2=4], $unparsed_version=""],
["Mozilla/5.0 (iPod; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"] = ["Mozilla/5.0 (iPod; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"] =
[$name="Safari", $version=[$major=4,$minor=0,$minor2=5,$addl="Mobile"], $host=host, $ts=ts], [$name="Safari", $version=[$major=4,$minor=0,$minor2=5,$addl="Mobile"], $unparsed_version=""],
["Opera/9.80 (J2ME/MIDP; Opera Mini/9.80 (S60; SymbOS; Opera Mobi/23.348; U; en) Presto/2.5.25 Version/10.54"] = ["Opera/9.80 (J2ME/MIDP; Opera Mini/9.80 (S60; SymbOS; Opera Mobi/23.348; U; en) Presto/2.5.25 Version/10.54"] =
[$name="Opera Mini", $version=[$major=10,$minor=54], $host=host, $ts=ts], [$name="Opera Mini", $version=[$major=10,$minor=54], $unparsed_version=""],
["Opera/9.80 (J2ME/MIDP; Opera Mini/5.0.18741/18.794; U; en) Presto/2.4.15"] = ["Opera/9.80 (J2ME/MIDP; Opera Mini/5.0.18741/18.794; U; en) Presto/2.4.15"] =
[$name="Opera Mini", $version=[$major=5,$minor=0,$minor2=18741], $host=host, $ts=ts], [$name="Opera Mini", $version=[$major=5,$minor=0,$minor2=18741], $unparsed_version=""],
["Opera/9.80 (Windows NT 5.1; Opera Mobi/49; U; en) Presto/2.4.18 Version/10.00"] = ["Opera/9.80 (Windows NT 5.1; Opera Mobi/49; U; en) Presto/2.4.18 Version/10.00"] =
[$name="Opera Mobi", $version=[$major=10,$minor=0], $host=host, $ts=ts], [$name="Opera Mobi", $version=[$major=10,$minor=0], $unparsed_version=""],
["Mozilla/4.0 (compatible; MSIE 8.0; Android 2.2.2; Linux; Opera Mobi/ADR-1103311355; en) Opera 11.00"] = ["Mozilla/4.0 (compatible; MSIE 8.0; Android 2.2.2; Linux; Opera Mobi/ADR-1103311355; en) Opera 11.00"] =
[$name="Opera", $version=[$major=11,$minor=0], $host=host, $ts=ts], [$name="Opera", $version=[$major=11,$minor=0], $unparsed_version=""],
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)"] = ["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)"] =
[$name="Netscape", $version=[$major=7,$minor=2], $host=host, $ts=ts], [$name="Netscape", $version=[$major=7,$minor=2], $unparsed_version=""],
["Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; GTB5; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2)"] = ["Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; GTB5; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2)"] =
[$name="MSIE", $version=[$major=7,$minor=0], $host=host, $ts=ts], [$name="MSIE", $version=[$major=7,$minor=0], $unparsed_version=""],
["Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; Media Center PC 3.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)"] = ["Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; Media Center PC 3.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)"] =
[$name="MSIE", $version=[$major=7,$minor=0,$addl="b"], $host=host, $ts=ts], [$name="MSIE", $version=[$major=7,$minor=0,$addl="b"], $unparsed_version=""],
["Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; InfoPath.2; InfoPath.3)"] = ["Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; InfoPath.2; InfoPath.3)"] =
[$name="MSIE", $version=[$major=8,$minor=0], $host=host, $ts=ts], [$name="MSIE", $version=[$major=8,$minor=0], $unparsed_version=""],
["Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"] = ["Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"] =
[$name="MSIE", $version=[$major=9,$minor=0], $host=host, $ts=ts], [$name="MSIE", $version=[$major=9,$minor=0], $unparsed_version=""],
["Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; Creative AutoUpdate v1.40.02)"] = ["Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; Creative AutoUpdate v1.40.02)"] =
[$name="MSIE", $version=[$major=9,$minor=0], $host=host, $ts=ts], [$name="MSIE", $version=[$major=9,$minor=0], $unparsed_version=""],
["Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"] = ["Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"] =
[$name="MSIE", $version=[$major=10,$minor=0], $host=host, $ts=ts], [$name="MSIE", $version=[$major=10,$minor=0], $unparsed_version=""],
["The Bat! (3.0.1 RC3) Professional"] = ["The Bat! (3.0.1 RC3) Professional"] =
[$name="The Bat!", $version=[$major=3,$minor=0,$minor2=1,$addl="RC3"], $host=host, $ts=ts], [$name="The Bat!", $version=[$major=3,$minor=0,$minor2=1,$addl="RC3"], $unparsed_version=""],
# This is an FTP client (found with CLNT command) # This is an FTP client (found with CLNT command)
["Total Commander"] = ["Total Commander"] =
[$name="Total Commander", $version=[], $host=host, $ts=ts], [$name="Total Commander", $version=[], $unparsed_version=""],
["(vsFTPd 2.0.5)"] = ["(vsFTPd 2.0.5)"] =
[$name="vsFTPd", $version=[$major=2,$minor=0,$minor2=5], $host=host, $ts=ts], [$name="vsFTPd", $version=[$major=2,$minor=0,$minor2=5], $unparsed_version=""],
["Apple Mail (2.1084)"] = ["Apple Mail (2.1084)"] =
[$name="Apple Mail", $version=[$major=2,$minor=1084], $host=host, $ts=ts], [$name="Apple Mail", $version=[$major=2,$minor=1084], $unparsed_version=""],
}; };
event bro_init() event bro_init()
{ {
for ( sw in matched_software ) for ( sw in matched_software )
{ {
local output = Software::parse(sw, host, Software::UNKNOWN); local output = Software::parse(sw);
local baseline: Software::Info; local baseline: Software::SoftwareDescription;
baseline = matched_software[sw]; baseline = matched_software[sw];
if ( baseline$name == output$name && if ( baseline$name == output$name &&
sw == output$unparsed_version &&
Software::cmp_versions(baseline$version,output$version) == 0 ) Software::cmp_versions(baseline$version,output$version) == 0 )
print fmt("success on: %s", sw); print fmt("success on: %s", sw);
else else