Skip to content
KitploitKITPLOIT
FerramentasBlog
Enviar
FerramentasBlog
Enviar

Ferramentas de Hacking, PenTest e Cibersegurança para o seu Arsenal de Segurança!

Kitploit é um diretório de ferramentas de hacking, cibersegurança e pentesting. Descubra as últimas atualizações de projetos para encontrar vulnerabilidades, analisar sistemas, automatizar testes e fortalecer sua segurança.

··Feeds·Contato·Privacidade·© 2026 Kitploit

Diretório de Ferramentas

Categorias

Ver todas as categorias
Loading categories
ptcpdump — Analisador de pacotes baseado em eBPF que captura tráfego de rede com anotação automática de metadados de processos, contêineres e pods Kubernetes, suportando filtragem compatível com tcpdump e saída PcapNG. | Kitploit
Ferramentas/GitHubGitHub/mozillazg/ptcpdump
Sniffing e Análise de PacotesSegurança de ContêineresAnálise Dinâmica (Sandboxing)Forensia de RedeAnálise ForenseSegurança de RedeForensia DigitalSegurança na Nuvem
GitHubmozillazg/ptcpdump

ptcpdump

Analisador de pacotes baseado em eBPF que captura tráfego de rede com anotação automática de metadados de processos, contêineres e pods Kubernetes, suportando filtragem compatível com tcpdump e saída PcapNG.

1.3k676há 4 mesesRevisado pelo Kitploit
Ver Repositório

Mais Populares

Ver todos →

Descubra as ferramentas mais usadas pela nossa comunidade.

Explore todas as ferramentas

Navegue pela nossa coleção de ferramentas

Ver todas as ferramentas →
Compartilhar

ptcpdump

amd64-e2e arm64-e2e Release Coveralls Inglês | 中文

ptcpdump é um analisador de pacotes compatível com tcpdump alimentado por eBPF, anotando automaticamente pacotes com metadados de processo/contêiner/pod quando detectável. Inspirado por jschwinger233/skbdump.

