•
Capturar el tráfico USB
La herramienta tcpdump usa la librería libpcap para capturar tráfico, ésta no se limita a poder capturar tráfico de red. También podemos usarla para capturar el tráfico de los dispositivos USB.
Mediante la opción -D podemos ver la interfaces que podemos usar para capturar paquetes:
# tcpdump -D 1.eth0 2.wlan0 3.tun0 4.tap0 5.usbmon1 (USB bus number 1) 6.usbmon2 (USB bus number 2) 7.any (Pseudo-device that captures on all interfaces) 8.lo
Si no vemos las interfaces usbmon deberemos comprobar si tenemos cargado el modulo usbmon:
# modprobe usbmon
Para capturar el tráfico simplemente deberemos usar las típicas opciones de tcpdump como si fuera otra interfaz de red:
# tcpdump -nni usbmon1 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on usbmon1, link-type USB_LINUX_MMAPPED (USB with padded Linux header), capture size 65535 bytes 21:10:40.697206 CONTROL SUBMIT to 1:1:0 21:10:40.697213 CONTROL COMPLETE from 1:1:0 21:10:40.697217 CONTROL SUBMIT to 1:1:0 21:10:40.697220 CONTROL COMPLETE from 1:1:0 21:10:40.697221 CONTROL SUBMIT to 1:1:0 (...)
Cuando insertemos in dispositivo USB podremos ver como aparece su identificación:
19:46:50.110047 CONTROL SUBMIT to 2:8:0 19:46:50.110529 CONTROL COMPLETE from 2:8:0 0x0000: 1201 0002 0000 0040 dc05 61a7 0011 0102 .......@..a..... 0x0010: 0301 .. 19:46:50.110558 CONTROL SUBMIT to 2:8:0 19:46:50.111024 CONTROL COMPLETE from 2:8:0 0x0000: 0902 2000 0101 0080 32 ........2 19:46:50.111046 CONTROL SUBMIT to 2:8:0 19:46:50.111522 CONTROL COMPLETE from 2:8:0 0x0000: 0902 2000 0101 0080 3209 0400 0002 0806 ........2....... 0x0010: 5000 0705 8102 0002 ff07 0502 0200 02ff P............... 19:46:50.111549 CONTROL SUBMIT to 2:8:0 19:46:50.112024 CONTROL COMPLETE from 2:8:0 0x0000: 0403 0904 .... 19:46:50.112051 CONTROL SUBMIT to 2:8:0 19:46:50.112542 CONTROL COMPLETE from 2:8:0 0x0000: 1603 4a00 4400 2000 4600 6900 7200 6500 ..J.D...F.i.r.e. 0x0010: 4600 6c00 7900 F.l.y. 19:46:50.112563 CONTROL SUBMIT to 2:8:0 19:46:50.113067 CONTROL COMPLETE from 2:8:0 0x0000: 0c03 4c00 6500 7800 6100 7200 ..L.e.x.a.r. 19:46:50.113093 CONTROL SUBMIT to 2:8:0 19:46:50.113923 CONTROL COMPLETE from 2:8:0 0x0000: 2a03 4800 5500 3600 5400 4d00 4500 5a00 *.H.U.6.T.M.E.Z. 0x0010: 4c00 5900 4200 3700 3500 4100 4c00 3400 L.Y.B.7.5.A.L.4. 0x0020: 4a00 3400 5500 3000 5700 J.4.U.0.W. 19:46:50.114197 CONTROL SUBMIT to 2:8:0 19:46:50.114406 CONTROL COMPLETE from 2:8:0
Que luego podremos ver en el lsusb:
# lsusb (...) Bus 002 Device 008: ID 05dc:a761 Lexar Media, Inc.
O en el caso que se trate de un dispositivo de almacenamiento y creemos un fichero también lo podremos ver:
19:16:37.590048 BULK SUBMIT to 2:10:2
0x0000: 416a 006f 0072 0064 0069 000f 0059 0000 Aj.o.r.d.i...Y..
0x0010: ffff ffff ffff ffff ffff 0000 ffff ffff ................
0x0020: 4a4f 5244 4920 2020 2020 2020 0000 117a JORDI..........z
0x0030: 693f 693f 0000 117a 693f 0300 0f00 0000 i?i?...zi?......
0x0040: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
Relacionados
Imprimir
Deja un comentario: