conspy-1.8/0000755000215700017510000000000011552471205011604 5ustar rstuartitconspy-1.8/AUTHORS0000644000215700017510000000007210363661431012654 0ustar rstuartitWritten by "Russell Stuart" conspy-1.8/conspy.c0000644000215700017510000004504211552471202013265 0ustar rstuartit/* * conspy * ------ * * A text-mode VNC like program for Linux virtual terminals. * * Author: Russell Stuart, russell-conspy@stuart.id.au * 22/05/2003 * * To compile: * gcc -Werror -Wall -Wextra -O2 --std=c99 -lncurses -o conspy conspy.c * * * License * ------- * * Copyright (c) 2005,2006,2007,2008,2009,2011 Russell Stuart. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* GNU/kFreeBSD has different #define's */ #if defined(__FreeBSD_kernel__) #define K_UNICODE K_CODE #define IUCLC 0 #endif extern int errno; /* * Version info. */ static char conspy_date[] = "2011-04-17"; static char conspy_version[] = "1.8"; /* * VGA colour definitions, as found in a nibble in an attribute * byte within VGA video memory. */ #define VGA_BLACK 0x00 #define VGA_BLUE 0x01 #define VGA_GREEN 0x02 #define VGA_CYAN 0x03 #define VGA_RED 0x04 #define VGA_MAGENTA 0x05 #define VGA_YELLOW 0x06 #define VGA_WHITE 0x07 /* * Box characters used by the Linux console. */ #define IBM_BLOCK 0x0c #define IBM_BOARD 0x09 #define IBM_BTEE 0xcb #define IBM_CKBOARD 0x0a #define IBM_DARROW 0x19 #define IBM_DEGREE 0xb0 #define IBM_GEQUAL 0x14 #define IBM_HLINE 0xca #define IBM_LANTERN 0xdf #define IBM_LARROW 0x16 #define IBM_LLCORNER 0xc3 #define IBM_LRCORNER 0xc9 #define IBM_LTEE 0xc7 #define IBM_PI 0x1f #define IBM_PLMINUS 0xb1 #define IBM_RTEE 0xcd #define IBM_STERLING 0xa3 #define IBM_TTEE 0xce #define IBM_UARROW 0x18 #define IBM_ULCORNER 0xc6 #define IBM_URCORNER 0xcc #define IBM_VLINE 0xc5 /* * This is the original IBM PC charcter set. I thought this is what the * Linux console would use, but apparently not. */ #if 0 #define IBM_BLOCK 0xdb #define IBM_BTEE 0xc1 #define IBM_BULLET 0xf9 #define IBM_DARROW 0x19 #define IBM_D_BTEE 0xca #define IBM_DEGREE 0xf8 #define IBM_D_HLINE 0xcd #define IBM_DIAMOND 0x04 #define IBM_D_LLCORNER 0xc8 #define IBM_D_LRCORNER 0xbc #define IBM_D_LTEE 0xcc #define IBM_D_RTEE 0xb9 #define IBM_DS_BTEE 0xcf #define IBM_DS_LLCORNER 0xd3 #define IBM_DS_LRCORNER 0xbd #define IBM_DS_LTEE 0xc7 #define IBM_DS_RTEE 0xb6 #define IBM_DS_TTEE 0xd1 #define IBM_DS_ULCORNER 0xd6 #define IBM_DS_URCORNER 0xb7 #define IBM_DS_XCROSS 0xd7 #define IBM_D_TTEE 0xcb #define IBM_D_ULCORNER 0xc9 #define IBM_D_URCORNER 0xbb #define IBM_D_VLINE 0xba #define IBM_D_XCROSS 0xce #define IBM_GEQUAL 0xf2 #define IBM_HLINE 0xc4 #define IBM_LANTERN 0x0f #define IBM_LARROW 0x1b #define IBM_LLCORNER 0xc0 #define IBM_LRCORNER 0xd9 #define IBM_LTEE 0xc3 #define IBM_PLMINUS 0xf1 #define IBM_RARROW 0x1a #define IBM_RTEE 0xb4 #define IBM_SD_BTEE 0xd0 #define IBM_SD_LLCORNER 0xd4 #define IBM_SD_LRCORNER 0xbe #define IBM_SD_LTEE 0xc6 #define IBM_SD_RTEE 0xb5 #define IBM_SD_TTEE 0xd2 #define IBM_SD_ULCORNER 0xd5 #define IBM_SD_URCORNER 0xb8 #define IBM_SD_XCROSS 0xd8 #define IBM_STERLING 0x9c #define IBM_TTEE 0xc2 #define IBM_UARROW 0x18 #define IBM_ULCORNER 0xda #define IBM_URCORNER 0xbf #define IBM_VLINE 0xb3 #define IBM_XCROSS 0xc5 #endif /* * This function maps a VGA colour pair to a curses COLOR_PAIR() * number. In the curses scheme colour pair 0 must be white text * on a black background, so the origin is moved to there. */ #define VGA_PAIR(foreground, background) \ (((foreground) + ((background) << 3)) ^ 0x07) /* * Forward declarations. */ static void cleanup(); static void conspy(int use_colour); static void finish(int signal); static void init_cursesbox(); static void process_command_line(int argc, char** argv); static int setup(); static void syserror(char* message, ...); static void usage(char* message, ...); /* * Local variables. */ static char* me; static struct termios old_termios; static int opt_viewonly; static int tty_handle = -1; static char tty_name[20]; static int device_handle = -1; static char device_name[20]; /* * This array translates a VGA colour (defined above) to a * CURSES colour. */ static short colour_map[] = { COLOR_BLACK, /* VGA_BLACK */ COLOR_BLUE, /* VGA_BLUE */ COLOR_GREEN, /* VGA_GREEN */ COLOR_CYAN, /* VGA_CYAN */ COLOR_RED, /* VGA_RED */ COLOR_MAGENTA, /* VGA_MAGENTA */ COLOR_YELLOW, /* VGA_YELLOW */ COLOR_WHITE, /* VGA_WHITE */ }; /* * Special IBM characters & their translations. */ static unsigned short cursesbox[256]; /* * A character as it appears in the VGA video buffer. */ struct vidchar { #if 0 unsigned char vidchar_char; /* The IBM-ASCII Char code */ unsigned char vidchar_attribute; /* Colour/blink/bold spec */ #define VIDCHAR_CHAR(vidchar) ((vidchar)->vidchar_char) #define VIDCHAR_ATTRIBUTE(vidchar) ((vidchar)->vidchar_attribute) #else unsigned short vidchar_charattr; /* Attr in msb, char in lsb */ #define VIDCHAR_CHAR(vidchar) ((vidchar)->vidchar_charattr & 0xFF) #define VIDCHAR_ATTRIBUTE(vidchar) ((vidchar)->vidchar_charattr >> 8) #endif }; /* * The data returned by reading a /dev/vcsa device. */ struct vidbuf { unsigned char vidbuf_lines; /* Line on screen */ unsigned char vidbuf_columns; /* Columns on screen */ unsigned char vidbuf_curcolumn; /* Column cursor is in */ unsigned char vidbuf_curline; /* Line cursor is in */ struct vidchar vidbuf_chars[200*80]; /* Char in VGA video buf */ }; /* * Options we allow. */ static struct option options[] = { {"version", 0, 0, 'V'}, {"viewonly", 0, 0, 'v'}, {0,0,0,0}, }; /* * Entry point. */ int main(int argc, char** argv) { int use_colour; me = strrchr(argv[0], '/'); me = me == 0 ? argv[0] : me + 1; process_command_line(argc, argv); use_colour = setup(); init_cursesbox(); conspy(use_colour); cleanup(); /* * Clear screen & home cursor. Added when _I_ became confused * as to whether this program was running or not(!) */ if (tigetstr("clear") != (char*)0) { putp(tigetstr("clear")); fflush(stdout); } return 0; } /* * Print our a usage message and exit. */ static void usage(char* message, ...) { va_list list; if (message != 0) { fprintf(stderr, "%s: ", me); va_start(list, message); vfprintf(stderr, message, list); va_end(list); fprintf(stderr, ".\n"); } fprintf(stderr, "usage: %s [options] [virtual_console].\n", me); fprintf(stderr, "options:\n"); fprintf(stderr, " -V,--version Print %s's version number and exit.\n", me); fprintf(stderr, " -v,--viewonly Don't send keystrokes to the console.\n"); fprintf(stderr, "virtual_console:\n"); fprintf(stderr, " omitted Track the current console.\n"); fprintf(stderr, " 1..63 Virtual console N.\n"); fprintf(stderr, "To exit, quickly press escape 3 times.\n"); exit(1); } /* * Process the command line. */ static void process_command_line(int argc, char** argv) { char* end; int opt; size_t optindex; char opts[(sizeof(options) / sizeof(*options))*2 + 1]; char vcc_name[sizeof(device_name)]; int vcc_errno; char vcsa_name[sizeof(device_name)]; int vcsa_errno; char* virtual_console; opt = 0; for (optindex = 0; optindex < sizeof(options)/sizeof(*options); optindex += 1) { opts[opt++] = options[optindex].val; if (options[optindex].has_arg) opts[opt++] = ':'; } opts[opt] = '\0'; while ((opt = getopt_long(argc, argv, opts, options, 0)) != -1) { switch (opt) { case 'V': printf("%s: version %s %s\n", me, conspy_version, conspy_date); exit(0); case 'v': opt_viewonly = 1; break; default: usage(0); } } virtual_console = argv[optind]; if (virtual_console != 0) { strtol(virtual_console, &end, 10); if (*end != '\0' || end - virtual_console > 2) usage("invalid virtual console \"%s\"", virtual_console); } /* * Verify we can open the devices. */ strcpy(vcsa_name, "/dev/vcsa"); vcc_errno = 0; if (virtual_console != 0) strcat(vcsa_name, virtual_console); strcpy(vcc_name, "/dev/vcc/a"); if (virtual_console != 0 && *virtual_console != '\0') strcat(vcc_name, virtual_console); else strcat(vcc_name, "0"); strcpy(device_name, vcsa_name); device_handle = open(vcsa_name, O_RDONLY); vcsa_errno = errno; if (device_handle == -1) { strcpy(device_name, vcc_name); device_handle = open(vcc_name, O_RDONLY); vcc_errno = errno; } if (device_handle == -1) { fprintf(stderr, "%s: could not open either the alternate device files.\n", me); errno = vcsa_errno; perror(vcsa_name); errno = vcc_errno; perror(vcc_name); exit(1); } if (!opt_viewonly) { strcpy(tty_name, "/dev/tty"); if (virtual_console != 0 && *virtual_console != '\0') strcat(tty_name, virtual_console); else strcat(tty_name, "0"); tty_handle = open(tty_name, O_WRONLY); if (tty_handle == -1 && errno == ENOENT) { strcpy(tty_name, "/dev/vc/"); if (virtual_console != 0 && *virtual_console != '\0') strcat(tty_name, virtual_console); else strcat(tty_name, "0"); tty_handle = open(tty_name, O_WRONLY); } if (tty_handle == -1) { perror(tty_name); exit(1); } } } /* * Initialise the Curses box char set. This must follow */ static void init_cursesbox() { cursesbox[IBM_BLOCK] = ACS_BLOCK; cursesbox[IBM_BOARD] = ACS_BOARD; cursesbox[IBM_BTEE] = ACS_BTEE; cursesbox[IBM_CKBOARD] = ACS_CKBOARD; cursesbox[IBM_DARROW] = ACS_DARROW; cursesbox[IBM_DEGREE] = ACS_DEGREE; cursesbox[IBM_GEQUAL] = ACS_GEQUAL; cursesbox[IBM_HLINE] = ACS_HLINE; cursesbox[IBM_LANTERN] = ACS_LANTERN; cursesbox[IBM_LARROW] = ACS_LARROW; cursesbox[IBM_LLCORNER] = ACS_LLCORNER; cursesbox[IBM_LRCORNER] = ACS_LRCORNER; cursesbox[IBM_LTEE] = ACS_LTEE; cursesbox[IBM_PI] = ACS_PI; cursesbox[IBM_PLMINUS] = ACS_PLMINUS; cursesbox[IBM_RTEE] = ACS_RTEE; cursesbox[IBM_STERLING] = ACS_STERLING; cursesbox[IBM_TTEE] = ACS_TTEE; cursesbox[IBM_UARROW] = ACS_UARROW; cursesbox[IBM_ULCORNER] = ACS_ULCORNER; cursesbox[IBM_URCORNER] = ACS_URCORNER; cursesbox[IBM_VLINE] = ACS_VLINE; } /* * Print an OS error and die. */ static void syserror(char* message, ...) { int errnr = errno; va_list list; cleanup(); va_start(list, message); vfprintf(stderr, message, list); va_end(list); fprintf(stderr, ": %s.\n", strerror(errnr)); exit(1); } /* * Die, possibly from a signal. */ static void finish(int sig) { sigset_t sigset; cleanup(); if (sig <= 0) exit(-sig); sigemptyset(&sigset); sigaddset(&sigset, sig); sigprocmask(SIG_UNBLOCK, &sigset, 0); signal(sig, SIG_DFL); kill(getpid(), sig); pause(); } /* * Set up curses and the TTY. */ static int setup() { int colour; int background; int foreground; struct termios termios; int use_colour; /* * Get a copy of the current TTY settings. */ if (tcgetattr(0, &old_termios) == -1) { perror("tcgetattr(0)"); exit(1); } /* * Start curses. */ (void)signal(SIGHUP, finish); (void)signal(SIGINT, finish); (void)signal(SIGTERM, finish); (void)initscr(); (void)nonl(); /* * Set up the tty. All characters must be passed through to * us unaltered. */ termios = old_termios; termios.c_iflag &= ~(BRKINT|INLCR|ICRNL|IXON|IXOFF|IUCLC|IXANY|IMAXBEL); termios.c_oflag &= ~(OPOST); termios.c_lflag &= ~(ISIG|ICANON|ECHO); if (tcsetattr(0, TCSANOW, &termios) == -1) syserror("tcsetattr(0)"); /* * Set up the colour map, if we can. */ use_colour = 0; if (has_colors()) { start_color(); if (COLOR_PAIRS >= 64) use_colour = 1; } if (use_colour) { for (foreground = 0; foreground < 8; foreground += 1) { for (background = 0; background < 8; background += 1) { colour = VGA_PAIR(foreground, background); if (colour != 0) init_pair(colour, colour_map[foreground], colour_map[background]); } } } return use_colour; } /* * Shut down curses, and restore everything. */ static void cleanup() { tcsetattr(0, TCSANOW, &old_termios); endwin(); if (device_handle != -1) close(device_handle); if (tty_handle != -1) close(tty_handle); } /* * This is where the actual work is done. */ static void conspy(int use_colour) { unsigned short box; int buffer_size; int bytes_read; unsigned int column; attr_t curses_attribute; short curses_colour; int escape_pressed; int escape_notpressed; int ioerror_count; int key_count; int key_index; long keyboard_mode; char keys_pressed[256]; unsigned int last_attribute; unsigned int last_columns; unsigned int last_rows; unsigned int line; chtype line_buf[256]; int line_chars; fd_set readset; int result; struct timeval timeval; int tty_result; unsigned int video_attribute; int video_char; struct vidbuf vidbuf; struct vidchar* vidchar; curses_colour = 0; curses_attribute = 0; escape_notpressed = 0; escape_pressed = 0; ioerror_count = 0; key_count = 0; last_attribute = ~0U; last_columns = 0; last_rows = 0; for (;;) { /* * Read the video buffer. */ if (lseek(device_handle, 0L, SEEK_SET) != 0L) syserror(device_name); bytes_read = read(device_handle, &vidbuf, sizeof(vidbuf)); if (bytes_read == -1) syserror(device_name); buffer_size = 4 + vidbuf.vidbuf_lines * vidbuf.vidbuf_columns * sizeof(struct vidchar); if (buffer_size > (int)sizeof(vidbuf)) { fprintf( stderr, "%s: screen too large. I only handle up to 200x80.\n", me); cleanup(); exit(1); } if (bytes_read != buffer_size) syserror("read wrong number of chars"); /* * If the screen size has changed blank out the unused portions. */ if (vidbuf.vidbuf_lines < last_rows && last_rows < (unsigned)LINES) { move(vidbuf.vidbuf_lines, 0); clrtobot(); } if (vidbuf.vidbuf_columns < last_columns && last_columns < (unsigned)COLS) { for (line = 0; line < last_rows && line < (unsigned)LINES; line += 1) { move(line, last_columns); clrtoeol(); } } last_rows = vidbuf.vidbuf_lines; last_columns = vidbuf.vidbuf_columns; /* * Write the data to the screen. */ vidchar = vidbuf.vidbuf_chars; for (line = 0; line < vidbuf.vidbuf_lines && line < (unsigned)LINES; line += 1) { line_chars = 0; for (column = 0; column < vidbuf.vidbuf_columns; column += 1) { if (column >= (unsigned)COLS) { vidchar += vidbuf.vidbuf_columns - column; break; } video_attribute = VIDCHAR_ATTRIBUTE(vidchar); video_char = VIDCHAR_CHAR(vidchar); box = cursesbox[video_char]; if (box != 0) { video_attribute |= 0x100; video_char = box; } if (video_char < ' ') video_char = ' '; if (video_attribute != last_attribute) { if (line_chars > 0) { move(line, column - line_chars); addchnstr(line_buf, line_chars); wchgat(stdscr, line_chars, curses_attribute, curses_colour, 0); line_chars = 0; } curses_attribute = A_NORMAL; if (video_attribute & 0x100) curses_attribute |= A_ALTCHARSET; if (video_attribute & 0x80) curses_attribute |= A_BLINK; if (video_attribute & 0x08) curses_attribute |= A_BOLD; if (use_colour) { curses_colour = VGA_PAIR(video_attribute & 0x7, video_attribute>>4 & 0x7); } last_attribute = video_attribute; } line_buf[line_chars++] = video_char; vidchar += 1; } move(line, column - line_chars); addchnstr(line_buf, line_chars); wchgat(stdscr, line_chars, curses_attribute, curses_colour, 0); } if (vidbuf.vidbuf_curline < LINES && vidbuf.vidbuf_curcolumn < COLS) move(vidbuf.vidbuf_curline, vidbuf.vidbuf_curcolumn); refresh(); /* * Wait for 1/4 or a second, or for a character to be pressed. */ FD_ZERO(&readset); FD_SET(0, &readset); timeval.tv_sec = 0; timeval.tv_usec = 250 * 1000L; result = select(0 + 1, &readset, 0, 0, &timeval); if (result == -1) { if (errno != EINTR) syserror("select([tty_handle],0,0,timeval)"); endwin(); refresh(); continue; } /* * Read the keys pressed. */ bytes_read = 0; if (result == 1) { bytes_read = read(0, keys_pressed + key_count, sizeof(keys_pressed) - key_count); if (bytes_read < 0) syserror(tty_name); } /* * Do exit processing. */ if (result == 0 && ++escape_notpressed == 4) { /* >1sec since last key press */ escape_pressed = 0; /* That ends any exit sequence */ escape_notpressed = 0; } for (key_index = key_count; key_index 4) syserror(tty_name); } } } conspy-1.8/INSTALL0000644000215700017510000002202410363661431012636 0ustar rstuartitCopyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. conspy-1.8/conspy.html0000644000215700017510000000755411552471202014015 0ustar rstuartit Conspy - remote control of Linux virtual consoles

Conspy
Remote control of Linux virtual consoles

Conspy allows a (possibly remote) user to see what is displayed on a Linux virtual console, and send keystrokes to it. It works with Linux and FreeBSD, as far as I know.

It is rather like VNC, but where VNC takes control of a GUI conspy takes control of a text mode virtual console. Unlike VNC, conspy does not require a server to be installed prior to being used.

Documentation

Sparse. There is a man page, and a ChangeLog.

Frequently asked question

Q: Can conspy look at other types of terminals, such as a normal serial terminal, or a pty such as a telnet session?

A: No. Nor will it ever be able to do so. Conspy does not intercept the character stream being sent to the virtual console. If it did that it would have to interpret all the ANSI escape sequences understood by the Linux virtual console exactly the same way Linux does. That would be tedious, and would break each time Linux changes the escape sequences. Instead conspy asks the Linux kernel for the virtual console's frame buffer. That is, it gets an image of what is displayed on the screen and makes your terminal look the same. There is no way to do that for other tty's. If conspy was to work with them it would have to interpret the character stream as it passes through the tty. This is well neigh impossible because there are many different types of terminal out there and they all use different escape sequences. If all you all to do it look at the raw character stream as it passes through the tty look up ttysnoop on Freshmeat.

Copyright and License

Conspy is copyright © 2005,2006,2007,2009,2011 Russell Stuart.

