Debian Codegraph @

wrappers/tcptraceroute

raw ◀ ▶
1 Debian patch touch this file
1 #!/bin/sh
2 #
3 # Copyright (c) 2007 Dmitry Butskoy
4 # <[email protected]>
5 # License: GPL v2 or any later
6 #
7 # See COPYING for the status of this software.
8 #
9
10 #
11 # Shell wrapper providing tcptraceroute(8) command line interface.
12 #
13 # The original implementation of tcptraceroute(8) can be obtained
14 # from http://michael.toren.net/code/tcptraceroute/
15 #
16
17 opts="-T -O info"
18 length=""
19 prgname=$0
20
21
22 usage () {
23 echo "Usage: $prgname [-hvnFSAE] [-i dev] [-f furst_ttl] [-l length]
24 [-q nqueries] [-t tos] [-m max_ttl] [-p src_port] [-s src_addr]
25 [-w wait_time] host [dest_port] [length]" >&2
26 }
27
28
29 PARSED=`getopt -- 'hvdnNi:l:f:Fm:p:q:w:s:t:SAE' "$@"`
30 [ $? != 0 ] && exit 2
31
32 eval set -- "$PARSED"
33
34 while [ $# -gt 0 ]
35 do
36 case "$1" in
37 -[dnF]) opts="$opts $1"; shift ;;
38 -N) shift ;;
39 -[ifmqwst]) opts="$opts $1 $2"; shift 2 ;;
40 -l) length=$2; shift 2 ;;
41 -p) opts="$opts --sport=$2"; shift 2 ;;
42 -S) opts="$opts -O syn"; shift ;;
43 -A) opts="$opts -O ack"; shift ;;
44 -E) opts="$opts -O ecn"; shift ;;
45 -h) usage ; exit 0 ;;
46 -v) echo "\"tcptraceroute\"-compatible wrapper for new Linux Traceroute" >&2;
47 exit 0 ;;
48 --) shift; break ;;
49 *) echo "$prgname: Internal parsing error" >&2; exit 2 ;;
50 esac
51 done
52
53 [ $# -eq 0 ] && {
54 usage
55 exit 2
56 }
57
58 host=$1
59 shift
60
61 [ $# -gt 0 ] && {
62 opts="$opts -p $1"
63 shift
64 }
65
66 [ $# -gt 0 ] && {
67 length=$1
68 shift
69 }
70
71
72 # Say to the people it is actually another program...
73 echo "Running:
74 traceroute $opts $host $length" >&2
75
76
•77 exec /usr/bin/traceroute.db $opts $host $length
78