diff options
author | Shadab Zafar <dufferzafar0@gmail.com> | 2016-07-12 15:50:13 +0530 |
---|---|---|
committer | Shadab Zafar <dufferzafar0@gmail.com> | 2016-07-16 10:15:38 +0530 |
commit | 124b87b8517b2fefe1a9486f7f2f12b91d6d1ea9 (patch) | |
tree | 24cbb7d3a6cdc44425993e2bbc5dfc0e3712fc7d /mitmproxy/filt.py | |
parent | 88671c3aac430dfac8a609c82123b138ded22fad (diff) | |
download | mitmproxy-124b87b8517b2fefe1a9486f7f2f12b91d6d1ea9.tar.gz mitmproxy-124b87b8517b2fefe1a9486f7f2f12b91d6d1ea9.tar.bz2 mitmproxy-124b87b8517b2fefe1a9486f7f2f12b91d6d1ea9.zip |
Add test for body (~b)
Diffstat (limited to 'mitmproxy/filt.py')
-rw-r--r-- | mitmproxy/filt.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/mitmproxy/filt.py b/mitmproxy/filt.py index b1b72aa7..cb49283d 100644 --- a/mitmproxy/filt.py +++ b/mitmproxy/filt.py @@ -193,12 +193,22 @@ class FBod(_Rex): help = "Body" def __call__(self, f): - if f.request and f.request.content: - if self.re.search(f.request.get_decoded_content()): - return True - if f.response and f.response.content: - if self.re.search(f.response.get_decoded_content()): - return True + + # HTTPFlow + if hasattr(f, 'request'): + if f.request and f.request.content: + if self.re.search(f.request.get_decoded_content()): + return True + if f.response and f.response.content: + if self.re.search(f.response.get_decoded_content()): + return True + + # TCPFlow + elif hasattr(f, 'messages'): + for msg in f.messages: + if self.re.search(msg.content): + return True + return False |