📄 lft
字号:
#!/bin/sh## Copyright (c) 2007 Dmitry K. Butskoy# <buc@citadel.stu.neva.ru># 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=$0opts=""length=""method="-T"dport=""sport=""queries=2ahead=5scatter=20timeout=1000usage () { 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] [gateway ...] target:dport" >&2}warning () { echo "$prgname: Option '$1' is not implemented in this wrapper" >&2} PARSED=`getopt 'ACEFINRSTUVbehinpruvzd:s:m:M:a:c:t:l:H:L:q:D:' "$@"`[ $? != 0 ] && exit 2eval 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 ;; esacdonewhile [ $# -gt 1 ]do opts="$opts -g $1" shiftdone[ $# -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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -