• chantra's avatar
    [tcpconnect] filter traced connection based on destination ports · 52938058
    chantra authored
    Test:
    While running:
    while [ 1 ]; do nc -w 1 100.127.0.1 80; nc -w 1 100.127.0.1 81; done
    
    root@vagrant:/mnt/bcc# ./tools/tcpconnect.py
    PID    COMM         IP SADDR            DADDR            DPORT
    19978  nc           4  10.0.2.15        100.127.0.1      80
    19979  nc           4  10.0.2.15        100.127.0.1      81
    19980  nc           4  10.0.2.15        100.127.0.1      80
    19981  nc           4  10.0.2.15        100.127.0.1      81
    root@vagrant:/mnt/bcc# ./tools/tcpconnect.py  -P 80
    PID    COMM         IP SADDR            DADDR            DPORT
    19987  nc           4  10.0.2.15        100.127.0.1      80
    19989  nc           4  10.0.2.15        100.127.0.1      80
    19991  nc           4  10.0.2.15        100.127.0.1      80
    19993  nc           4  10.0.2.15        100.127.0.1      80
    19995  nc           4  10.0.2.15        100.127.0.1      80
    root@vagrant:/mnt/bcc# ./tools/tcpconnect.py  -P 80,81
    PID    COMM         IP SADDR            DADDR            DPORT
    8725   nc           4  10.0.2.15        100.127.0.1      80
    8726   nc           4  10.0.2.15        100.127.0.1      81
    8727   nc           4  10.0.2.15        100.127.0.1      80
    8728   nc           4  10.0.2.15        100.127.0.1      81
    8729   nc           4  10.0.2.15        100.127.0.1      80
    
    Fixes #681
    52938058
tcpconnect.py 6.9 KB