⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interceptty.1

📁 intercept tty is using for listening a UART conversation
💻 1
📖 第 1 页 / 共 2 页
字号:
.SpIf \fIfront-device\fR starts with an \f(CW\*(C`@\*(C'\fR and contains a slash (\f(CW\*(C`/\*(C'\fR), itwill be treated as a Unix socket.  interceptty will create thissocket, and listen for connections.  This is the mode to use for newerversions of \fIVMWare\fR..SpIf \fIfront-device\fR starts with an \f(CW\*(C`@\*(C'\fR and \fIdoesn't\fR contain a slash(\f(CW\*(C`/\*(C'\fR), it will be treated as a local interface name to listen on,followed by a colon, followed by a port.  interceptty will listen onthat interface and port.  Use an interface name of 0 to listen on alllocal interfaces..SpIf \fIfront-device\fR starts with an equal sign (\f(CW\*(C`=\*(C'\fR), it will betreated as a file descriptor to use, or a comma-seperated pair of filedescriptors.  The first file descriptor will be used for reading, andthe second for writing; if only one is specified, it will be used forboth.  These descriptors must already be opened by the program thatstarted interceptty.  This is useful for running interceptty underanother program, such as \fItcpserver\fR, \fIinetd\fR, or \fIstunnel\fR..IP "\-l" 4.IX Item "-l"Line-buffer output, displaying the intercepted data immediately as itcomes in..IP "\-o \fIoutput-file\fR" 4.IX Item "-o output-file"Write output to \fIoutput-file\fR instead of standard output..IP "\-s \fIback-stty\fR" 4.IX Item "-s back-stty"Run \fIstty\fR with the given options on the backend, to configure it.You can use this to set the baud rate, character size, etc.  Youshould only use this if you have a \s-1TTY\s0 as your back\-end..IP "\-q" 4.IX Item "-q"Be quiet.  Don't display intercepted data, and only display errors..IP "\-v" 4.IX Item "-v"Be verbose.  Asks interceptty to just say whatever's on its mind.Useful for debugging..IP "\-V" 4.IX Item "-V"Print the version number and exit..IP "\-p \fIpty-dev\fR" 4.IX Item "-p pty-dev"Use \fIpty-dev\fR as the physical frontend device that interceptty shouldconnect to, instead of creating a pseudo\-tty.  This should be aTTY-compatible device, such as a serial port..IP "\-t \fItty-dev\fR" 4.IX Item "-t tty-dev"Use \fItty-dev\fR as the device that an application should connect to,such as the other end of a pseudo\-tty.  This device is opened and asymlink is created to it, and that's all.  If you're using a devicethat doesn't have two sides to connect to, like a serial port, don'tuse this option, and specify \f(CW\*(C`\-\*(C'\fR for the frontend..Sh "Output".IX Subsection "Output"interceptty prints its output in a fairly unattractive, painful tolook at format.  However, it is very easy for other programs to parse.For an example of how to post-process this output into somethingappropriate to whatever you are intercepting, see the included Perlscript \fIinterceptty-nicedump\fR..PPOutput lines are in this general format:.PP.Vb 7\& < 0x54 (T)\& >       0x4b (K)\& ^ Direction\&   ^^^^ Hex code (to real device)\&        ^^^ ASCII character (to real device)\&         ^^^^ Hex code (from real device)\&              ^^^ ASCII character (from real device).Ve.PPThe direction marker is a '<' if this character was sent \fIto\fR thebackend device, and '>' if it was received \fIfrom\fR the backend device.It is always followed by a single space.  If the character wasreceived from the real device, a tab will appear next (this makes theoutput easier to follow).  After that is the hex code for thecharacter, and the \s-1ASCII\s0 representation of the character if it is an\&\s-1ASCII\s0 character..SH "EXAMPLES".IX Header "EXAMPLES"Here's some examples of some common, useful, or interesting tasks youcan use interceptty for..IP "VMWare" 4.IX Item "VMWare"I wrote this program to watch what a program running under \fIVMWare\fRversion 2 (<http://www.vmware.com/>) was sending to the serial port.To do that, I ran:.Sp.Vb 2\&        interceptty -s 'ispeed 19200 ospeed 19200' -l /dev/ttyS0 |\&                    interceptty-nicedump.Ve.Spthen configured \fIVMWare\fR to use /tmp/interceptty for \s-1COM1\s0..SpNewer versions of \fIVMware\fR use a socket.  You can use them like this:.Sp.Vb 3\&        interceptty -s 'ispeed 19200 ospeed 19200' -l \e\&                    /dev/ttyS0 @/tmp/sersock |\&                    interceptty-nicedump.Ve.Spthen configure VMWare to use a \*(L"named pipe\*(R" at /tmp/sersock..SpYou must start interceptty before you connect the serial device underVMWare.  If you stop interceptty with \s-1CTRL\-C\s0, or if it otherwise shutsdown, once you have connected it, you will need to disconnect andreconnect \s-1COM1\s0 before it will work again..IP "External Serial Monitor" 4.IX Item "External Serial Monitor"If you want to use interceptty as an external serial monitor\-\-\-connected totwo serial ports on your machine and relaying between them, whilerecording the output\-\-\-you can use one device as the backend, and usethe \fI\-p\fR option to tell the frontend not to create it's own tty, butjust use the one you tell it:.Sp.Vb 2\&    interceptty -s 'ispeed 19200 ospeed 19200' /dev/ttyS0 \e\&      -p /dev/ttyS1 -.Ve.SpThat lets you monitor serial communication between two non-PCdevices.  It's likely you'll need to use a null-modem cable to connectone of the devices..IP "Network serial port server" 4.IX Item "Network serial port server"If you have a device connected to your serial port that you want tomake available over the network, you can create a socket frontend.If you just want to create a serial server without monitoring thetraffic, you can use the \-q option:.Sp.Vb 2\&    interceptty -q -s 'ispeed 19200 ospeed 19200' /dev/ttyS0 \e\&      '@0:4001'.Ve.SpNote that this doesn't allow any kind of access control, but you canrun it under a program that does provide access control, liketcpserver.  See the example below..IP "Network serial port client" 4.IX Item "Network serial port client"If you have a device available over a network serial port using asimple \s-1TCP\s0 connection or a telnet connection, you can create a virtualserial port on your system connected to it by using the network deviceas a backend.  I've tested this with several differentserial-to-Ethernet adapters available on the market..Sp.Vb 2\&    interceptty -q '@serial-server.example.com:4001' \e\&      /dev/serial-server.Ve.SpSome Digi brand serial-to-Ethernet adapters can use \fIssh\fR.  Toconnect to this, you can use a program backend:.Sp.Vb 2\&    interceptty -q '!ssh -p 4001 serial-server.example.com' \e\&      /dev/serial-server.Ve.IP "Running under tcpserver/inetd/stunnel" 4.IX Item "Running under tcpserver/inetd/stunnel"To run under tcpserver or inetd, make sure that logging is turned offor directed to a file, then configure a backend of file descriptors 0and 1:.Sp.Vb 2\&    tcpserver 0 9999 \e\&      interceptty -q -s 'ispeed 19200 ospeed 19200' /dev/ttyS0 =0,1.Ve.SH "SECURITY".IX Header "SECURITY"While an effort has been made to make sure that this code is free ofsecurity issues, it has not been thoroughly audited, and should notunder any circumstances be set-UID or set-GID to anything.  If nothingelse, the '\-s' option will probably allow shell escapes, and using aprogram back-end is also dangerous..PPIf this program is run as root, it will set up the pty portion of itspseudo-terminal to be only readable by itself, and will copy theownership and permissions from the real device to the tty portion.  Ittries to change this back before exiting, but if it crashes such thatit doesn't get to run its cleanup code, the ownership and permissionwill stay the same..PPIf it is not run as root, it will make no effort to change thepermissions on the pseudo\-terminal.  If you need to do this, select apseudo-terminal in advance, set the permissions appropriately, and usethe '\-p' and '\-t' options to instruct interceptty to use that deviceinstead of picking its own..SH "SEE ALSO".IX Header "SEE ALSO"\&\fIstty\fR\|(1), \fIminicom\fR\|(1), \fItip\fR\|(1)..SH "LICENSE".IX Header "LICENSE"Copyright 2000\-2004 by Scott Gifford <sgifford@suspectclass.com>This software is licensed under the \s-1GNU\s0 Public License.  See the file\&\s-1COPYING\s0 included with this distribution for details.SH "BUGS".IX Header "BUGS"You must set all serial options, such as baud rate, flow control,etc., up front with the '\-s' option.  Any settings that theapplication sets using interceptty's pseudo-terminal will be ignored.I can't find a way around this; if you have ideas, please let me know..PPWe make no attempt to lock backend device.  We probably should, but Idon't know how to do it portably.  If somebody has a nice \s-1API\s0 functionI can call, I will happily add locking support in..PPThis program has only been tested under Linux, although the code isfairly portable.  I don't have access to another machine with serialports I can play with, so I haven't tried to port it.  I probablywon't port this to any other machines, but if you manage to, pleasesend me the patches and I will include them in future distributions.I have recently added autoconf support, which may be useful in makingthis program more portable.  But to be honest, I just used it so Icould get \*(L"make dist\*(R"..SH "HISTORY".IX Header "HISTORY"interceptty is based in larte part on ttysnoop\-0.12d, by CarlDeclerck.  Any bugs with interceptty should be reported to me, and notto Carl.  I basically adapted ttysnoop for my foul purposes, removedthe parts that weren't necessary anymore, and added appropriate optionprocessing.  ttysnoop was licensed under the \s-1GPL\s0, and I have of coursekept that license for interceptty..SH "AUTHOR".IX Header "AUTHOR"Scott Gifford <sgifford@suspectclass.com>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -