Merge pull request #2150 from dequis/pretty-host-filter

Match ~d and ~u filters against pretty_host too
This commit is contained in:
Maximilian Hils 2017-03-14 14:31:12 +01:00 committed by GitHub
commit 6bd2eb4ec6
2 changed files with 7 additions and 3 deletions

View File

@ -319,10 +319,14 @@ class FDomain(_Rex):
code = "d"
help = "Domain"
flags = re.IGNORECASE
is_binary = False
@only(http.HTTPFlow)
def __call__(self, f):
return bool(self.re.search(f.request.data.host))
return bool(
self.re.search(f.request.host) or
self.re.search(f.request.pretty_host)
)
class FUrl(_Rex):
@ -339,7 +343,7 @@ class FUrl(_Rex):
@only(http.HTTPFlow)
def __call__(self, f):
return self.re.search(f.request.url)
return self.re.search(f.request.pretty_url)
class FSrc(_Rex):

View File

@ -96,7 +96,7 @@ function responseBody(regex){
function domain(regex){
regex = new RegExp(regex, "i");
function domainFilter(flow){
return flow.request && regex.test(flow.request.host);
return flow.request && (regex.test(flow.request.host) || regex.test(flow.request.pretty_host));
}
domainFilter.desc = "domain matches " + regex;
return domainFilter;