File: tcp_shoot

package info (click to toggle)
zsh-beta 4.3.17-dev-0%2B20120621-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 19,804 kB
  • sloc: ansic: 95,966; sh: 5,899; makefile: 845; perl: 745; awk: 383; sed: 16
file content (21 lines) | stat: -rw-r--r-- 329 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
emulate -L zsh
setopt extendedglob

local REPLY tfd

if [[ $# -ne 2 ]]; then
    print "Usage: tcp_dump host port
Connect to the given host and port; send standard input.">&2
    return 1
fi

if ! ztcp $1 $2; then
    print "Failed to open connection to host $1 port $2" >&2
    return 1
fi

tfd=$REPLY

cat >&$tfd

ztcp -c $tfd