summaryrefslogtreecommitdiffstats
path: root/wrappers
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--wrappers/Makefile15
-rw-r--r--wrappers/README.wrappers18
-rwxr-xr-xwrappers/lft117
-rwxr-xr-xwrappers/tcptraceroute78
-rw-r--r--wrappers/tcptraceroute.834
-rwxr-xr-xwrappers/tracepath63
-rwxr-xr-xwrappers/traceproto127
-rwxr-xr-xwrappers/traceroute-nanog76
8 files changed, 528 insertions, 0 deletions
diff --git a/wrappers/Makefile b/wrappers/Makefile
new file mode 100644
index 0000000..53935f6
--- /dev/null
+++ b/wrappers/Makefile
@@ -0,0 +1,15 @@
+#
+# Copyright (c) 2007 Dmitry Butskoy
+# <dmitry@butskoy.name>
+# License: GPL v2 or any later
+#
+# See COPYING for the status of this software.
+#
+
+#
+# Nothing to do.
+#
+
+all depend install:
+ @true
+
diff --git a/wrappers/README.wrappers b/wrappers/README.wrappers
new file mode 100644
index 0000000..bd0e2f4
--- /dev/null
+++ b/wrappers/README.wrappers
@@ -0,0 +1,18 @@
+
+This directory contains various wrappers for traceroute, which provide
+some compatibility for some another traceroute-like software,
+including tcptraceroute(8).
+
+These wrappers try to emulate the command-line interface only.
+The actual output is the output of the underlain traceroute(8).
+
+Some of options and features certainly are not supported
+(especially if it is considered too extra :) ).
+
+The idea of such wrappers is mostly not wrappers itself. It is to inspect
+the features implemented by competitors, whether it is already supported by us,
+or it is useful to be supported, or it is not useful or excessive.
+
+We have no plans to implement all features of all existing software.
+Let the people a chance to play with something... ;)
+
diff --git a/wrappers/lft b/wrappers/lft
new file mode 100755
index 0000000..a6cb089
--- /dev/null
+++ b/wrappers/lft
@@ -0,0 +1,117 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Dmitry K. Butskoy
+# <dmitry@butskoy.name>
+# License: GPL v2 or any later
+#
+# See COPYING for the status of this software.
+#
+
+#
+# Shell wrapper providing lft(8) command line interface.
+#
+# The original implementation of lft(8) can be obtained
+# from http://pwhois.org/lft/
+#
+
+
+prgname=$0
+opts=""
+length=""
+method="-T"
+
+dport=""
+sport=""
+queries=2
+ahead=5
+scatter=20
+timeout=1000
+
+
+usage () {
+ echo "Usage: $prgname [-ACEFINRSTUVbehinpruvz] [-d dport] [-s sport]
+ [-m retry min] [-M retry max] [-a ahead] [-c scatter ms] [-t timeout ms]
+ [-l min ttl] [-H max ttl] [-L length] [-q ISN] [-D device] [--help]
+ [gateway ...] target:dport" >&2
+}
+
+warning () {
+ echo "$prgname: Option '$1' is not implemented in this wrapper" >&2
+}
+
+
+PARSED=`getopt -o 'ACEFINRSTUVbehinpruvzd:s:m:M:a:c:t:l:H:L:q:D:' -l help -- "$@"`
+[ $? != 0 ] && exit 2
+
+eval set -- "$PARSED"
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ -d) dport=$2; shift 2 ;;
+ -s) sport=$2; shift 2 ;;
+ -z) sport=""; shift ;;
+ -m) queries=$2; shift 2 ;;
+ -a) ahead=$2; shift 2 ;;
+ -c) scatter=$2; shift 2 ;;
+ -t) timeout=$2; shift 2 ;;
+ -l) opts="$opts -f $2"; shift 2 ;;
+ -L) length=$2; shift 2 ;;
+ -D) case "$2" in
+ [0-9]*) opts="$opts -s $2" ;;
+ *) opts="$opts -i $2" ;;
+ esac
+ shift 2
+ ;;
+ -H) opts="$opts -m $2"; shift 2 ;;
+ -I) opts="$opts -t 0x10"; shift ;;
+ -n) opts="$opts -n"; shift ;;
+ -h) shift ;;
+ -F) opts="$opts -O fin"; shift ;;
+ -u) method="-U"; shift ;;
+ -N) opts="$opts -A"; shift ;;
+ -p) method="-I"; shift ;;
+ -b) shift ;;
+ -A) opts="$opts -A"; shift ;;
+ -[ieErCTUV]) warning $1; shift ;;
+ -[Mq]) warning $1; shift 2 ;;
+ -[RS]) shift ;;
+ --help) usage; exit 0 ;;
+ -v) echo "\"lft\"-compatible wrapper for new Linux Traceroute" >&2;
+ exit 0 ;;
+ --) shift; break ;;
+ *) echo "$prgname: Internal parsing error" >&2; exit 2 ;;
+ esac
+done
+
+while [ $# -gt 1 ]
+do
+ opts="$opts -g $1"
+ shift
+done
+
+[ $# -eq 0 ] && {
+ usage
+ exit 2
+}
+
+case "$1" in
+ *:*:*) host=$1 ;;
+ *:*) dport=${1##*:}; host=${1%:*} ;;
+ *) host=$1 ;;
+esac
+
+[ -n "$dport" ] && opts="$opts -p $dport"
+[ -n "$sport" ] && opts="$opts --sport=$sport"
+opts="$opts -q $queries"
+opts="$opts -N $(($ahead * $queries))"
+opts="$opts -z $scatter"
+
+timeout=`printf "%04d" $timeout`
+sec=${timeout%???}
+opts="$opts -w $sec.${timeout#$sec}"
+
+opts="$method $opts"
+
+exec traceroute $opts $host $length
+
diff --git a/wrappers/tcptraceroute b/wrappers/tcptraceroute
new file mode 100755
index 0000000..6abe4bf
--- /dev/null
+++ b/wrappers/tcptraceroute
@@ -0,0 +1,78 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Dmitry Butskoy
+# <dmitry@butskoy.name>
+# License: GPL v2 or any later
+#
+# See COPYING for the status of this software.
+#
+
+#
+# Shell wrapper providing tcptraceroute(8) command line interface.
+#
+# The original implementation of tcptraceroute(8) can be obtained
+# from http://michael.toren.net/code/tcptraceroute/
+#
+
+opts="-T -O info"
+length=""
+prgname=$0
+
+
+usage () {
+ echo "Usage: $prgname [-hvnFSAE] [-i dev] [-f furst_ttl] [-l length]
+ [-q nqueries] [-t tos] [-m max_ttl] [-p src_port] [-s src_addr]
+ [-w wait_time] host [dest_port] [length]" >&2
+}
+
+
+PARSED=`getopt -- 'hvdnNi:l:f:Fm:p:q:w:s:t:SAE' "$@"`
+[ $? != 0 ] && exit 2
+
+eval set -- "$PARSED"
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ -[dnF]) opts="$opts $1"; shift ;;
+ -N) shift ;;
+ -[ifmqwst]) opts="$opts $1 $2"; shift 2 ;;
+ -l) length=$2; shift 2 ;;
+ -p) opts="$opts --sport=$2"; shift 2 ;;
+ -S) opts="$opts -O syn"; shift ;;
+ -A) opts="$opts -O ack"; shift ;;
+ -E) opts="$opts -O ecn"; shift ;;
+ -h) usage ; exit 0 ;;
+ -v) echo "\"tcptraceroute\"-compatible wrapper for new Linux Traceroute" >&2;
+ exit 0 ;;
+ --) shift; break ;;
+ *) echo "$prgname: Internal parsing error" >&2; exit 2 ;;
+ esac
+done
+
+[ $# -eq 0 ] && {
+ usage
+ exit 2
+}
+
+host=$1
+shift
+
+[ $# -gt 0 ] && {
+ opts="$opts -p $1"
+ shift
+}
+
+[ $# -gt 0 ] && {
+ length=$1
+ shift
+}
+
+
+# Say to the people it is actually another program...
+echo "Running:
+ traceroute $opts $host $length" >&2
+
+
+exec traceroute $opts $host $length
+
diff --git a/wrappers/tcptraceroute.8 b/wrappers/tcptraceroute.8
new file mode 100644
index 0000000..7c19ecf
--- /dev/null
+++ b/wrappers/tcptraceroute.8
@@ -0,0 +1,34 @@
+.\" Copyright (c) 2016 Dmitry Butskoy (dmitry@butskoy.name)
+.\" License: GPL v2 or any later version
+.\" See COPYING for the status of this software
+.TH TCPTRACEROUTE 8 "8 March 2016" "Traceroute" "Traceroute For Linux"
+.\" .UC 6
+.SH NAME
+tcptraceroute \- print the route packets trace to network host
+.SH SYNOPSIS
+.na
+.BR tcptraceroute
+.RI " [" options ]
+.ad
+.SH DESCRIPTION
+.I tcptraceroute
+is just a link to the system
+.B traceroute\fR,
+to allow run it without specifying
+.B \-T
+option each time (for switch to the TCP method). It is fully equivalent to
+.B traceroute \-T\fR,
+the rest of the command line is the same.
+.br
+See
+.BR traceroute (8)
+for more info.
+.SH NOTES
+There was an original implementation of tcptraceroute, which had some options
+differ (but rare used). Most common
+.BR "" [ "dnFi:f:m:q:w:s:t:" ]
+was exactly the same, but
+.BR "" [ "l:p:NSAE" ]
+was not. For full compatibility, a wrapper provided (available in the source code).
+.SH SEE ALSO
+.BR traceroute (8)
diff --git a/wrappers/tracepath b/wrappers/tracepath
new file mode 100755
index 0000000..c7d3770
--- /dev/null
+++ b/wrappers/tracepath
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# Copyright (c) 2008 Dmitry Butskoy
+# <dmitry@butskoy.name>
+# License: GPL v2 or any later
+#
+# See COPYING for the status of this software.
+#
+
+#
+# Shell wrapper providing tracepath(1) or tracepath6(1) command line interface.
+#
+# The original implementation of tracepath/tracepath6 can be obtained
+# from the iputils package, available at http://www.skbuff.net/iputils/
+#
+
+opts="-q1 --mtu --back"
+port=44444
+prgname=$0
+length=""
+
+
+usage () {
+ echo "Usage: $prgname [-nbh] [ -l pktlen ] host[/port]" >&2
+}
+
+
+PARSED=`getopt -- 'hnbl:' "$@"`
+[ $? != 0 ] && exit 2
+
+eval set -- "$PARSED"
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ -n) opts="$opts $1"; shift ;;
+ -b) shift ;;
+ -l) length=$2; shift 2 ;;
+ -h) usage ; exit 0 ;;
+ --) shift; break ;;
+ *) echo "$prgname: Internal parsing error" >&2; exit 2 ;;
+ esac
+done
+
+[ $# -eq 0 ] && {
+ usage
+ exit 2
+}
+
+host=$1
+case "$host" in
+ */*) port=${host##*/}
+ host=${host%/*}
+ ;;
+esac
+
+
+case "$prgname" in
+ *6) opts="$opts -6" ;;
+esac
+
+exec traceroute $opts -p $port $host $length
+
diff --git a/wrappers/traceproto b/wrappers/traceproto
new file mode 100755
index 0000000..0a03b2d
--- /dev/null
+++ b/wrappers/traceproto
@@ -0,0 +1,127 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Dmitry K. Butskoy
+# <dmitry@butskoy.name>
+# License: GPL v2 or any later
+#
+# See COPYING for the status of this software.
+#
+
+#
+# Shell wrapper providing traceproto(8) command line interface.
+#
+# The original implementation of traceproto(8) can be obtained
+# from http://traceproto.sourceforge.net/
+#
+
+
+prgname=$0
+opts=""
+length=""
+method="tcp"
+sendwait=100
+cont=""
+iface=$TP_DEFAULT_IF
+
+
+usage () {
+ echo "Usage: $prgname [-cCTfAhvR] [-p protocol] [-d dst_port] [-D max_dst_port]
+ [-s src_port] [-S max_src_port] [-m min_ttl] [-M max_ttl] [-w response_timeout]
+ [-W send_delay] [-a account_level] [-P payload_size]
+ [-F interface] [-k skips] [-I consecutive_trace_count]
+ [-H packets_per_hop] [-i incr_pattern] [-o output_style] [-t tcp_flags]
+ target" >&2
+}
+
+warning () {
+ echo "$prgname: Option '$1' is not implemented in this wrapper" >&2
+}
+
+
+PARSED=`getopt -- 'cCTfAhvRp:d:D:s:S:m:M:w:W:a:P:F:k:I:H:i:o:t:' "$@"`
+[ $? != 0 ] && exit 2
+
+eval set -- "$PARSED"
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ -p) method=$2; shift 2 ;;
+ -d) opts="$opts -p $2"; shift 2 ;;
+ -s) opts="$opts --sport=$2"; shift 2 ;;
+ -m) opts="$opts -f $2"; shift 2 ;;
+ -M) opts="$opts -m $2"; shift 2 ;;
+ -w) opts="$opts -w $2"; shift 2 ;;
+ -W) sendwait=$2; shift 2 ;;
+ -P) length=$2; shift 2 ;;
+ -c) cont=100000; shift ;;
+ -I) cont=$2; shift 2 ;;
+ -H) opts="$opts -q $2"; shift 2 ;;
+ -f) opts="$opts -F"; shift ;;
+ -F) iface=$2; shift 2 ;;
+ -A) opts="$opts -A"; shift ;;
+ -o) [ $2 != "c" ] && warning $1; shift 2 ;;
+ -t) case $2 in
+ *S*) opts="$opts -O syn" ;;
+ esac
+ case $2 in
+ *A*) opts="$opts -O ack" ;;
+ esac
+ case $2 in
+ *R*) opts="$opts -O rst" ;;
+ esac
+ case $2 in
+ *U*) opts="$opts -O urg" ;;
+ esac
+ case $2 in
+ *P*) opts="$opts -O psh" ;;
+ esac
+ case $2 in
+ *F*) opts="$opts -O fin" ;;
+ esac
+ case $2 in
+ *E*) opts="$opts -O ece" ;;
+ esac
+ case $2 in
+ *C*) opts="$opts -O cwr" ;;
+ esac
+ shift 2 ;;
+ -[DSaki]) warning $1; shift 2 ;;
+ -[TCR]) warning $1; shift ;;
+ -h) usage; exit 0 ;;
+ -v) echo "\"traceproto\"-compatible wrapper for new Linux Traceroute" >&2;
+ exit 0 ;;
+ --) shift; break ;;
+ *) echo "$prgname: Internal parsing error" >&2; exit 2 ;;
+ esac
+done
+
+
+
+[ $# -eq 0 ] && {
+ usage
+ exit 2
+}
+
+host=$1
+
+
+opts="-M $method $opts"
+opts="$opts -z $sendwait"
+[ -n "$iface" ] && opts="$opts -i $iface"
+
+[ -n "$TP_OUTPUT_STYLE" -a "$TP_OUTPUT_STYLE" != "classic" ] && {
+ echo "$prgname: warning: only classic output style supported" >&2
+}
+
+[ -n "$TP_RA_SERVER" -a -z "$RA_SERVER" ] && RA_SERVER=$TP_RA_SERVER
+
+
+[ -z "$cont" ] && exec traceroute $opts $host $length
+
+while [ "$cont" -gt 0 ]
+do
+ cont=$(($cont - 1))
+ traceroute $opts $host $length
+done
+
diff --git a/wrappers/traceroute-nanog b/wrappers/traceroute-nanog
new file mode 100755
index 0000000..0145464
--- /dev/null
+++ b/wrappers/traceroute-nanog
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Dmitry K. Butskoy
+# <dmitry@butskoy.name>
+# License: GPL v2 or any later
+#
+# See COPYING for the status of this software.
+#
+
+#
+# Shell wrapper providing traceroute-nanog(8) command line interface.
+#
+# The original implementation of traceroute-nanog(8) can be obtained
+# from ftp://ftp.login.com/pub/software/traceroute/
+#
+
+
+prgname=$0
+opts=""
+spray=""
+
+
+usage () {
+ echo "Usage: $prgname [-adnruvAMOPQU$] [-w wait] [-S start_ttl]
+ [-m max_ttl] [-p port] [-q nqueries] [-g gateway] [-t tos]
+ [-s src_addr] [-I proto] host [data_size]" >&2
+}
+
+warning () {
+ echo "$prgname: Option '$1' is not implemented in this wrapper" >&2
+}
+
+
+PARSED=`getopt -- 'adnruvAMOPQU$w:S:m:p:q:g:t:s:I:f:T:' "$@"`
+[ $? != 0 ] && {
+ usage
+ exit 2
+}
+
+eval set -- "$PARSED"
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ -[Adrn]) opts="$opts $1"; shift ;;
+ -[gmpqstw]) opts="$opts $1 $2"; shift 2 ;;
+ -I) case "$2" in
+ icmp) opts="$opts -I" ;;
+ tcp) opts="$opts -T" ;;
+ udp) ;;
+ udplite) opts="$opts -UL" ;;
+ *) opts="$opts -P $2" ;;
+ esac
+ shift 2 ;;
+ -S) opts="$opts -f $2"; shift 2 ;;
+ -P) spray=1; shift ;;
+ -f) opts="$opts --sport=$2"; shift 2 ;;
+ -u) ;;
+ -$) opts="-f 64 -m 64 -q 1"; shift ;;
+ -M) opts="$opts --mtu"; shift ;;
+ -[aUOvQ]) warning $1; shift ;;
+ -T) warning $1; shift 2 ;;
+ --) shift; break ;;
+ *) echo "$prgname: Internal parsing error" >&2; exit 2 ;;
+ esac
+done
+
+[ $# -eq 0 ] && {
+ usage
+ exit 2
+}
+
+[ -z "$spray" ] && opts="$opts -N 1"
+
+exec traceroute $opts $1 $2
+