def tshark_read(
    device,
    capture_file,
    packet_details=False,
    filter_str=None,
    timeout=60,
    rm_file=True,
):
    """Read the packets via tshark

    :param device: lan or wan...
    :type device: Object
    :param capture_file: Filename in which the packets were captured
    :type capture_file: String
    :param packet_details: output of packet tree (Packet Details)
    :type packet_details: Bool
    :param filter_str: capture filter, ex. 'data.len == 1400'
    :type filter_str: String
    :param timeout: timeout after executing the read command; default is 30 seconds
    :type timeout: int
    :param rm_file: Flag to remove capture file
    :type rm_file: bool
    """
    command_string = "tshark -r {} ".format(capture_file)
    if packet_details:
        command_string += "-V "
    if filter_str:
        command_string += "{}".format(filter_str)

    device.sendline(command_string)
    device.expect(device.prompt, timeout=timeout)
    output = device.before
    if rm_file:
        device.sudo_sendline("rm %s" % (capture_file))
        device.expect(device.prompt)
    return output