This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html.

Downloading

Conspy is available in the following formats:

Source code as a tar ball    conspy-1.8.tar.gz
Debian Packages    Conspy is now part of Debian stable.

 


Russell Stuart, 2006-Jan-09. Email: russell-conspy@stuart.id.au

conspy-1.8/release.sh0000755000215700017510000000457311552471010013566 0ustar rstuartit#!/bin/bash # # Build the release directory for the web, and the .orig.tar.gz # for the debian package. # set -e ME=$(basename $PWD) PACKAGE=${ME%-*} VERSION=${ME#*-} YEAR=$(date +%Y) MONTH=$(date +%b) DATE=$(date +%Y-%m-%d) # # Update all the version numbers and dates. # sed -i "s/^\([.].\" Copyright (c) \)2[0-9]*/\1${YEAR}/" "${PACKAGE}.1" sed -i "s/^\([.]TH [A-Z]* 1 \"\)[^\"]*\(\".*Version[ ]\+\)[1-9][0-9]*[.][0-9]\+/\1${MONTH} ${YEAR}\2${VERSION}/" "${PACKAGE}.1" sed -i "/${YEAR}/!s/^\( [*].*Copyright (c) .*2[0-9]*\)\([ ]*Russell Stuart\)/\1,${YEAR}\2/" "${PACKAGE}.c" sed -i "s/^\(static.*_version..[ ]*=[ ]*\"\)[^\"]*/\1${VERSION}/" "${PACKAGE}.c" sed -i "s/^\(static.*_date..[ ]*=[ ]*\"\)[^\"]*/\1${DATE}/" "${PACKAGE}.c" sed -i "/${YEAR}/!s/\(.* is copyright © .*2[0-9]*\)\([ ]*Russell Stuart\)/\1,${YEAR}\2/" "${PACKAGE}.html" sed -i "s/${PACKAGE}-[1-9][0-9]*[.][0-9]\+/${ME}/g" "${PACKAGE}.html" sed -i "s/\(Version:[ ]\+\)[1-9][0-9]*[.][0-9]\+/\1${VERSION}/" "${PACKAGE}.spec" sed -i "s/\(AM_INIT_AUTOMAKE(${PACKAGE}, \+\)[1-9][0-9]*[.][0-9]\+/\1${VERSION}/" configure.in sed -i "/${YEAR}/!s/^\( *Copyright (c) .*2[0-9]*\)\([ ]*Russell Stuart\)/\1,${YEAR}\2/" README # # Run automake and friends. # rm -f config.status # Force debian configure debian/rules configure debian/rules clean # # Build the www directory. # rm -rf ${PACKAGE} mkdir -p "${PACKAGE}" (cd ..; tar cfz "${ME}/${PACKAGE}/${ME}.tar.gz" --exclude="${ME}/debian" --exclude="${ME}/${PACKAGE}" --exclude="${ME}/.pc" "${ME}") cp -a ChangeLog AUTHORS README epl-v10.html "${PACKAGE}.html" "${PACKAGE}" ln -s "${PACKAGE}.html" conspy/index.html man2html <"${PACKAGE}.1" | sed >"${PACKAGE}/conspy.1.html" -e 1,2d -e 7,8d -e '/^
/,/^Time: /d' #mkdir -p ${PACKAGE}/rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS} #echo >"${PACKAGE}/rpm/rpmrc" "macrofiles : /usr/lib/rpm/macros:/usr/lib/rpm/i686-linux/macros:/etc/rpm/macros.specspo:/etc/rpm/macros.db1:/etc/rpm/macros.cdb:/etc/rpm/macros:/etc/rpm/i686-linux/macros:${PWD}/${PACKAGE}/rpm/rpmmacros" #echo >"${PACKAGE}/rpm/rpmmacros" "%_topdir ${PWD}/${PACKAGE}/rpm" #TAR_OPTIONS=--wildcards rpmbuild -ta --rcfile "/usr/lib/rpm/rpmrc:${PACKAGE}/rpm/rpmrc" "${PACKAGE}/${ME}.tar.gz" #mv ${PACKAGE}/rpm/SRPMS/${ME}-1ras.src.rpm ${PACKAGE} #mv "${PACKAGE}/rpm/RPMS/x86_64/${ME}-1ras.x86_64.rpm" "${PACKAGE}" #rm -r "${PACKAGE}/rpm" cp "${PACKAGE}/${ME}.tar.gz" "../${ME%-*}_${VERSION}.orig.tar.gz" conspy-1.8/Makefile.am0000644000215700017510000000022111552470361013635 0ustar rstuartitCLEANFILES = *~ EXTRA_DIST = ${MANS} man_MANS = conspy.1 bin_PROGRAMS = conspy conspy_SOURCES = conspy.c clean-local: rm -rf conspy index.html conspy-1.8/README0000644000215700017510000000114011552471202012455 0ustar rstuartitConspy ------ This program is like VNC - but allows you to take over a text mode Linux virtual console rather than GUI. To install just run the usual: ./configure ./make ./make install For what little extra doco there is see usage message, or the man entry. License ------- Copyright (c) 2007,2009,2011 Russell Stuart. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html -- Russell Stuart 2007-Jul-27 conspy-1.8/conspy.spec0000644000215700017510000000217411552471202013774 0ustar rstuartitSummary: Remote control for text mode virtual consoles Name: conspy Version: 1.8 Release: 1ras Distribution: RedHat 7.2 Contrib Group: Applications/System License: EPL Packager: Russell Stuart Vendor: Russell Stuart Url: http://www.stuart.id.au/russell/files/%{name}/%{name}-%{version}.tar.gz Source: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-root %description Conspy takes over a text mode Linux virtual console in much the same manner as VNC allows a remote user to take over a GUI. %prep %setup %build aclocal-1.10 automake-1.10 --foreign --add-missing --copy autoconf %configure make %install rm -rf %{buildroot} %makeinstall %clean rm -rf %{buildroot} %files %defattr(-,root,root) %{_bindir}/conspy %doc %{_mandir}/man1/* %changelog * Sun Jan 19 2006 Russell Stuart - New upstream release. * Sun Jan 9 2006 Russell Stuart - New upstream release. * Sun Jan 1 2006 Russell Stuart - New upstream release. * Wed May 21 2003 Russell Stuart - Initial RPM conspy-1.8/ChangeLog0000644000215700017510000000300511552463536013364 0ustar rstuartitconspy-1.8 Sun, 17 Apr 2011 13:58:49 +1000 Bug: Fix passing a bad option causing a segfault. conspy-1.7 Sun, 23 Aug 2009 19:37:15 +1000 New: Improve error reporting when device can't be opened. conspy-1.6 Thu, 4 Jun 2009 13:38:16 +1000 Bug: Build fixes. Reduces tarball size by a factor of 3. conspy-1.5 Fri Jul 27 13:00:22 EST 2007 New: Now works on freebsd. Thanks to Cyril Brulebois for finding and problem and supplying the patch. New: Changed License to EPL. conspy-1.4 Sat, 14 Jan 2006 18:36:07 +1000 Bug: Now works with big endian machines. conspy-1.3 Sun, 9 Jan 2006 11:57:14 +1000 Bug: Documented screen size limitation. Bug: Prints an error message if max screen size is exceeded, rather than segfaulting. New: Raised max screen size to 16000 characters. conspy-1.2 Sun, 1 Jan 2006 14:19:02 +1000 Bug: Fixed a segmentation violation in the argument parsing code. conspy-1.1 Mon, 8 Dec 2003 10:01:11 +1000 Bug: Unblock all signals when exiting because we were killed by a signal. Not sure if this is a problem in the real world, but was wrong nonetheless. Bug: Close and re-open the destination tty every time a key is pressed. This will (hopefully) fix errors that occasionally occur when the user logs in. New: Now handles devfs device names (/dev/ttyX --> /dev/vc/X, and /dev/vcsaX --> /dev/vcc/aX). New: Added the Debian package. conspy-1.0 Wed May 21 13:54:14 EST 2003 New: Epoc. Changes? What changes? I got it right first time. conspy-1.8/configure.in0000644000215700017510000000106111552471202014110 0ustar rstuartit# Process this file with autoconf to produce a configure script. AC_INIT(conspy.c) AM_INIT_AUTOMAKE(conspy, 1.8) # Checks for programs. AC_PROG_CC # Checks for libraries. # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h getopt.h stdarg.h stdlib.h string.h sys/ioctl.h sys/time.h termios.h unistd.h]) AC_CHECK_LIB(ncurses, initscr) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_TIME # Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_TYPE_SIGNAL AC_CHECK_FUNCS([select strtol]) AC_OUTPUT([Makefile]) conspy-1.8/epl-v10.html0000644000215700017510000004171610652260523013666 0ustar rstuartit Eclipse Public License - Version 1.0

Eclipse Public License - v 1.0

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.

1. DEFINITIONS

"Contribution" means:

a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
b) in the case of each subsequent Contributor:

i) changes to the Program, and

ii) additions to the Program;

where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.

"Contributor" means any person or entity that distributes the Program.

"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.

"Program" means the Contributions distributed in accordance with this Agreement.

"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.

2. GRANT OF RIGHTS

a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.

b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.

c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.

d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.

3. REQUIREMENTS

A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:

a) it complies with the terms and conditions of this Agreement; and

b) its license agreement:

i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;

ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;

iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and

iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.

When the Program is made available in source code form:

a) it must be made available under this Agreement; and

b) a copy of this Agreement must be included with each copy of the Program.

Contributors may not remove or alter any copyright notices contained within the Program.

Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.

4. COMMERCIAL DISTRIBUTION

Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.

For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.

5. NO WARRANTY

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.

6. DISCLAIMER OF LIABILITY

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

7. GENERAL

If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.

If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.

All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.

Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.

This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.

 

conspy-1.8/conspy.10000644000215700017510000000362211552471202013201 0ustar rstuartit.\" Copyright (c) 2011 Russell Stuart .TH CONSPY 1 "Apr 2011" "Version 1.8" "conspy" .SH NAME conspy \- virtual console spy tool .SH SYNOPSIS .B conspy [ options ] [ .I console ] .SH DESCRIPTION .I Conspy allows the user to take control of a Linux virtual console. The user can see what is displayed on the console and their keystrokes are sent to it. .PP To exit from .I conspy press the escape key three times in quick succession. .PP .SH COMMAND LINE .IP "\fB-V, \fB--version\fP" Print the program's version and exit. .IP "\fB-v\fP, \fB--viewonly\fP" Don't send keystrokes to the virtual console. .IP "\fIconsole\fP" If supplied, .I console must be a number in the range 1 .. 63, corresponding to the virtual console device /dev/tty1 .. /dev/tty63. If not supplied the currently active virtual console is opened and tracked. .SH LIMITATIONS .I Conspy will not pass keystrokes to a virtual console whose keyboard is configured to send scan codes. X configures its keyboard like this. If the terminal does not have at least 64 colours no colour will be displayed. .I Conspy ignores the mouse. .I Conspy may display some non-ASCII characters incorrectly. .I Conspy does not handle displays larger than 16000 characters (eg 200 rows x 80 columns). .PP .I Conspy depends on terminfo and curses working correctly for your terminal, and sometimes they don't. Konsole is/was one example of where they don't. Typing control-L will redraw the screen, which usually fixes the mess created. It also sends a control-L to the virtual console, of course. .SH FILES .IP "\fB/dev/ttyX\fP, \fB/dev/vc/X\fP" The characters typed are sent to this device. The latter is for devfs. It is only used if the former does not exist. .IP "\fB/dev/vcsaX\fP, \fB/dev/vcc/aX\fP" The display of the virtual console is read from here. The latter is for devfs. It is only used if the former does not exist. .SH AUTHOR Russell Stuart, .