Created
February 3, 2015 22:03
-
-
Save grigorescu/642f486c6a0405786860 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##! Add support for X-Requested-With | |
@load base/protocols/http | |
@load base/frameworks/software | |
@load policy/protocols/http/software-browser-plugins | |
module HTTP; | |
export { | |
redef record HTTP::Info += { | |
## X-REQUESTED_WITH value, if set | |
x_requested_with: string &log &optional; | |
## T if this was requested with XMLHttpRequest | |
is_ajax: bool &log &optional; | |
}; | |
# If this matches the XHR value, pass it to the software framework | |
const xhr_browser_plugins = /^ShockwaveFlash/ &redef; | |
} | |
event http_header(c: connection, is_orig: bool, name: string, value: string) | |
{ | |
if ( ! is_orig || ! c?$http ) | |
return; | |
if ( name == "X-REQUESTED-WITH" ) | |
{ | |
c$http$x_requested_with = value; | |
c$http$is_ajax = value == "XMLHttpRequest"; | |
if ( xhr_browser_plugins in value ) | |
Software::found(c$id, [$unparsed_version=value, $host=c$id$orig_h, $software_type=BROWSER_PLUGIN]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment