Exemplo n.º 1
0
def get_feeds():
    clio = Clio()
    options = paginate_options(limit=10)
    options['order_by'] = '-_id'
    count,columns,feeds = clio.hpfeed.get_payloads(options, request.args.to_dict())
    channel_list = clio.hpfeed.channel_map.keys()
    feeds = mongo_pages(feeds, count, limit=10)
    return render_template('ui/feeds.html', feeds=feeds, columns=columns, channel_list=channel_list, view='ui.get_feeds', **request.args.to_dict())
Exemplo n.º 2
0
def get_sensors():
    sensors = Sensor.query.all()
    total = Sensor.query.count()
    # Paginating the list.
    pag = paginate_options(limit=10)
    sensors = sensors[pag['skip']:pag['skip'] + pag['limit']]
    # Using mongo_pages because it expects paginated iterables.
    sensors = mongo_pages(sensors, total, limit=10)
    return render_template('ui/sensors.html', sensors=sensors,
                           view='ui.get_sensors', pag=pag)
Exemplo n.º 3
0
def get_sensors():
    sensors = Sensor.query.all()
    total = Sensor.query.count()
    # Paginating the list.
    pag = paginate_options(limit=10)
    sensors = sensors[pag['skip']:pag['skip'] + pag['limit']]
    # Using mongo_pages because it expects paginated iterables.
    sensors = mongo_pages(sensors, total, limit=10)
    return render_template('ui/sensors.html', sensors=sensors,
                           view='ui.get_sensors', pag=pag)
Exemplo n.º 4
0
def get_attacks():
    clio = Clio()
    options = paginate_options(limit=10)
    options['order_by'] = '-timestamp'
    total = clio.session.count(**request.args.to_dict())
    sessions = clio.session.get(
            options=options, **request.args.to_dict())
    sessions = mongo_pages(sessions, total, limit=10)
    return render_template('ui/attacks.html', attacks=sessions,
                           sensors=Sensor.query, view='ui.get_attacks',
                           get_flag_ip=get_flag_ip, get_sensor_name=get_sensor_name, **request.args.to_dict())