← retour aux snippets

ngrep: capturer HTTP rapidement par motif

Filtrer des paquets contenant un motif texte (Host, URI) sans ouvrir Wireshark.

bash network #ngrep#http#sniff

objectif

Observer un échange HTTP ciblé en quelques secondes.

code minimal

sudo ngrep -d eth0 -W byline 'Host: data.pm' tcp port 80

utilisation

# POST contenant 'token'
sudo ngrep -d any -W byline 'token' tcp port 80

variante(s) utile(s)

# TLS SNI (en clair dans ClientHello)
sudo ngrep -d any -q 'data.pm' port 443

notes

  • fonctionne mal avec HTTP/2 (binaire) et HTTPS (chiffré).
  • préférez tshark pour analyses profondes.