From abd76081e1a08d6d47dc579ec1cd3fb52c0719f0 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 11 Nov 2013 09:25:42 +0100 Subject: [PATCH] Adding a new WAF script (varnish.py) --- doc/THANKS.md | 5 ++++- waf/varnish.py | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 waf/varnish.py diff --git a/doc/THANKS.md b/doc/THANKS.md index 5a790351f..b275c5ef2 100644 --- a/doc/THANKS.md +++ b/doc/THANKS.md @@ -6,6 +6,9 @@ Andres Tarasco Acuna, Santiago Accurso, * for reporting a bug +Syed Afzal, +* for contributing a WAF script varnish.py + Zaki Akhmad, * for suggesting a couple of features @@ -303,7 +306,7 @@ Michael Majchrowicz, * for suggesting a lot of ideas and features Ahmad Maulana, -* for contributing one tamper script, halfversionedmorekeywords.py +* for contributing a tamper script halfversionedmorekeywords.py Ferruh Mavituna, * for exchanging ideas on the implementation of a couple of features diff --git a/waf/varnish.py b/waf/varnish.py new file mode 100644 index 000000000..fe95cd28b --- /dev/null +++ b/waf/varnish.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +""" +Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/) +See the file 'doc/COPYING' for copying permission +""" + +import re + +from lib.core.enums import HTTP_HEADER +from lib.core.settings import WAF_ATTACK_VECTORS + +__product__ = "Varnish FireWall (OWASP) " + +def detect(get_page): + retval = False + + for vector in WAF_ATTACK_VECTORS: + page, headers, code = get_page(get=vector) + retval = headers.get("X-Varnish") is not None + retval |= re.search(r"varnish\Z", headers.get(HTTP_HEADER.VIA, ""), re.I) is not None + if retval: + break + + return retval