| skipped 38 lines |
39 | 39 | | parser.add_argument('--host-header', action='store', default="", help='specifies host header for HTTP request') |
40 | 40 | | parser.add_argument('--injected-http-contains', action='store', |
41 | 41 | | default="", help='checks if injected http response contains string') |
| 42 | + | parser.add_argument('--valid-http-contains', action='store', |
| 43 | + | default="", help='checks if http response contains the given string. ' |
| 44 | + | 'if not, the connection is evaluated as broken') |
42 | 45 | | |
43 | 46 | | args, _ = parser.parse_known_args(command) |
44 | 47 | | args = vars(args) |
| skipped 28 lines |
73 | 76 | | # If we need to monitor for an injected response, check that here |
74 | 77 | | if args.get("injected_http_contains") and args.get("injected_http_contains") in res.text: |
75 | 78 | | fitness -= 90 |
| 79 | + | elif args.get("valid_http_contains"): |
| 80 | + | if args.get("valid_http_contains") in res.text: |
| 81 | + | # valid response found |
| 82 | + | fitness += 100 |
| 83 | + | else: |
| 84 | + | fitness -= 120 |
| 85 | + | logger.debug("valid response needed, but not found -> connection broke\n") |
76 | 86 | | else: |
77 | 87 | | fitness += 100 |
78 | 88 | | except requests.exceptions.ConnectTimeout: |
| skipped 19 lines |