Beispiel #1
0
def index(request):
    """ GET request to mongoengine db queries """

    query = dict([(str(param), str(val).lower()) for param, val in request.GET.iteritems() if val])

    search_time = 0
    loglines = []
    db_results = ''
    if 'search' in query:
        if query['search'] == 'search':

            # generic pymongo query from utilities
            start = time.time()
            loglines = pymongo_query(query, 'greylist', settings.LOCAL)
            search_time = start - time.time()

        # greylist database search
        elif query['search'] == 'database query':
            del query['date']
            del query['search']

            start = time.time()
            db_results = Greylist.objects.filter(**format_query_input(query))
            search_time = start - time.time()

    dates = get_log_window('greylist', settings.LOCAL)
    return render_to_response('greylist/index.html', {'db_results': db_results, 'query': format_query_output(query), 'dates':dates, 'loglines':loglines, 'time':search_time})
Beispiel #2
0
def index(request):
    """ GET request to mongoengine db queries """

    query = dict([(str(param), str(val).lower())
                  for param, val in request.GET.iteritems() if val])

    search_time = 0
    loglines = []
    db_results = ''
    if 'search' in query:
        if query['search'] == 'search':

            # generic pymongo query from utilities
            start = time.time()
            loglines = pymongo_query(query, 'greylist', settings.LOCAL)
            search_time = start - time.time()

        # greylist database search
        elif query['search'] == 'database query':
            del query['date']
            del query['search']

            start = time.time()
            db_results = Greylist.objects.filter(**format_query_input(query))
            search_time = start - time.time()

    dates = get_log_window('greylist', settings.LOCAL)
    return render_to_response(
        'greylist/index.html', {
            'db_results': db_results,
            'query': format_query_output(query),
            'dates': dates,
            'loglines': loglines,
            'time': search_time
        })
Beispiel #3
0
def index(request):
    """ GET request to mongoengine db queries """

    query = dict([(str(param), str(val).lower()) for param, val in request.GET.iteritems() if val])

    # generic pymongo query from utilities
    start = time.time()
    loglines = pymongo_query(query, 'dhcp', settings.LOCAL)
    search_time = time.time() - start

    dates = get_log_window('dhcp', settings.LOCAL)
    return render_to_response('dhcp/index.html', {'query': format_query_output(query), 'dates':dates, 'loglines':loglines, 'time':search_time})
Beispiel #4
0
def index(request):

    query = dict([(str(param), str(val).lower())
                  for param, val in request.GET.iteritems() if val])

    # generic pymongo query from utilities
    start = time.time()
    loglines = pymongo_query(query, 'aruba', settings.LOCAL)
    search_time = time.time() - start

    dates = get_log_window('aruba', settings.LOCAL)

    return render_to_response(
        'aruba/index.html', {
            'query': format_query_output(query),
            'dates': dates,
            'time': search_time,
            'loglines': loglines
        })