Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Concatenadores
contains —> Contener (se usa cuando no sabemos exáctamente todo. Más abajo hay un ejemplo).
== —> Comparación (igual)
!= —> Comparación (desigual)
Nota: Cuando se trata de igualdades, siempre hay dos símbolos. Si la igualdad es un número, se
pone este directamente. Si es una cadena de texto, se ha de poner con comillas.
Protocolos
Estos filtros están basados en las librerías pcap. Los filtros son los mismos que podemos aplicar
para Windump / TCPDump y que hemos visto aquí.
Así pues, para estos filtros, solo estudiaremos algunos ejemplos y como aplicarlos a Wireshark.
Los filtros de captura son los que se establecen para mostrar solo los paquetes de cumplan los
requisitos indicados en el filtro. Si no establecemos ninguno, Wireshark capturará todo el tráfico y
lo presentará en la pantalla principal. Aún así podrémos establecer filtros de visualización (display
filter) para que nos muestre solo el trafíco deseado.
En el campo Capture Filter introducimos el filtro o pulsamos el botón Capture Filter para filtros
predefinidos:
Combinación de Filtros.
Negación: ! ó not
Unión o Concatenación: && ó and
Alternancia:|| ó or
Vamos ahora a los filtros:
Los filtros de visualización establecen un criterio de filtro sobre las paquetes que estamos
capturano y que estamos visualizando en la pantalla principal de Wireshark. Al aplicar el filtro en la
pantalla principal de Wireshark aparecerá solo el trafíco filtrado a través del filtro de visualización.
Lo podemos usar también para filtrar el contenido de una captura a través de un fichero pcap (
archivo.pcap ).
Comparando Filtros.
Igual a: eq ó ==
No igual: ne ó !=
Mayor que:gt ó >
Menor que: lt ó <
Mayor o igual: ge ó >=
Menor o igual: le ó <=
Combinando Filtros.
Negación: ! ó not
Unión o Concatenación: && ó and
Alternancia:|| ó or
Otro operadores.
Si queremos aplicar otro filtro pulsamos el botón Clear, introducimos el filtro y pulsamos Apply.
Ejemplos de filtros:
Filtros de visualización
Ejemplos
Sintaxis Significado
ip.addr == 192.168.1.40Visualizar tráfico por host 192.168.1.40
ip.addr != 192.168.1.25 Visualizar todo el tráfico excepto host 192.168.1.25
ip.dst == 192.168.1.30 Visualizar por host destino192.168.1.30
ip.src == 192.168.1.30 Visualizar por host origen 192.168.1.30
ip Visualiza todo el tráfico IP
tcp.port ==143 Visualiza todo el tráfico origen y destino puerto 143
ip.addr == 192.168.1.30 and tcp.port == 143 Visualiza todo el tráfico origen y destino puerto
143 relativo al host 192.168.1.30
http contains “http://www.terra.com“ Visualiza el trafico origen y destino www.terra.com.
Visualiza los paquetes que contienen www.terra.com en el contenido en protocolo http.
frame contains “@miempresa.es” Visualizamos todos los correos con origen y destivo al
dominio miempresa.es, incluyendo usuarios, pass, etc
icmp[0:1] == 08 Filtro avanzado con el que visualizamos todo el tráfico icmp de tipo echo request
ip.ttl == 1 Visualiza todo los paquetes IP cuyo campo TTL sea igual a 1
tcp.windows_size != 0 Visualizar todos los paquetes cuyos campo Tamaño de Ventana del
segmento TCP sea distinto de 0
ip.tos == x Visualiza todo los paquetes IP cuyo campo TOS sea igual a x
ip.flags.df == x Visualiza todo los paquetes IP cuyo campo DF sea igual a x
udp.port == 53 Visualiza todo el trafico UDP puerto 53
tcp contains “terra.com” Visualizamos segmentos TCP conteniendo la cadena terra.com
Default Capture Filters
Wireshark tries to determine if it's running remotely (e.g. via SSH or Remote Desktop), and if so
sets a default capture filter that should block out the remote session traffic. It does this by
checking environment variables in the following order:
Environment Variable
Resultant Filter
SSH_CONNECTION
not (tcp port srcport and addr_family host srchost and tcp port dstport and addr_family host
dsthost)
SSH_CLIENT
not (tcp port srcport and addr_family host srchost and tcp port dstport)
REMOTEHOST
not addr_family host host
DISPLAY
not addr_family host host
CLIENTNAME
not tcp port 3389
DisplayFilters
Wireshark uses display filters for general packet filtering while viewing and for its ColoringRules.
The basics and the syntax of the display filters are described in the User's Guide.
The master list of display filter protocol fields can be found in the display filter reference.
If you need a display filter for a specific protocol, have a look for it at the ProtocolReference.
Examples
tcp.port eq 25 or icmp
Show only traffic in the LAN (192.168.x.x), between workstations and servers -- no Internet:
ls_ads.opnum==0x09
Match packets containing the (arbitrary) 3-byte sequence 0x81, 0x60, 0x03 at the beginning of
the UDP payload, skipping the 8-byte UDP header. Note that the values for the byte sequence
implicitly are in hexadecimal only.(Useful for matching homegrown packet protocols.)
udp[8:3]==81:60:03
The "slice" feature is also useful to filter on the vendor identifier part (OUI) of the MAC address, see
the Ethernet page for details. Thus you may restrict the display to only packets from a specific
device manufacturer. E.g. for DELL machines only:
eth.addr[0:3]==00:06:5B
It is also possible to search for characters appearing anywhere in a field or protocol by using the
matches operator.
Match packets that contains the 3-byte sequence 0x81, 0x60, 0x03 anywhere in the UDP header or
payload:
Match packets where SIP To-header contains the string "a1762" anywhere in the header:
The matches operator makes it possible to search for text in string fields and byte sequences using
a regular expression, using Perl regular expression syntax. Note: Wireshark needs to be built with
libpcre in order to be able to use the matches operator.
Match HTTP requests where the last characters in the uri are the characters "gl=se":
Note: The $ character is a PCRE punctuation character that matches the end of a string, in this
case the end of http.request.uri field.
Filter by a protocol ( e.g. SIP ) and filter out unwanted IPs:
Gotchas
Some filter fields match against multiple protocol fields. For example, "ip.addr" matches against
both the IP source and destination addresses in the IP header. The same is true for "tcp.port",
"udp.port", "eth.addr", and others. It's important to note that
ip.addr == 10.43.54.65
is equivalent to
This can be counterintuitive in some cases. Suppose we want to filter out any traffic to or from
10.43.54.65. We might try the following:
ip.addr != 10.43.54.65
which is equivalent to
This translates to "pass all traffic except for traffic with a source IPv4 address of 10.43.54.65 and a
destination IPv4 address of 10.43.54.65", which isn't what we wanted.
! ( ip.addr == 10.43.54.65 )
which is equivalent to
This translates to "pass any traffic except with a source IPv4 address of 10.43.54.65 or a
destination IPv4 address of 10.43.54.65", which is what we wanted.
See Also
Filtros basados en hosts
Sintaxis Significado
Ejemplos
Sintaxis Significado
Ejemplos
not port 21 and not Captura todos los paquetes excepto origen y
port 80 destino puertos 21 y 80
Ejemplos
Sintaxis Significado
dst net net Captura todo el trafico con destino red net
src net net Captura todo el trafico con origen red net
Ejemplos
Captura todo el trafico con origen y destino
net 192.168.1.0 subred 1.0
Aunque son filtros con ejemplos para Windump y TCPdump, los siguientes estudis
de filtros avanzados se puedan aplicar sin problemas en Wireshark. Filtros
avanzados aquí,aquí y aquí.
Filtros de Visualización (Display Filter)
Los filtros de visualización establecen un criterio de filtro sobre las paquetes que
estamos capturano y que estamos visualizando en la pantalla principal de
Wireshark. Al aplicar el filtro en la pantalla principal de Wireshark aparecerá solo
el trafíco filtrado a través del filtro de visualización.
Lo podemos usar también para filtrar el contenido de una captura a través de un
fichero pcap ( archivo.pcap ).
Comparando Filtros.
Igual a: eq ó ==
No igual: ne ó !=
Mayor que:gt ó >
Menor que: lt ó <
Mayor o igual: ge ó >=
Menor o igual: le ó <=
Combinando Filtros.
Negación: ! ó not
Unión o Concatenación: && ó and
Alternancia:|| ó or
Otro operadores.
Contains: Realizamos una busqueda por la cadena contains
Como aplicar los Filtros.
Ejemplos
Sintaxis Significado
ip.addr
== 192.168.1.30and Visualiza todo el tráfico origen y destino
tcp.port == 143 puerto 143 relativo al gost 192.168.1.30
ilter Traffic Description
eth all Ethernet based
to and from Ethernet MAC address
eth.addr==08.00.08.15.ca.fe 08:00:08:15:ca:fe
all except to and from Ethernet MAC
!(eth.addr==08.00.08.15.ca.fe) address 08:00:08:15:ca:fe
eth.dst==ff:ff:ff:ff:ff:ff Ethernet Broadcast only
eth.dst!=ff:ff:ff:ff:ff:ff all except Ethernet Broadcast
Ethernet Multicast only (least
significant bit of first address byte
(eth.dst[0] & 1) set)
all except Ethernet Multicast (least
significant bit of first address byte
!(eth.dst[0] & 1) not set)
Note: the Ethernet Broadcast address (ff:ff:ff:ff:ff:ff) is per definition a Multicast
one (least significant bit of first address byte set). If you want to see only
Multicasts, you have to filter out the Broadcasts as
well (eth.dst[0] & 1) && eth.dst!=ff:ff:ff:ff:ff:ff
http://www.youtube.com/watch?v=7zBccPXAhJY
http://www.youtube.com/watch?NR=1&v=dEkE6mCeWws&feature=endscreen
ip.addr == 10.0.0.1 [Sets a filter for any packet with 10.0.0.1, as either the source or dest]
2. ip.addr==10.0.0.1 && ip.addr==10.0.0.2 [sets a conversation filter between the two defined IP
addresses]
3. http or dns [sets a filter to display all http and dns]
4. tcp.port==4000 [sets a filter for any TCP packet with 4000 as a source or dest port]
5. tcp.flags.reset==1 [displays all TCP resets]
6. http.request [displays all HTTP GET requests]
7. tcp contains traffic [displays all TCP packets that contain the word ‘traffic’. Excellent when
searching on a specific string or user ID]
8. !(arp or icmp or dns) [masks out arp, icmp, dns, or whatever other protocols may be background
noise. Allowing you to focus on the traffic of interest]
9. udp contains 33:27:58 [sets a filter for the HEX values of 0x33 0x27 0x58 at any offset]
10. tcp.analysis.retransmission [displays all retransmissions in the trace. Helps when tracking down
slow application performance and packet loss]