Índice

  • Funcionalidades
  • Instalação
    • Requisitos
  • Uso
  • Exemplos de comandos
  • Exemplo de saída
  • Execução com Docker
  • Backend
  • Flags
  • Comparação com tcpdump
  • Desenvolvimento
    • Dependências
    • Construção
  • Projetos Relacionados
    • Flownix
  • Features

    • 🔍 Captura de pacotes consciente de processos/contêineres/pods.
    • 📦 Filtrar por: --pid (processo), --pname (nome do processo), --container-id (contêiner), --pod-name (pod).
    • 🎯 Flags compatíveis com tcpdump (-i, -w, -c, -s, -n, -C, -W, -A, e mais).
    • 📜 Suporta sintaxe pcap-filter(7) como o tcpdump.
    • 🌳 Saída similar ao tcpdump + contexto de processo/contêiner/pod.
    • 📑 Modo verbose mostra metadados detalhados de processos e contêineres/pods.
    • 💾 PcapNG com metadados embutidos (pronto para Wireshark).
    • 🌐 Captura entre namespaces de rede (--netns).
    • 🚀 Filtragem BPF no espaço do kernel (baixa sobrecarga, reduz uso de CPU).
    • ⚡ Integração com runtime de contêiner (Docker, containerd).

    Installation

    Você pode baixar o executável estaticamente ligado para x86_64 e arm64 pela página de releases.

    Requirements

    Linux kernel >= 5.2 (compilado com suporte a BPF e BTF).

    ptcpdump opcionalmente requer debugfs. Ele deve ser montado em /sys/kernel/debug. Caso a pasta esteja vazia, pode ser montada com:

    root@kitploit:~
    mount -t debugfs none /sys/kernel/debug
    

    A seguinte configuração de kernel é necessária. Construir como módulos também é possível.

    OpçãoBackendNota
    CONFIG_BPF=yambosObrigatório
    CONFIG_BPF_SYSCALL=yambosObrigatório
    CONFIG_DEBUG_INFO=yambosObrigatório
    CONFIG_DEBUG_INFO_BTF=yambosObrigatório
    CONFIG_KPROBES=yambosObrigatório
    CONFIG_KPROBE_EVENTS=yambosObrigatório
    CONFIG_TRACEPOINTS=yambosObrigatório
    CONFIG_PERF_EVENTS=yambosObrigatório
    CONFIG_NET=yambosObrigatório
    CONFIG_NET_SCHED=ytcObrigatório
    CONFIG_NET_CLS_BPF=ytcObrigatório
    CONFIG_NET_ACT_BPF=ytcObrigatório
    CONFIG_NET_SCH_INGRESS=ytcObrigatório
    CONFIG_CGROUPS=ycgroup-skbObrigatório
    CONFIG_CGROUP_BPF=ycgroup-skbObrigatório
    CONFIG_FILTER=ysocket-filterObrigatório
    CONFIG_BPF_TRAMPOLINE=ytp-btfObrigatório
    CONFIG_SECURITY=yambosOpcional (Recomendado)
    CONFIG_BPF_TRAMPOLINE=yambosOpcional (Recomendado)
    CONFIG_SOCK_CGROUP_DATA=yambosOpcional (Recomendado)
    CONFIG_BPF_JIT=yambosOpcional (Recomendado)
    CONFIG_CGROUP_BPF=ytc, tp-btf, socket-filterOpcional (Recomendado)
    CONFIG_CGROUPS=ytc, tp-btf, socket-filterOpcional (Recomendado)

    Você pode usar zgrep $OPTION /proc/config.gz para validar se uma opção está habilitada.

    🔝

    Usage

    Example commands

    Filtrar como o tcpdump:

    root@kitploit:~
    sudo ptcpdump -i eth0 tcp
    sudo ptcpdump -i eth0 -A -s 0 -n -v tcp and port 80 and host 10.10.1.1
    sudo ptcpdump -i any -s 0 -n -v -C 100MB -W 3 -w test.pcapng 'tcp and port 80 and host 10.10.1.1'
    sudo ptcpdump -i eth0 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0'
    

    Múltiplas interfaces:

    root@kitploit:~
    sudo ptcpdump -i eth0 -i lo
    

    Filtrar por processo ou usuário:

    root@kitploit:~
    sudo ptcpdump -i any --pid 1234 --pid 233 -f
    sudo ptcpdump -i any --pname curl
    sudo ptcpdump -i any --uid 1000
    

    Capturar por processo executando programa alvo:

    root@kitploit:~
    sudo ptcpdump -i any -- curl ubuntu.com
    

    Filtrar por contêiner ou pod:

    root@kitploit:~
    sudo ptcpdump -i any --container-id 36f0310403b1
    sudo ptcpdump -i any --container-name test
    sudo ptcpdump -i any --pod-name test.default
    

    Salvar dados em formato PcapNG:

    root@kitploit:~
    sudo ptcpdump -i any -w demo.pcapng
    sudo ptcpdump -i any -w - port 80 | tcpdump -n -r -
    sudo ptcpdump -i any -w - port 80 | tshark -r -
    

    Capturando interfaces em outros namespaces de rede:

    root@kitploit:~
    sudo ptcpdump -i lo --netns /run/netns/foo --netns /run/netns/bar
    sudo ptcpdump -i any --netns /run/netns/foobar
    sudo ptcpdump -i any --netns /proc/26/ns/net
    

    🔝

    Example output

    Padrão:

    root@kitploit:~
    09:32:09.718892 vethee2a302f wget.3553008 In IP 10.244.0.2.33426 > 139.178.84.217.80: Flags [S], seq 4113492822, win 64240, length 0, ParentProc [python3.834381], Container [test], Pod [test.default]
    09:32:09.718941 eth0 wget.3553008 Out IP 172.19.0.2.33426 > 139.178.84.217.80: Flags [S], seq 4113492822, win 64240, length 0, ParentProc [python3.834381], Container [test], Pod [test.default]
    

    Com -q:

    root@kitploit:~
    09:32:09.718892 vethee2a302f wget.3553008 In IP 10.244.0.2.33426 > 139.178.84.217.80: tcp 0, ParentProc [python3.834381], Container [test], Pod [test.default]
    09:32:09.718941 eth0 wget.3553008 Out IP 172.19.0.2.33426 > 139.178.84.217.80: tcp 0, ParentProc [python3.834381], Container [test], Pod [test.default]
    

    Com -v:

    root@kitploit:~
    13:44:41.529003 eth0 In IP (tos 0x4, ttl 45, id 45428, offset 0, flags [DF], proto TCP (6), length 52)
        139.178.84.217.443 > 172.19.0.2.42606: Flags [.], cksum 0x5284, seq 3173118145, ack 1385712707, win 118, options [nop,nop,TS val 134560683 ecr 1627716996], length 0
        Process (pid 553587, cmd /usr/bin/wget, args wget kernel.org)
        User (uid 1000)
        ParentProc (pid 553296, cmd /bin/sh, args sh)
        Container (name test, id d9028334568bf75a5a084963a8f98f78c56bba7f45f823b3780a135b71b91e95, image docker.io/library/alpine:3.18, labels {"io.cri-containerd.kind":"container","io.kubernetes.container.name":"test","io.kubernetes.pod.name":"test","io.kubernetes.pod.namespace":"default","io.kubernetes.pod.uid":"9e4bc54b-de48-4b1c-8b9e-54709f67ed0c"})
        Pod (name test, namespace default, UID 9e4bc54b-de48-4b1c-8b9e-54709f67ed0c, labels {"run":"test"}, annotations {"kubernetes.io/config.seen":"2024-07-21T12:41:00.460249620Z","kubernetes.io/config.source":"api"})
    

    Usando --context para limitar o contexto a incluir na saída:

    root@kitploit:~
    # --context=process
    09:32:09.718892 vethee2a302f wget.3553008 In IP 10.244.0.2.33426 > 139.178.84.217.80: Flags [S], seq 4113492822, win 64240, length 0
    
    # -v --context=process
    13:44:41.529003 eth0 In IP (tos 0x4, ttl 45, id 45428, offset 0, flags [DF], proto TCP (6), length 52)
        139.178.84.217.443 > 172.19.0.2.42606: Flags [.], cksum 0x5284, seq 3173118145, ack 1385712707, win 118, options [nop,nop,TS val 134560683 ecr 1627716996], length 0
        Process (pid 553587, cmd /usr/bin/wget, args wget kernel.org)
    
    # -v --context=process,parentproc,container,pod
    # or -v --context=process --context=parentproc --context=container --context=pod
    13:44:41.529003 eth0 In IP (tos 0x4, ttl 45, id 45428, offset 0, flags [DF], proto TCP (6), length 52)
        139.178.84.217.443 > 172.19.0.2.42606: Flags [.], cksum 0x5284, seq 3173118145, ack 1385712707, win 118, options [nop,nop,TS val 134560683 ecr 1627716996], length 0
        Process (pid 553587, cmd /usr/bin/wget, args wget kernel.org)
        ParentProc (pid 553296, cmd /bin/sh, args sh)
        Container (name test, id d9028334568bf75a5a084963a8f98f78c56bba7f45f823b3780a135b71b91e95, image docker.io/library/alpine:3.18, labels {"io.cri-containerd.kind":"container","io.kubernetes.container.name":"test","io.kubernetes.pod.name":"test","io.kubernetes.pod.namespace":"default","io.kubernetes.pod.uid":"9e4bc54b-de48-4b1c-8b9e-54709f67ed0c"})
        Pod (name test, namespace default, UID 9e4bc54b-de48-4b1c-8b9e-54709f67ed0c, labels {"run":"test"}, annotations {"kubernetes.io/config.seen":"2024-07-21T12:41:00.460249620Z","kubernetes.io/config.source":"api"})
    

    Com -A:

    root@kitploit:~
    14:44:34.457504 ens33 curl.205562 Out IP 10.0.2.15.39984 > 139.178.84.217.80: Flags [P.], seq 2722472188:2722472262, ack 892036871, win 64240, length 74, ParentProc [bash.180205]
    E..r.,@[email protected].
    .....T..0.P.E..5+g.P.......GET / HTTP/1.1
    Host: kernel.org
    User-Agent: curl/7.81.0
    Accept: */*
    

    Com -x:

    root@kitploit:~
    14:44:34.457504 ens33 curl.205562 Out IP 10.0.2.15.39984 > 139.178.84.217.80: Flags [P.], seq 2722472188:2722472262, ack 892036871, win 64240, length 74, ParentProc [bash.180205]
            0x0000:  4500 0072 de2c 4000 4006 6fbf 0a00 020f
            0x0010:  8bb2 54d9 9c30 0050 a245 a0fc 352b 6707
            0x0020:  5018 faf0 ecfe 0000 4745 5420 2f20 4854
            0x0030:  5450 2f31 2e31 0d0a 486f 7374 3a20 6b65
            0x0040:  726e 656c 2e6f 7267 0d0a 5573 6572 2d41
            0x0050:  6765 6e74 3a20 6375 726c 2f37 2e38 312e
            0x0060:  300d 0a41 6363 6570 743a 202a 2f2a 0d0a
            0x0070:  0d0a
    

    Com -X:

    root@kitploit:~
    14:44:34.457504 ens33 curl.205562 Out IP 10.0.2.15.39984 > 139.178.84.217.80: Flags [P.], seq 2722472188:2722472262, ack 892036871, win 64240, length 74, ParentProc [bash.180205]
            0x0000:  4500 0072 de2c 4000 4006 6fbf 0a00 020f  E..r.,@[email protected].....
            0x0010:  8bb2 54d9 9c30 0050 a245 a0fc 352b 6707  ..T..0.P.E..5+g.
            0x0020:  5018 faf0 ecfe 0000 4745 5420 2f20 4854  P.......GET / HT
            0x0030:  5450 2f31 2e31 0d0a 486f 7374 3a20 6b65  TP/1.1..Host: ke
            0x0040:  726e 656c 2e6f 7267 0d0a 5573 6572 2d41  rnel.org..User-A
            0x0050:  6765 6e74 3a20 6375 726c 2f37 2e38 312e  gent: curl/7.81.
            0x0060:  300d 0a41 6363 6570 743a 202a 2f2a 0d0a  0..Accept: */*..
            0x0070:  0d0a                                     ..
    

    🔝

    Running with Docker

    Imagens Docker para ptcpdump são publicadas em https://quay.io/repository/ptcpdump/ptcpdump.

    root@kitploit:~
    docker run --privileged --rm -t --net=host --pid=host \
      -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
      -v /var/run:/var/run:ro \
      -v /run:/run:ro \
      quay.io/ptcpdump/ptcpdump:latest ptcpdump -i any -c 2 tcp
    

    🔝

    Backend

    ptcpdump suporta especificar uma tecnologia eBPF particular para captura de pacotes através da flag --backend.

    tccgroup-skbsocket-filtertp-btf
    Tipo de Programa eBPFBPF_PROG_TYPE_SCHED_CLSBPF_PROG_TYPE_CGROUP_SKBBPF_PROG_TYPE_SOCKET_FILTERBPF_PROG_TYPE_TRACING
    Dados L2✅❌✅✅
    Através de namespace de rede❌✅❌✅
    Versão do kernel5.2+5.2+5.4+5.5+
    cgroup v2RecomendadoObrigatórioRecomendadoRecomendado

    Se essa flag não for especificada, o padrão é tc.

    • Executando curl http://1.1.1.1 no host:
    • --backend tc:

      root@kitploit:~
      $ sudo ptcpdump -i any --backend tc host 1.1.1.1
      
      12:11:28.009276 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [S], seq 615672474, win 64240, options [mss 1460,sackOK,TS val 2168208063 ecr 0,nop,wscale 7], length 0, ParentProc [bash.321004]
      12:11:28.113779 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [S.], seq 1810787293, ack 615672475, win 64240, options [mss 1460], length 0, ParentProc [bash.321004]
      12:11:28.113852 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672475, ack 1810787294, win 64240, length 0, ParentProc [bash.321004]
      12:11:28.114216 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [P.], seq 615672475:615672545, ack 1810787294, win 64240, length 70, ParentProc [bash.321004]
      12:11:28.115383 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [.], seq 1810787294, ack 615672545, win 64240, length 0, ParentProc [bash.321004]
      12:11:28.534486 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [P.], seq 1810787294:1810787680, ack 615672545, win 64240, length 386, ParentProc [bash.321004]
      12:11:28.534751 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672545, ack 1810787680, win 63854, length 0, ParentProc [bash.321004]
      12:11:28.536982 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [F.], seq 615672545, ack 1810787680, win 63854, length 0, ParentProc [bash.321004]
      12:11:28.538160 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [.], seq 1810787680, ack 615672546, win 64239, length 0, ParentProc [bash.321004]
      12:11:28.642291 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [FP.], seq 1810787680, ack 615672546, win 64239, length 0, ParentProc [bash.321004]
      12:11:28.642511 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672546, ack 1810787681, win 63854, length 0, ParentProc [bash.321004]
      
    • --backend cgroup-skb:

      root@kitploit:~
      $ sudo ptcpdump -i any --backend cgroup-skb host 1.1.1.1
      
      12:11:28.009182 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [S], seq 615672474, win 64240, options [mss 146063 ecr 0,nop,wscale 7], length 0, Thread [curl.402475], ParentProc [bash.321004]
      12:11:28.113815 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [S.], seq 1810787293, ack 615672475, win 64240, gth 0, ParentProc [bash.321004]
      12:11:28.113849 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672475, ack 1810787294, win 64240, ash.321004]
      12:11:28.114212 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [P.], seq 615672475:615672545, ack 1810787294, hread [curl.402475], ParentProc [bash.321004]
      12:11:28.115409 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [.], seq 1810787294, ack 615672545, win 64240, lsh.321004]
      12:11:28.534596 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [P.], seq 1810787294:1810787680, ack 615672545, ParentProc [bash.321004]
      12:11:28.534738 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672545, ack 1810787680, win 63854, ash.321004]
      12:11:28.536967 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [F.], seq 615672545, ack 1810787680, win 63854,.402475], ParentProc [bash.321004]
      12:11:28.538189 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [.], seq 1810787680, ack 615672546, win 64239, lsh.321004]
      12:11:28.642419 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672546, ack 1810787681, win 63854, ash.321004]
      
    • --backend socket-filter:

      root@kitploit:~
      $ sudo ptcpdump -i any --backend socket-filter host 1.1.1.1
      
      12:11:28.009426 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [S], seq 615672474, win 64240, options [mss 146063 ecr 0,nop,wscale 7], length 0, ParentProc [bash.321004]
      12:11:28.113762 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [S.], seq 1810787293, ack 615672475, win 64240, gth 0, ParentProc [bash.321004]
      12:11:28.113861 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672475, ack 1810787294, win 64240, ash.321004]
      12:11:28.114503 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [P.], seq 615672475:615672545, ack 1810787294, arentProc [bash.321004]
      12:11:28.115335 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [.], seq 1810787294, ack 615672545, win 64240, lsh.321004]
      12:11:28.534424 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [P.], seq 1810787294:1810787680, ack 615672545, ParentProc [bash.321004]
      12:11:28.534825 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672545, ack 1810787680, win 63854, ash.321004]
      12:11:28.537088 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [F.], seq 615672545, ack 1810787680, win 63854,bash.321004]
      12:11:28.538153 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [.], seq 1810787680, ack 615672546, win 64239, lsh.321004]
      12:11:28.642247 ens33 curl.402475 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [FP.], seq 1810787680, ack 615672546, win 64239,bash.321004]
      12:11:28.642537 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672546, ack 1810787681, win 63854, ash.321004]
      
    • --backend tp-btf:

      root@kitploit:~
      $ sudo ptcpdump -i any --backend tp-btf host 1.1.1.112:11:28.009353 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [S], seq 615672474, win 64240, options [mss 146063 ecr 0,nop,wscale 7], length 0, ParentProc [bash.321004]
      12:11:28.113739 ens33 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [S.], seq 1810787293, ack 615672475, win 64240, options [mss
      12:11:28.113857 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672475, ack 1810787294, win 64240, ash.321004]
      12:11:28.114225 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [P.], seq 615672475:615672545, ack 1810787294, arentProc [bash.321004]
      12:11:28.115242 ens33 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [.], seq 1810787294, ack 615672545, win 64240, length 0
      12:11:28.534245 ens33 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [P.], seq 1810787294:1810787680, ack 615672545, win 64240, l
      12:11:28.534768 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672545, ack 1810787680, win 63854, ash.321004]
      12:11:28.537038 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [F.], seq 615672545, ack 1810787680, win 63854,bash.321004]
      12:11:28.538129 ens33 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [.], seq 1810787680, ack 615672546, win 64239, length 0
      12:11:28.642088 ens33 In IP 1.1.1.1.80 > 10.0.2.15.48448: Flags [FP.], seq 1810787680, ack 615672546, win 64239, length 0
      12:11:28.642523 ens33 curl.402475 Out IP 10.0.2.15.48448 > 1.1.1.1.80: Flags [.], seq 615672546, ack 1810787681, win 63854, ash.321004]
      
    • Executando curl http://1.1.1.1 em um contêiner docker:
    • --backend tc:

      root@kitploit:~
      $ sudo ptcpdump -i any --backend tc host 1.1.1.1
      
      12:20:31.336397 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [S], seq 3064539219, win 64240, options [mss 1460,sackOK,TS val 1731159046 ecr 0,nop,wscale 7], length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.336533 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [S], seq 3064539219, win 64240, options [mss 1460,sackOK,TS val 1731159046 ecr 0,nop,wscale 7], length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.336794 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [S], seq 3064539219, win 64240, options [mss 1460,sackOK,TS val 1731159046 ecr 0,nop,wscale 7], length 0
      12:20:31.468027 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [S.], seq 488132001, ack 3064539220, win 64240, options [mss 1460], length 0
      12:20:31.467769 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [S.], seq 488132001, ack 3064539220, win 64240, options [mss 1460], length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.467781 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [S.], seq 488132001, ack 3064539220, win 64240, options [mss 1460], length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.468025 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539220, ack 488132002, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.468042 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539220, ack 488132002, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.468061 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [.], seq 3064539220, ack 488132002, win 64240, length 0
      12:20:31.468089 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [P.], seq 3064539220:3064539291, ack 488132002, win 64240, length 71, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.468093 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [P.], seq 3064539220:3064539291, ack 488132002, win 64240, length 71, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.468110 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [P.], seq 3064539220:3064539291, ack 488132002, win 64240, length 71
      12:20:31.468464 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [.], seq 488132002, ack 3064539291, win 64240, length 0
      12:20:31.468535 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132002, ack 3064539291, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.468558 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132002, ack 3064539291, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.575461 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [P.], seq 488132002:488132388, ack 3064539291, win 64240, length 386
      12:20:31.575576 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [P.], seq 488132002:488132388, ack 3064539291, win 64240, length 386, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.575613 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [P.], seq 488132002:488132388, ack 3064539291, win 64240, length 386, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.575877 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.575890 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.575916 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [.], seq 3064539291, ack 488132388, win 63854, length 0
      12:20:31.577079 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [F.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.577107 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [F.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.577146 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [F.], seq 3064539291, ack 488132388, win 63854, length 0
      12:20:31.577736 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [.], seq 488132388, ack 3064539292, win 64239, length 0
      12:20:31.577761 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.577773 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.687029 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [FP.], seq 488132388, ack 3064539292, win 64239, length 0
      12:20:31.687166 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [FP.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.687214 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [FP.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.687398 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539292, ack 488132389, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.687413 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539292, ack 488132389, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
      12:20:31.687453 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [.], seq 3064539292, ack 488132389, win 63854, length 0
      

    🔝

    Flags

    root@kitploit:~
    Usage:
      ptcpdump [flags] [expression] [-- command [args]]
    
    Examples:
      sudo ptcpdump -i any tcp
      sudo ptcpdump -i eth0 -i lo
      sudo ptcpdump -i eth0 --pid 1234 port 80 and host 10.10.1.1
      sudo ptcpdump -i any --pname curl -A
      sudo ptcpdump -i any --container-id 36f0310403b1
      sudo ptcpdump -i any --container-name test
      sudo ptcpdump -i any -- curl ubuntu.com
      sudo ptcpdump -i any -w ptcpdump.pcapng
      sudo ptcpdump -i any -w - | tcpdump -n -r -
      sudo ptcpdump -i any -w - | tshark -r -
      ptcpdump -r ptcpdump.pcapng
    
    Expression: see "man 7 pcap-filter"
    
    Flags:
      -S, --absolute-tcp-sequence-numbers                Imprime números de sequência TCP absolutos, em vez de relativos.
      --backend string                               Especifica o backend a ser usado para capturar pacotes. Valores possíveis são "tc", "cgroup-skb", "tp-btf" e "socket-filter" (padrão "tc")
      --container-id string                          Filtra por ID do contêiner (apenas pacotes TCP e UDP são suportados)
      --container-name string                        Filtra por nome do contêiner (apenas pacotes TCP e UDP são suportados)
      --containerd-address string                    Endereço do serviço containerd (padrão "/run/containerd/containerd.sock")
      --context strings                              Especifica quais informações de contexto incluir na saída (padrão [process,thread,parentproc,user,container,pod])
      --count                                        Imprime apenas no stdout a contagem de pacotes ao ler o arquivo de captura, em vez de analisar/imprimir os pacotes
      --cri-runtime-address string                   Endereço do serviço de runtime de contêiner CRI (padrão: usa na ordem o primeiro bem-sucedido entre [/var/run/dockershim.sock, /var/run/cri-dockerd.sock, /run/crio/crio.sock, /run/containerd/containerd.sock])
      --delay-before-handle-packet-events duration   Aguarda alguns segundos antes de lidar com eventos de pacotes
      -Q, --direction string                             Escolhe a direção de envio/recebimento para a qual os pacotes devem ser capturados. Valores possíveis são 'in', 'out' e 'inout' (padrão "inout")
      --disable-reverse-match                        Desativa a correspondência reversa para pacotes TCP e UDP.
      --docker-address string                        Endereço do serviço Docker Engine (padrão "/var/run/docker.sock")
      --embed-keylog-to-pcapng -- CMD [ARGS]         Escreve o arquivo de log de chave TLS neste caminho (experimental: suporta apenas binário Go não strippado e deve ser combinado com -- CMD [ARGS])
      --event-chan-size uint                         Tamanho do canal de eventos (padrão 20)
      --exec-events-worker-number uint               Número de workers para lidar com eventos exec (padrão 50)
      -F, --expression-file string                       Usa o arquivo como entrada para a expressão de filtro. Uma expressão adicional fornecida na linha de comando é ignorada.
      -W, --file-count uint                              Usado em conjunto com a opção -C, limita o número de arquivos criados ao número especificado e começa a sobrescrever os arquivos desde o início, criando assim um buffer rotativo.
      -C, --file-size fileSize                           Antes de escrever um pacote bruto em um savefile, verifica se o arquivo é atualmente maior que file_size e, se sim, fecha o savefile atual e abre um novo. Savefiles após o primeiro terão o nome especificado pela opção -w, com um número após ele, começando em 1 e aumentando.
      -f, --follow-forks                                 Rastreia processos filhos conforme eles são criados por processos atualmente rastreados ao filtrar por processo
      -h, --help                                         ajuda para ptcpdump
      -i, --interface strings                            Interfaces para capturar (padrão [lo])
      --kernel-btf string                            Especifica o arquivo kernel BTF (padrão: usa na ordem o primeiro bem-sucedido entre [/sys/kernel/btf/vmlinux, /var/lib/ptcpdump/btf/vmlinux, /var/lib/ptcpdump/btf/vmlinux-$(uname -r), /var/lib/ptcpdump/btf/$(uname -r).btf, baixar arquivo BTF de https://mirrors.openanolis.cn/coolbpf/btf/ e https://github.com/aquasecurity/btfhub-archive/]
        -D, --list-interfaces                              Imprime a lista de interfaces de rede disponíveis no sistema
      --log-level string                             Define o nível de log ("debug", "info", "warn", "error", "fatal") (padrão "warn")
      --micro                                        Abreviação para --time-stamp-precision=micro
      --nano                                         Abreviação para --time-stamp-precision=nano
      --netns strings                                Caminho para um arquivo ou nome de namespace de rede (padrão [/proc/self/ns/net])
      -n, --no-convert-addr count                        Não converte endereços (ou seja, endereços de host, números de porta, etc.) para nomes
      -#, --number                                       Imprime um número de pacote opcional no início da linha
      --oneline                                      Imprime a saída do pacote analisado em uma única linha
      --pid uints                                    Filtra por IDs de processo (apenas pacotes TCP e UDP são suportados) (padrão [])
      --pname string                                 Filtra por nome do processo (apenas pacotes TCP e UDP são suportados)
      --pod-name string                              Filtra por nome do pod (formato: NAME.NAMESPACE, apenas pacotes TCP e UDP são suportados)
      --print                                        Imprime a saída do pacote analisado, mesmo que os pacotes brutos estejam sendo salvos em um arquivo com a opção -w
      -A, --print-data-in-ascii                          Imprime cada pacote (menos seu cabeçalho de nível de enlace) em ASCII
      -x, --print-data-in-hex count                      Ao analisar e imprimir, além de imprimir os cabeçalhos de cada pacote, imprime os dados de cada pacote em hexadecimal
      -X, --print-data-in-hex-ascii count                Ao analisar e imprimir, além de imprimir os cabeçalhos de cada pacote, imprime os dados de cada pacote em hexadecimal e ASCII
      -t, --print-timestamp count                        controla o formato do carimbo de data/hora impresso na saída
      -q, --quiet                                        Saída silenciosa. Imprime menos informações de protocolo para que as linhas de saída sejam mais curtas
      -r, --read-file string                             Lê pacotes de um arquivo (que foi criado com a opção -w). Ex.: ptcpdump.pcapng
      -c, --receive-count uint                           Sai após receber count pacotes
      -s, --snapshot-length uint32                       Captura snaplen bytes de dados de cada pacote em vez do padrão de 262144 bytes (padrão 262144)
      --time-stamp-precision string                  Ao capturar, define a precisão do carimbo de data/hora para a captura no formato (padrão "micro")
      --uid uints                                    Filtra por IDs de usuário (apenas pacotes TCP e UDP são suportados) (padrão [])
      -v, --verbose count                                Ao analisar e imprimir, produz uma saída (um pouco mais) detalhada
      --version                                      Imprime as strings de versão do ptcpdump e libpcap e sai
      -w, --write-file string                            Escreve os pacotes brutos em um arquivo em vez de analisá-los e imprimi-los. Eles podem ser posteriormente impressos com a opção -r. A saída padrão é usada se o arquivo for '-'. Ex.: ptcpdump.pcapng
      --write-keylog-file -- CMD [ARGS]              Escreve o arquivo de log de chave TLS neste caminho (experimental: suporta apenas binário Go não strippado e deve ser combinado com -- CMD [ARGS])
    

    🔝

    Comparação com tcpdump| Opções | tcpdump | ptcpdump |

    |---------------------------------------------------|---------|--------------------------| | expression | ✅ | ✅ | | -i interface, --interface=interface | ✅ | ✅ | | -w x.pcapng | ✅ | ✅ (com info do processo) | | -w x.pcap | ✅ | ✅ (sem info do processo) | | -w - | ✅ | ✅ | | -r x.pcapng, -r x.pcap | ✅ | ✅ | | -r - | ✅ | ✅ | | --pid process_id | | ✅ | | --pname process_name | | ✅ | | --uid user_id | | ✅ | | --container-id container_id | | ✅ | | --container-name container_name | | ✅ | | --pod-name pod_name.namespace | | ✅ | | -f, --follow-forks | | ✅ | | -- command [args] | | ✅ | | --netns path_to_net_ns | | ✅ | | --print | ✅ | ✅ | | -A | ✅ | ✅ | | -B bufer_size, --buffer-size=buffer_size | ✅ | | | -c count | ✅ | ✅ | | --count | ✅ | ✅ | | -C *file_size | ✅ | ✅ | | -d | ✅ | | | -dd | ✅ | | | -ddd | ✅ | | | -D, --list-interfaces | ✅ | ✅ | | -e | ✅ | | | -f | ✅ | ⛔ | | -F file | ✅ | ✅ | | -G rotate_seconds | ✅ | | | -h, --help | ✅ | ✅ | | -H | ✅ | | | -I, --monitor-mode | ✅ | | | --immediate-mode | ✅ | | | -j tstamp_type, --time-stamp-type=tstamp_type | ✅ | | | --time-stamp-precision=tstamp_precision | ✅ | ✅ | | -J, --list-time-stamp-types | ✅ | | | --micro | ✅ | ✅ | | --nano | ✅ | ✅ | | -K, --dont-verify-checksums | ✅ | | | -l | ✅ | | | -L, --list-data-link-types | ✅ | | | -m module | ✅ | | | -M secret | ✅ | | | -n | ✅ | ✅ | | -N | ✅ | | | -#, --number | ✅ | ✅ | | -O, --no-optimize | ✅ | | | -p, --no-promiscuous-mode | ✅ | ⛔ | | -q | ✅ | ✅ | | -Q direction, --direction=direction | ✅ | ✅ | | -S, --absolute-tcp-sequence-numbers | ✅ | ✅ | | -s snaplen, --snapshot-length=snaplen | ✅ | ✅ | | -T type | ✅ | | | -t | ✅ | ✅ | | -tt | ✅ | ✅ | | -ttt | ✅ | ✅ | | -tttt | ✅ | ✅ | | -ttttt | ✅ | ✅ | | -u | ✅ | | | -U, --packet-buffered | ✅ | | | -y datalinktype, --linktype=datalinktype | ✅ | | | -v | ✅ | ✅ | | -vv | ✅ | ⭕ | | -vvv | ✅ | ⭕ | | -V file | ✅ | | | --version | ✅ | ✅ | | -W filecont | ✅ | ✅ | | -x | ✅ | ✅ | | -xx | ✅ | ✅ | | -X | ✅ | ✅ | | -XX | ✅ | ✅ | | -z postrotate-command | ✅ | | | -Z user, --relinquish-privileges=user | ✅ | |

    🔝

    Desenvolvimento

    Dependências

    Certifique-se de ter as seguintes dependências instaladas no seu sistema:

    • Go >= 1.23
    • Clang/LLVM >= 14
    • Bison >= 3.8
    • Lex/Flex >= 2.6
    • GCC
    • GNU make
    • autoconf
    • libelf

    Em sistemas Debian/Ubuntu, você pode instalar a maioria delas com:

    root@kitploit:~
    sudo apt-get update
    sudo apt-get install -y build-essential clang llvm bison flex \
         make autoconf libelf-dev
    

    Compilação

    A compilação do ptcpdump envolve duas etapas principais: gerar o bytecode eBPF (opcional se você não modificar o código eBPF) e compilar a aplicação Go.

    1. Compilar os Programas eBPF (Opcional)

    Esta etapa compila o código eBPF em C localizado no diretório bpf/ em bytecode para múltiplas arquiteturas alvo (amd64, arm64, arm). O bytecode gerado é então embutido no executável Go final do ptcpdump. Você só precisa executar esta etapa se modificar o código fonte eBPF ou se os arquivos pré-gerados estiverem faltando.

    • Compilação Nativa: Requer Clang/LLVM instalado localmente.

      root@kitploit:~
      make build-bpf
      
    • Usando Docker: Use isso se você não tiver o toolchain de compilação C necessário localmente. Utiliza uma imagem de desenvolvimento pré-configurada.

      root@kitploit:~
      make build-bpf-via-docker
      

    2. Compilar o Executável ptcpdump

    Após garantir que o bytecode eBPF foi gerado (ou usando os pré-gerados), você pode compilar a aplicação Go principal.

    • Compilação Estática (Recomendada): Isso compila o ptcpdump com todas as suas dependências, incluindo uma versão embutida do libpcap (do submódulo lib/libpcap), linkada estaticamente no executável final. Isso resulta em um binário portátil sem dependências de bibliotecas externas. Este é o método padrão e recomendado.

      • Compilação Nativa: Este comando primeiro garante que o libpcap embutido seja compilado e então compila o executável estático ptcpdump.

        root@kitploit:~
        # Isso primeiro compila o libpcap, depois compila o ptcpdump estaticamente
        make build
        
      • Usando Docker: Compila o executável estático dentro do contêiner de desenvolvimento.

        root@kitploit:~
        make build-via-docker
        
    • Compilação Dinâmica: Isso compila o ptcpdump linkado dinamicamente com a biblioteca libpcap instalada no sistema. Você deve ter o pacote de desenvolvimento do libpcap instalado previamente no seu sistema (ex.: libpcap-dev no Debian/Ubuntu, libpcap-devel no Fedora/CentOS). Isso resulta em um executável menor, mas requer que o libpcap esteja presente no sistema de destino.

      root@kitploit:~
       # Certifique-se de que o pacote de desenvolvimento do libpcap esteja instalado primeiro
       # ex.: sudo apt-get install libpcap-dev
       make build-dynamic-link
      

    O executável final será criado no diretório raiz do projeto (ex.: ./ptcpdump).

    🔝

    Projetos Relacionados

    Flownix

    Flownix é um analisador de tráfego de rede gráfico, em tempo real e baseado em fluxo para sistemas Linux. Ele captura pacotes usando o binário ptcpdump, extrai metadados detalhados de cada fluxo, armazena em SQLite e visualiza tudo em uma interface web Dash limpa e responsiva.

    flownix overview 1 flownix overview 2

    Repositório: VISION-183/flownix

    🔝

    Baixar ferramenta
  • --backend cgroup-skb:

    root@kitploit:~
    $ sudo ptcpdump -i any --backend cgroup-skb host 1.1.1.1
    
    12:20:31.336108 45@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [S], seq 3064539219, win 64240, options [mss 1460,sackOK,TS val 1731159046 ecr 0,nop,wscale 7], length 0, Thread [curl.405939], ParentProc [bash.405653], Container [musing_banach]
    12:20:31.467819 45@4026533097 curl.405939 In IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [S.], seq 488132001, ack 3064539220, win 64240, options [mss 1460], length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.467876 45@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539220, ack 488132002, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468072 45@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [P.], seq 3064539220:3064539291, ack 488132002, win 64240, length 71, Thread [curl.405939], ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468681 45@4026533097 curl.405939 In IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132002, ack 3064539291, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575750 45@4026533097 curl.405939 In IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [P.], seq 488132002:488132388, ack 3064539291, win 64240, length 386, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575848 45@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.576982 45@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [F.], seq 3064539291, ack 488132388, win 63854, length 0, Thread [curl.405939], ParentProc [bash.405653], Container [musing_banach]
    12:20:31.577843 45@4026533097 curl.405939 In IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.687357 45@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539292, ack 488132389, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    
  • --backend socket-filter:

    root@kitploit:~
    $ sudo ptcpdump -i any --backend socket-filter host 1.1.1.1
    
    12:20:31.336456 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [S], seq 3064539219, win 64240, options [mss 1460,sackOK,TS val 1731159046 ecr 0,nop,wscale 7], length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.336818 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [S], seq 3064539219, win 64240, options [mss 1460,sackOK,TS val 1731159046 ecr 0,nop,wscale 7], length 0
    12:20:31.467700 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [S.], seq 488132001, ack 3064539220, win 64240, options [mss 1460], length 0
    12:20:31.467776 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [S.], seq 488132001, ack 3064539220, win 64240, options [mss 1460], length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.467784 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [S.], seq 488132001, ack 3064539220, win 64240, options [mss 1460], length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468030 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539220, ack 488132002, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468066 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [.], seq 3064539220, ack 488132002, win 64240, length 0
    12:20:31.468092 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [P.], seq 3064539220:3064539291, ack 488132002, win 64240, length 71, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468122 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [P.], seq 3064539220:3064539291, ack 488132002, win 64240, length 71
    12:20:31.468461 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [.], seq 488132002, ack 3064539291, win 64240, length 0
    12:20:31.468552 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132002, ack 3064539291, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468565 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132002, ack 3064539291, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575416 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [P.], seq 488132002:488132388, ack 3064539291, win 64240, length 386
    12:20:31.575601 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [P.], seq 488132002:488132388, ack 3064539291, win 64240, length 386, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575623 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [P.], seq 488132002:488132388, ack 3064539291, win 64240, length 386, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575889 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575928 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [.], seq 3064539291, ack 488132388, win 63854, length 0
    12:20:31.577085 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [F.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.577153 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [F.], seq 3064539291, ack 488132388, win 63854, length 0
    12:20:31.577733 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [.], seq 488132388, ack 3064539292, win 64239, length 0
    12:20:31.577770 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.577778 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.687015 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [FP.], seq 488132388, ack 3064539292, win 64239, length 0
    12:20:31.687206 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [FP.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.687223 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [FP.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.687409 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539292, ack 488132389, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.687464 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [.], seq 3064539292, ack 488132389, win 63854, length 0
    
  • --backend tp-btf:

    root@kitploit:~
    $ sudo ptcpdump -i any --backend tp-btf host 1.1.1.112:20:31.336316 eth0@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [S], seq 3064539219, win 64240, options [mss 1460,sackOK,TS val 1731159046 ecr 0,nop,wscale 7], length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.336382 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [S], seq 3064539219, win 64240, options [mss 1460,sackOK,TS val 1731159046 ecr 0,nop,wscale 7], length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.336443 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [S], seq 3064539219, win 64240, options [mss 1460,sackOK,TS val 1731159046 ecr 0,nop,wscale 7], length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.336801 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [S], seq 3064539219, win 64240, options [mss 1460,sackOK,TS val 1731159046 ecr 0,nop,wscale 7], length 0
    12:20:31.467682 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [S.], seq 488132001, ack 3064539220, win 64240, options [mss 1460], length 0
    12:20:31.467773 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [S.], seq 488132001, ack 3064539220, win 64240, options [mss 1460], length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.467783 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [S.], seq 488132001, ack 3064539220, win 64240, options [mss 1460], length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.467811 eth0@4026533097 curl.405939 In IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [S.], seq 488132001, ack 3064539220, win 64240, options [mss 1460], length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468005 eth0@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539220, ack 488132002, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468022 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539220, ack 488132002, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468029 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539220, ack 488132002, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468063 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [.], seq 3064539220, ack 488132002, win 64240, length 0
    12:20:31.468078 eth0@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [P.], seq 3064539220:3064539291, ack 488132002, win 64240, length 71, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468085 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [P.], seq 3064539220:3064539291, ack 488132002, win 64240, length 71, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468091 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [P.], seq 3064539220:3064539291, ack 488132002, win 64240, length 71, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468112 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [P.], seq 3064539220:3064539291, ack 488132002, win 64240, length 71
    12:20:31.468446 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [.], seq 488132002, ack 3064539291, win 64240, length 0
    12:20:31.468543 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132002, ack 3064539291, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468562 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132002, ack 3064539291, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.468668 eth0@4026533097 curl.405939 In IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132002, ack 3064539291, win 64240, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575358 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [P.], seq 488132002:488132388, ack 3064539291, win 64240, length 386
    12:20:31.575586 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [P.], seq 488132002:488132388, ack 3064539291, win 64240, length 386, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575617 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [P.], seq 488132002:488132388, ack 3064539291, win 64240, length 386, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575732 eth0@4026533097 curl.405939 In IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [P.], seq 488132002:488132388, ack 3064539291, win 64240, length 386, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575855 eth0@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575870 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575883 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.575920 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [.], seq 3064539291, ack 488132388, win 63854, length 0
    12:20:31.577059 eth0@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [F.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.577074 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [F.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.577082 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [F.], seq 3064539291, ack 488132388, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.577148 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [F.], seq 3064539291, ack 488132388, win 63854, length 0
    12:20:31.577704 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [.], seq 488132388, ack 3064539292, win 64239, length 0
    12:20:31.577764 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.577774 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.577835 eth0@4026533097 curl.405939 In IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.686955 ens33 In IP 1.1.1.1.80 > 10.0.2.15.38670: Flags [FP.], seq 488132388, ack 3064539292, win 64239, length 0
    12:20:31.687183 docker0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [FP.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.687218 veth1d387b0 curl.405939 Out IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [FP.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.687316 eth0@4026533097 curl.405939 In IP 1.1.1.1.80 > 172.17.0.4.38670: Flags [FP.], seq 488132388, ack 3064539292, win 64239, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.687369 eth0@4026533097 curl.405939 Out IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539292, ack 488132389, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.687388 veth1d387b0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539292, ack 488132389, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.687404 docker0 curl.405939 In IP 172.17.0.4.38670 > 1.1.1.1.80: Flags [.], seq 3064539292, ack 488132389, win 63854, length 0, ParentProc [bash.405653], Container [musing_banach]
    12:20:31.687457 ens33 Out IP 10.0.2.15.38670 > 1.1.1.1.80: Flags [.], seq 3064539292, ack 488132389, win 63854, length 0