def malformed_method(host, host_index, fingerprint):
    malformed_methods = get_malformed_methods()

    for index, method in enumerate(malformed_methods):
        request = Request(host, host_index, logger)
        request.method_line = method
        response = request.submit
        get_characteristics('MALFORMED_' + ('000' + str(index))[-3:], response, fingerprint, host, host_index)
    def malformed_method(host, host_index, logger):
        requests = []

        activities = 'GET', 'HEAD', 'POST', 'PUT'

        malformed_methods_list = []

        for activity in activities:
            malformed_methods = (
                activity,
                activity + '/',
                activity + '/1.0',
                activity + ' / HTTP/123.45',
                activity + ' / HTTP/999.99',
                activity + ' / HTP/1.0',
                activity + ' / HTT/1.0',
                activity + ' / HTTP/7.Q',
                activity + ' / HTTP/1.0X',
                activity + ' /abcdefghijklmnopqrstuvwxyz/.. HTTP/1.0',
                activity + ' /./././././././././././././././ HTTP/1.0',
                activity + ' /.. HTTP/1.0',
                activity + '\t/\tHTTP/1.0',
                activity + '\t/\tHTTP/1.0',
                activity + ' / H',
                activity + ' / ' + 'HTTP/' + '1' * 1000 + '.0',
                activity + ' FTP://abcdefghi HTTP/1.0',
                activity + ' C:\ HTTP/1.0',
                ' ' * 1000 + activity + ' / HTTP/1.0',
                '\n' + activity + ' / HTTP/1.0',
            )

            malformed_methods_list += malformed_methods

        malformed_activity_independent = ('GET GET GET', 'HELLO',
                                          '%47%45%54 / HTTP/1.0',
                                          'GEX\bT / HTTP/1.0')

        malformed_methods_list += malformed_activity_independent

        for index, method in enumerate(malformed_methods_list):
            request = Request(host,
                              host_index,
                              logger,
                              name='malformed/malformed_' + str(index))
            request.method_line = method
            requests.append(request)

        return requests
 def empty_uri(host, host_index, logger):
     return [
         Request(host,
                 host_index,
                 logger,
                 local_uri='/ABCDEFG',
                 name='empty_uri')
     ]
 def unknown_method(host, host_index, logger):
     return [
         Request(host,
                 host_index,
                 logger,
                 method='ABCDEFG',
                 name='unknown_method')
     ]
 def default_options(host, host_index, logger):
     return [
         Request(host,
                 host_index,
                 logger,
                 method='OPTIONS',
                 name='default_options')
     ]
def default_get(host, host_index, fingerprint):
    request = Request(host, host_index, logger)
    response = request.submit

    if response.response_code == NO_RESPONSE_CODE:
        raise ValueError('default_get failed')
    else:
        get_characteristics('default_get', response, fingerprint, host, host_index)
def unauthorized_activity(host, host_index, fingerprint):
    activities = ('OPTIONS', 'TRACE', 'GET', 'HEAD', 'DELETE',
                  'PUT', 'POST', 'COPY', 'MOVE', 'MKCOL',
                  'PROPFIND', 'PROPPATCH', 'LOCK', 'UNLOCK',
                  'SEARCH')

    for activity in activities:
        request = Request(host, host_index, logger, method=activity)
        response = request.submit
        get_characteristics('unauthorized_activity_' + activity, response, fingerprint, host, host_index)
    def unauthorized_activity(host, host_index, logger):
        requests = []
        activities = ('OPTIONS', 'TRACE', 'GET', 'HEAD', 'DELETE', 'PUT',
                      'POST', 'COPY', 'MOVE', 'MKCOL', 'PROPFIND', 'PROPPATCH',
                      'LOCK', 'UNLOCK', 'SEARCH')

        for activity in activities:
            requests.append(
                Request(host,
                        host_index,
                        logger,
                        method=activity,
                        name='unauthorized_activity/unauthorized_activity_' +
                        activity))

        return requests
 def default_get(host, host_index, logger):
     return [Request(host, host_index, logger, name='default_get')]
 def long_content_length(host, host_index, logger):
     request = Request(host, host_index, logger, name='long_content_length')
     request.add_header('Content-Length', str(sys.maxint))
     request.body = 'abcdefgh'
     return [request]
 def unavailable_accept(host, host_index, logger):
     request = Request(host, host_index, logger, name='unavailable_request')
     request.add_header('Accept', 'abcd/efgh')
     return [request]
Ejemplo n.º 12
0
def unknown_method(host, host_index, fingerprint):
    request = Request(host, host_index, logger, method='ABCDEFG')
    response = request.submit
    get_characteristics('unknown_method', response, fingerprint, host, host_index)
Ejemplo n.º 13
0
def default_options(host, host_index, fingerprint):
    request = Request(host, host_index, logger, method='OPTIONS')
    response = request.submit
    get_characteristics('default_options', response, fingerprint, host, host_index)
Ejemplo n.º 14
0
def long_content_length(host, host_index, fingerprint):
    request = Request(host, host_index, logger)
    request.add_header('Content-Length', str(sys.maxint))
    request.body = 'abcdefgh'
    response = request.submit
    get_characteristics('long_content_length', response, fingerprint, host, host_index)
Ejemplo n.º 15
0
def unavailable_accept(host, host_index, fingerprint):
    request = Request(host, host_index, logger)
    request.add_header('Accept', 'abcd/efgh')
    response = request.submit
    get_characteristics('unavailable_accept', response, fingerprint, host, host_index)
Ejemplo n.º 16
0
def empty_uri(host, host_index, fingerprint):
    request = Request(host, host_index, logger, local_uri='/ABCDEFG')
    response = request.submit
    get_characteristics('empty_uri', response, fingerprint, host, host_index)