hhucn / webvulnscan

automated web application vulnerability scanner
MIT License
38 stars 27 forks source link

Correct and simplify breach.py #56

Closed phihag closed 11 years ago

phihag commented 11 years ago

Currently, breach.py relies on the downloading framework using gzip. Make that explicit and/or download the page with these parameters.

Also, we can simplify the implementation. For example,

def check_for_compression(headers):
    if "Content-Encoding" in headers:
        encoding = headers["Content-Encoding"]
        return "GZIP" in encoding or "gzip" in encoding
    else:
        return False

can be written as

check_for_compression = lambda hdr: 'gzip' in hdr.get('Content-Encoding', '').lower()

Additionally, the return mechanism of check_for_secret is overly complicated and probably incorrect.

phihag commented 11 years ago

Fixed.