/usr/bin/tracetopends is in libtrace-tools 3.0.21-1ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | #!/bin/sh
if [ $# -lt 1 ]; then
echo usage: $0 [options] inputuri...
echo See manpage for more details.
exit
fi
top_count=10
send=1
sort="bytes"
filter=""
addr="v4"
while getopts "f:sdn:bapA:h" opt; do
case $opt in
A)
addr=$OPTARG
;;
f)
filter=$OPTARG
;;
s)
send=1
;;
d)
send=0
;;
n)
top_count=$OPTARG
;;
b)
sort="bytes"
;;
a)
sort="app"
;;
p)
sort="pkts"
;;
h)
echo usage: $0 [options] inputuri...
echo Type \'man tracetopends\' for more details.
exit 1
;;
/?)
echo "Invalid option: -$OPTARG"
exit 1
;;
:)
echo "Option -$OPTARG requires an argument"
exit 1
;;
esac
done
sort_index=0
if [ $send = 1 ]; then
if [ $sort = "bytes" ]; then
sort_index=4
elif [ $sort = "pkts" ]; then
sort_index=3
else
sort_index=5
fi
fi
if [ $send = 0 ]; then
if [ $sort = "bytes" ]; then
sort_index=7
elif [ $sort = "pkts" ]; then
sort_index=6
else
sort_index=8
fi
fi
exec
shift $(($OPTIND - 1))
if [ $addr = "mac" ]; then
printf "%18s %16s %16s %16s %16s %16s %16s %16s\n" \
"MAC Address" \
"Last Seen" \
"Src Pkts" \
"Src Bytes" \
"Src Payload" \
"Dst Pkts" \
"Dst Bytes" \
"Dst Payload"
fi
if [ $addr = "v4" ]; then
printf "%16s %16s %16s %16s %16s %16s %16s %16s\n" \
"IPv4 Address" \
"Last Seen" \
"Src Pkts" \
"Src Bytes" \
"Src Payload" \
"Dst Pkts" \
"Dst Bytes" \
"Dst Payload"
fi
if [ $addr = "v6" ]; then
printf "%40s %16s %16s %16s %16s %16s %16s %16s\n" \
"IPv6 Address" \
"Last Seen" \
"Src Pkts" \
"Src Bytes" \
"Src Payload" \
"Dst Pkts" \
"Dst Bytes" \
"Dst Payload"
fi
if [ "$filter" = "" ]; then
traceends -A $addr $@ | { trap '' int; sort -n -k $sort_index -r -s; } | { trap '' int; head -n $top_count; }
else
traceends -A $addr -f "$filter" $@ | { trap '' int; sort -n -k $sort_index -r -s; } | { trap '' int; head -n $top_count; }
fi
exit 0
|