Projects STRLCPY geneva Commits 55402c7e
🤬
  • ■ ■ ■ ■ ■ ■
    plugins/http/client.py
    skipped 46 lines
    47 47   
    48 48   parser.add_argument('--host-header', action='store', default="", help='specifies host header for HTTP request')
    49 49   parser.add_argument('--injected-http-contains', action='store', default="", help='checks if injected http response contains string')
     50 + parser.add_argument('--empty-reseponse-is-censorship', action='store_true', default="", help='if the injected response is empty and constitutes censorship')
    50 51   
    51 52   args, _ = parser.parse_known_args(command)
    52 53   args = vars(args)
    skipped 26 lines
    79 80   try:
    80 81   res = requests.get(url, allow_redirects=False, timeout=3, headers=headers)
    81 82   text = res.text
    82  - headers = "\r\n".join([k + ": " + v for k, v in res.headers.items()])
    83  - logger.debug("Headers from GET request: %s", str(headers))
    84  - logger.debug("Response from GET request: %s", str(text))
    85  - if injected_http:
    86  - logger.debug("Checking for '%s' in response", injected_http)
    87  - # If we need to monitor for an injected response, check that here
    88  - if injected_http and injected_http in (headers + text):
     83 + if not text and args.get("empty_response_is_censorship"):
     84 + logger.debug("Empty response detected and this has been identified as censorship.")
    89 85   fitness -= 90
    90 86   else:
    91  - fitness += 100
     87 + headers = "\r\n".join([k + ": " + v for k, v in res.headers.items()])
     88 + logger.debug("Headers from GET request: %s", str(headers))
     89 + logger.debug("Response from GET request: %s", str(text))
     90 + if injected_http:
     91 + logger.debug("Checking for '%s' in response", injected_http)
     92 + # If we need to monitor for an injected response, check that here
     93 + if injected_http and injected_http in (headers + text):
     94 + fitness -= 90
     95 + else:
     96 + fitness += 100
    92 97   except requests.exceptions.ConnectTimeout as exc:
    93 98   logger.exception("Socket timeout.")
    94 99   fitness -= 100
    skipped 17 lines
Please wait...
Page is in error, reload to recover