@app.route('/read', methods=['GET'])
def read():
    source_ip = request.args.get('source_ip')
    destination_host = request.args.get('destination_host')

    # Get the sniffer, if exists, else return status 404
    try:
        sniffer = sniffers[(source_ip, destination_host)]
    except KeyError:
        msg = '(get_sniff) 404 Not Found: Sniffer (source_ip : {}, destination_host: {})'.format(source_ip, destination_host)
        logger.warning(msg)
        return msg, 404

    # Use the sniffer's get_capture() method to get the captured packets
    try:
        capture = sniffer.get_capture()
    except AssertionError, err:
        logger.warning(err)
        return str(err), 422

    assert('capture' in capture)

    logger.debug('Got capture with length: {}'.format(len(capture['capture'])))

    return jsonify(**capture), 200
Get the captured packets of a specific sniffer.
dataset/ETHPy150Open dionyziz/rupture/sniffer/sniff.py/read