conspy-1.17/ 0000755 0002157 0001751 00000000000 15205543125 011664 5 ustar rstuart it conspy-1.17/.deps/ 0000755 0002157 0001751 00000000000 15205543124 012674 5 ustar rstuart it conspy-1.17/.claude/ 0000755 0002157 0001751 00000000000 15205543123 013175 5 ustar rstuart it conspy-1.17/.claude/settings.local.json 0000644 0002157 0001751 00000000625 15205543123 017024 0 ustar rstuart it {
"permissions": {
"allow": [
"WebFetch(domain:sourceforge.net)",
"Bash(hg status *)",
"Bash(hg log *)",
"Bash(gcc *)",
"Bash(hg diff *)",
"Bash(/tmp/conspy-fixed -V)",
"Bash(apt-cache policy *)",
"Bash(dpkg -s debian-policy)",
"WebFetch(domain:packages.debian.org)",
"Bash(make release *)",
"Bash(make release-clean *)"
]
}
}
conspy-1.17/Makefile.release 0000644 0002157 0001751 00000023314 15205543125 014746 0 ustar rstuart it #
# Do a release.
#
# This is file is identical for _all_ sourceforge projects I host. It is
# designed to one thing: automate my sourceforce work flow. Be warned that
# I will selfishly reject any patches that don't do that.
#
# It does the following:
#
# 1. Verifies the changelogs have been updated to a consistent version.
#
# 2. Updates the verison numbers and copyright dates in all source files.
#
# 3. Builds the source tarball.
#
# 4. If there is a debian directory builds the debian source and binary
# packages.
#
# 5. If there is a .spec file, buids the rpm source and binary packages.
#
# 6. Sends the released files (tarball, debian and rpm packages) to the
# release area.
#
# 7. Sends the HTML file, and other files references by it, to the web
# site.
#
# Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020,2021,2023,2024,2025,2026 Russell Stuart.
# Licensed (at your choice) under GPLv2, or any later version,
# or AGPL-3.0+, or any later version.
#
RELEASE_ME=$(shell sed -n '1s/ .*//p' ChangeLog.txt)
RELEASE_PACKAGE_NAME=$(shell echo "$(RELEASE_ME)" | sed 's/-[^-]*$$//')
RELEASE_PACKAGE_VERSION=$(shell echo "$(RELEASE_ME)" | sed 's/.*-//')
RELEASE_YEAR=$(shell date +%Y)
RELEASE_MONTH=$(shell date +%b)
RELEASE_DATE=$(shell date +%Y-%m-%d)
RELEASE_DEBIAN_VERSION=$(shell [ ! -d debian ] || sed -n 's/[^(]*(\([^)]*\)).*/\1/p;q' debian/changelog)
RELEASE_VERSION=$(shell [ ! -d debian ] && printf "$(RELEASE_PACKAGE_VERSION)" || printf "$(RELEASE_DEBIAN_VERSION)")
RELEASE_DIR=release.tmp
RELEASE_HTDOCS=$(RELEASE_DIR)/htdocs
RELEASE_FILES=$(RELEASE_DIR)/$(RELEASE_PACKAGE_NAME)-$(RELEASE_VERSION)
ifndef RELEASE_SOURCEFORGE_NAME
RELEASE_SOURCEFORGE_NAME=$(RELEASE_PACKAGE_NAME)
endif
.PHONY: release
release: $(RELEASE_DIR)/release.stamp
$(RELEASE_DIR)/release.stamp: $(RELEASE_SOURCES)
@echo ME=$(RELEASE_ME) PACKAGE=$(RELEASE_PACKAGE_NAME) SOURCEFORGE=$(RELEASE_SOURCEFORGE_NAME) VERSION=$(RELEASE_PACKAGE_VERSION) YEAR=$(RELEASE_YEAR) MONTH=$(RELEASE_MONTH) DATE=$(RELEASE_DATE) DEBIAN_VERSION=$(RELEASE_DEBIAN_VERSION)
#
# Ensure the Debian changelog matches this version.
#
[ ! -d debian ] || { \
debian_version="$(RELEASE_DEBIAN_VERSION)" ; \
[ "$(RELEASE_PACKAGE_NAME)-$${debian_version%-*}" = "$(RELEASE_ME)" ] || \
{ echo 1>&2 "debian/changelog: changelog is out of date."; exit 1; }; }
$(MAKE) release-clean
#
# Check changes have reflected in mercurial.
#
! hg status | grep '^?' || { echo "hg add hasn't been done" 1>&2; exit 1; }
! hg status | grep '^!' || { echo "hg rm hasn't been done" 1>&2; exit 1; }
[ -z "$$(hg resolv --list | grep -v ^R)" ] || { echo "There are unresolved merge conflicts" 1>&2; exit 1; }
#
# Update all the version numbers and dates.
#
set -e; for f in $(wildcard *.1); do \
sed -i "s/^\([.].\" Copyright (c) \)2[0-9]*/\1$(RELEASE_YEAR)/" "$${f}"; \
sed -i "s/^\([.]TH [A-Z]* 1 \"\)[^\"]*\(\".*Version[ ]\+\)[1-9][0-9]*[.][0-9]\+/\1$(RELEASE_MONTH) $(RELEASE_YEAR)\2$(RELEASE_PACKAGE_VERSION)/" "$${f}"; \
done
set -e; for f in $$(find . -name "*.c" -o -name "*.h"); do \
sed -i "/$(RELEASE_YEAR)/!s/\(Copyright (c) [-0-9, ]*2[0-9]*\)\(,\? *Russell Stuart\)/\1,$(RELEASE_YEAR)\2/" "$${f}"; \
sed -i "s/^\(static.*_version..[ ]*=[ ]*\"\)[^\"]*/\1$(RELEASE_PACKAGE_VERSION)/" "$${f}"; \
sed -i "s/^\(static.*_date..[ ]*=[ ]*\"\)[^\"]*/\1$(RELEASE_DATE)/" "$${f}"; \
done
set -e; for f in $$(find . -name "*.py"); do \
sed -i 's/^\(VERSION[ ]*=[ ]*"\)[^ "]*/\1$(RELEASE_PACKAGE_VERSION)/' $${f}; \
sed -i 's/^\(VERSION[ ]*=[ ]*"[^ ]* \+\)[^"]*/\1$(RELEASE_DATE)/' $${f}; \
done
set -e; for f in $$(find . -name "*.rst" -o -name "*.py" -o -name "Makefile*") README.txt; do \
sed -i "/$(RELEASE_YEAR)/!s/\(Copyright (c) [-0-9, ]*2[0-9]*\)\(,\? *Russell Stuart\)/\1,$(RELEASE_YEAR)\2/" "$${f}"; \
done
set -e; for f in $$(find . -name "setup.py"); do \
sed -i 's/^\([ ]*version="\)[0-9]\+[.][0-9.]\+/\1$(RELEASE_PACKAGE_VERSION)/' "$${f}"; \
done
ifneq ($(wildcard $(RELEASE_PACKAGE_NAME).spec),)
sed -i "s/\(Version:[ ]\+\)[0-9]\+[.][0-9.]\+/\1$(RELEASE_PACKAGE_VERSION)/" "$(RELEASE_PACKAGE_NAME).spec"
endif
ifneq ($(wildcard configure.ac),)
sed -i "s/\(AC_INIT(\[\?$(RELEASE_PACKAGE_NAME)\]\?, *\[\?\)[0-9]\+[.][0-9.]\+/\1$(RELEASE_PACKAGE_VERSION)/" configure.ac
endif
ifneq ($(wildcard doc/conf.py),)
sed -i "/$(RELEASE_YEAR)/!s/^\( *copyright *= *u'[-0-9, ]*2[0-9]*\)\(,\?[ ]*Russell Stuart\)/\1,$(RELEASE_YEAR)\2/" doc/conf.py
sed -i "s/^\( *\(version\|release\) *= *u\?'\)[0-9]\+[.][0-9.]\+'/\1$(RELEASE_PACKAGE_VERSION)'/" doc/conf.py
endif
sed -i "/$(RELEASE_YEAR)/!s/\(.* is copyright © [-0-9, ]*2[0-9]*\)\(,\?[ ]*Russell Stuart\)/\1,$(RELEASE_YEAR)\2/" "$(RELEASE_PACKAGE_NAME).html"
sed -i "s/$(RELEASE_PACKAGE_NAME)-[1-9][0-9]*[.][0-9]\+/$(RELEASE_ME)/g" "$(RELEASE_PACKAGE_NAME).html"
sed -i "/$(RELEASE_YEAR)/!s/\(Copyright (c) [-0-9, ]*2[0-9]*\)\(,\? *Russell Stuart\)/\1,$(RELEASE_YEAR)\2/" README.txt
#
# Do any custom stuff.
#
$(MAKE) release-customise
#
# Build the release source tarball.
#
(set -exv; d="$${PWD##*/}" && sd=$$(echo "$$d" | sed 's/\./[.]/g') && cd .. && tar cfz "$(RELEASE_PACKAGE_NAME)_$(RELEASE_PACKAGE_VERSION).orig.tar.gz" --exclude="$${d}/debian" --exclude="$${d}/.hg*" --exclude-vcs --transform "s;^$${sd}\(/\|\$$\);$(RELEASE_ME)\1;" "$${d}")
#
# Insert the debian packages into the release.
#
[ ! -d debian ] || DEBIAN_KERNEL_USE_CCACHE="yes" debuild --preserve-env --preserve-envvar="PATH" -k0xF5231C62E7843A8C -sa --lintian-opts --info --display-info --display-experimental --suppress-tags bugs-field-does-not-refer-to-debian-infrastructure,debian-rules-contains-unnecessary-get-orig-source-target,initial-upload-closes-no-bugs,no-dh-sequencer
mkdir -p "$(RELEASE_FILES)"
[ ! -d debian ] || rm ../$(RELEASE_PACKAGE_NAME)_$(RELEASE_DEBIAN_VERSION)_*.build
[ ! -d debian ] || { set -xve; mv $$(sed -n '1,/^Files:/d;/^$$/q;s:.* :../:p' ../$(RELEASE_PACKAGE_NAME)_$(RELEASE_DEBIAN_VERSION)_*.changes) ../$(RELEASE_PACKAGE_NAME)_$(RELEASE_DEBIAN_VERSION)_*.changes $(RELEASE_FILES); }
[ -d debian ] || mv "../$(RELEASE_PACKAGE_NAME)_$(RELEASE_PACKAGE_VERSION).orig.tar.gz" "$(RELEASE_FILES)"
mv "$(RELEASE_FILES)/$(RELEASE_PACKAGE_NAME)_$(RELEASE_PACKAGE_VERSION).orig.tar.gz" "$(RELEASE_FILES)/$(RELEASE_ME).tar.gz"
ifneq ($(wildcard $(RELEASE_PACKAGE_NAME).spec),)
#
# Build the RPM package.
#
mkdir -p "$(RELEASE_DIR)/rpm/BUILD"
mkdir -p "$(RELEASE_DIR)/rpm/RPMS"
mkdir -p "$(RELEASE_DIR)/rpm/SOURCES"
mkdir -p "$(RELEASE_DIR)/rpm/SPECS"
mkdir -p "$(RELEASE_DIR)/rpm/SRPMS"
echo >"$(RELEASE_DIR)/rpm/rpmmacros" "%_topdir $(PWD)/$(RELEASE_DIR)/rpm"
TAR_OPTIONS=--wildcards rpmbuild -ta --macros "/usr/lib/rpm/macros:/usr/lib/rpm/platform/$(shell dpkg-architecture -qDEB_HOST_GNU_CPU)-$(shell dpkg-architecture -qDEB_HOST_ARCH_OS)linux/macros:/usr/lib/rpm/platform/noarch-$(shell dpkg-architecture -qDEB_HOST_ARCH_OS)/macros:$(RELEASE_DIR)/rpm/rpmmacros" "$(RELEASE_FILES)/$(RELEASE_ME).tar.gz"
mv "$(RELEASE_DIR)/rpm/SRPMS/$(RELEASE_ME)-1ras.src.rpm" "$(RELEASE_FILES)"
mv "$(RELEASE_DIR)/rpm/RPMS"/*/"$(RELEASE_ME)-1ras".*."rpm" "$(RELEASE_FILES)"
cp ChangeLog.txt "$(RELEASE_FILES)/README.txt"
endif
#
# Build the htdocs directory as it will appear on the host.
#
mkdir -p "$(RELEASE_HTDOCS)"
cp -a $(RELEASE_PACKAGE_NAME).html $(RELEASE_HTDOCS)
set -e; for f in $$(sed -n 's,<\(a href\|img src\)="https\?://[^"]*"[^>]*>,,;ta;:a;s/.*<\(a href\|img src\)="\([^#/"][^#"]*\)"[^>]*>/\2@@@/g;T;s/@@@\([^@]\|@[^@]\|@@[^@]\)*$$//;s/@@@/ /g;p' "$(RELEASE_PACKAGE_NAME).html"); do \
f="$${f%/}"; \
[ ."$${f%%/*}" = ."$${f}" ] || mkdir -p "$(RELEASE_HTDOCS)/$${f%/*}"; \
case "$${f}" in \
*.[12345678].html) man2html <"$${f%.html}" | sed >"$(RELEASE_HTDOCS)/$${f}" '1,2d;7,8d;/^
/,/^Time: /d';; \
*) cp -a "$${f}" "$(RELEASE_HTDOCS)/$${f}";; \
esac; \
done
ln -s "$(RELEASE_PACKAGE_NAME).html" "$(RELEASE_HTDOCS)/index.html"
echo "Options +Indexes" >"$(RELEASE_HTDOCS)/.htaccess"
#
# Verify there is no rubbish lying wround.
#
! hg status | grep '^?' || { echo '.hgignore: is missing some files' 1>&2; exit 1; }
touch $@
.PHONY: release-customise
release-customise::
.PHONY: release-upload
release-upload: release-upload-htdocs release-upload-files
.PHONY: release-upload-htdocs
release-upload-htdocs: $(RELEASE_DIR)/release.stamp
#
# Send the files that a symlink'ed first, otherwise it fails on the
# 1st send.
#
cd $(RELEASE_DIR); rsync -avPR $$(for f in $$(find htdocs -name index.html -type l); do ff=$$(readlink "$${f}"); echo $${f%/*}/$${ff}; done) rstuart,$(RELEASE_SOURCEFORGE_NAME)@web.sourceforge.net:.
rsync -avP --delete $(RELEASE_HTDOCS)/. rstuart,$(RELEASE_SOURCEFORGE_NAME)@web.sourceforge.net:htdocs/.
.PHONY: release-upload-files
release-upload-files: $(RELEASE_DIR)/release.stamp
rsync -avP --delete $(RELEASE_FILES) rstuart,$(RELEASE_SOURCEFORGE_NAME)@frs.sourceforge.net:/home/frs/project/$(RELEASE_SOURCEFORGE_NAME)/.
.PHONY: release-clean
release-clean: release-project-clean
-[ "$(RELEASE_CLEAN_DONE)" = "yes" -o ! -d debian ] || RELEASE_CLEAN_DONE=yes debian/rules clean
[ ! -d .pc ] || { quilt pop -a; rm -r .pc; }
[ ! -f Makefile-automake ] || $(MAKE) maintainer-clean
rm -rf $(RELEASE_DIR) "$(RELEASE_PACKAGE_NAME).1.html"
rm -rf $$(find . -name "*.orig" -o -name ".*.sw?")
.PHONY: release-tag
release-tag: $(RELEASE_DIR)/release.stamp
! hg status | grep '^?' || { echo "hg add hasn't been done" 1>&2; exit 1; }
! hg status | grep '^!' || { echo "hg rm hasn't been done" 1>&2; exit 1; }
[ -z "$$(hg resolv --list)" ] || { echo "There are unresolved merge conflicts" 1>&2; exit 1; }
[ -z "$$(hg status)" ] || \
hg commit -m "Release $(RELEASE_PACKAGE_NAME)-$(RELEASE_VERSION) - see ChangeLog.txt"
hg tag "$(RELEASE_PACKAGE_NAME)-$(RELEASE_VERSION)"
.PHONY: release-project-clean
release-project-clean::
conspy-1.17/Makefile-automake.am 0000644 0002157 0001751 00000000447 15205543125 015531 0 ustar rstuart it AUTOMAKE_OPTIONS = foreign
CLEANFILES = *~
EXTRA_DIST = ${MANS}
man_MANS = conspy.1
bin_PROGRAMS = conspy
conspy_SOURCES = conspy.c
maintainer-clean-local:
rm -f aclocal.m4 compile config.guess config.sub configure
rm -f depcomp install-sh Makefile-automake.in missing
rm -rf autom4te.cache
conspy-1.17/Makefile 0000644 0002157 0001751 00000000535 15205543125 013327 0 ustar rstuart it -include Makefile-automake
.PHONY: run-autoconf
run-autoconf:
libtoolize
aclocal
automake --add-missing --copy
autoconf
./configure
$(MAKE)
RELEASE_SOURCES = \
ChangeLog.txt \
configure.ac \
conspy.1 \
conspy.c \
conspy.html \
conspy.spec \
Makefile \
Makefile-automake.am \
Makefile.release \
README.txt
include Makefile.release
conspy-1.17/agpl-3.0.txt 0000644 0002157 0001751 00000103330 12437777304 013662 0 ustar rstuart it GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
.
conspy-1.17/conspy.c 0000644 0002157 0001751 00000054052 15205543125 013351 0 ustar rstuart it /*
* 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) 2009-2014,2015,2016,2020,2026 Russell Stuart.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* The copyright holders grant you an additional permission under Section 7
* of the GNU Affero General Public License, version 3, exempting you from
* the requirement in Section 6 of the GNU General Public License, version 3,
* to accompany Corresponding Source with Installation Information for the
* Program or any work based on the Program. You are still required to
* comply with all other Section 6 requirements to provide Corresponding
* Source.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
#define _GNU_SOURCE
#include
#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[] = "2026-05-27";
static char conspy_version[] = "1.17";
/*
* 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_columns;
static int opt_lines;
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[0]; /* Char in VGA video buf */
};
#define VIDBUF_SIZE(cols, lines) (sizeof(struct vidbuf) + (size_t)(cols) * (lines) * sizeof(struct vidchar))
/*
* Options we allow.
*/
static struct option options[] =
{
{"geometry", 1, 0, 'g'},
{"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, " -g G,--geometry=G Console size is G, format COLSxROWS.\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 'g':
opt_lines = 0;
opt_columns = strtol(optarg, &end, 10);
if (*end == 'x' || *end == 'X') {
opt_lines = strtol(end + 1, &end, 10);
}
if (*end != '\0' || opt_lines <= 0 || opt_columns <= 0)
{
usage("geometry must be COLSxROWS");
}
break;
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 && *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);
}
/*
* Allocate some memory.
*/
static void* checked_malloc(size_t bytes)
{
void* result = malloc(bytes);
if (result == 0)
syserror("memory allocation failed");
return result;
}
/*
* 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);
device_handle = -1;
}
if (tty_handle != -1)
{
close(tty_handle);
tty_handle = -1;
}
}
/*
* This is where the actual work is done.
*/
static void conspy(int use_colour)
{
unsigned short box;
size_t bytes_read;
unsigned int column;
attr_t curses_attribute;
short curses_colour;
int escape_pressed;
int escape_notpressed;
int ioerror_count;
unsigned int key_count;
unsigned int key_index;
uint32_t keyboard_mode;
char keys_pressed[256];
unsigned int last_attribute;
unsigned int last_columns;
unsigned int last_lines;
unsigned int line;
chtype line_buf[256];
int line_chars;
fd_set readset;
int result;
struct timeval timeval;
unsigned int curr_columns;
unsigned int curr_lines;
int tty_result;
unsigned int video_attribute;
int video_char;
struct vidbuf* vidbuf;
size_t vidbuf_size;
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_lines = 0;
curr_columns = opt_columns ? opt_columns : 80;
curr_lines = opt_lines ? opt_lines : 25;
vidbuf_size = VIDBUF_SIZE(curr_columns, curr_lines) + sizeof(vidchar);
vidbuf = checked_malloc(vidbuf_size);
for (;;)
{
/*
* Read the video buffer.
*/
for (;;)
{
if (lseek(device_handle, 0L, SEEK_SET) != 0L)
syserror(device_name);
bytes_read = read(device_handle, vidbuf, vidbuf_size);
if (bytes_read < sizeof(*vidbuf) || bytes_read > vidbuf_size)
syserror(device_name);
if (bytes_read < vidbuf_size)
break;
vidbuf_size *= 2;
free(vidbuf);
vidbuf = checked_malloc(vidbuf_size);
}
if (opt_columns && opt_lines &&
bytes_read == VIDBUF_SIZE(opt_columns, opt_lines))
{
curr_columns = opt_columns;
curr_lines = opt_lines;
}
else
{
/*
* /dev/vcsa reports cols/lines as single bytes. Reconstruct the
* real values: cols*lines == total_chars and the low byte of each
* matches the header. Step cols by 256 and solve for lines.
*/
size_t total_chars =
(bytes_read - sizeof(struct vidbuf)) / sizeof(struct vidchar);
unsigned int cand_cols = 0, cand_lines = 0, matches = 0, ncols;
for (ncols = vidbuf->vidbuf_columns ? vidbuf->vidbuf_columns : 256;
ncols <= total_chars; ncols += 256)
{
if (total_chars % ncols == 0)
{
unsigned int nlines = total_chars / ncols;
if ((nlines & 0xFF) == vidbuf->vidbuf_lines)
{
cand_cols = ncols;
cand_lines = nlines;
matches += 1;
}
}
}
if (matches != 1)
{
cleanup();
fprintf(stderr,
"%s: cannot determine the console geometry"
" (read %zu bytes, header reports %ux%u);"
" pass --geometry=COLSxROWS.\n",
me, bytes_read,
(unsigned)vidbuf->vidbuf_columns,
(unsigned)vidbuf->vidbuf_lines);
exit(1);
}
curr_columns = cand_cols;
curr_lines = cand_lines;
}
/*
* If the screen size has changed blank out the unused portions.
*/
if (curr_lines < last_lines && last_lines < (unsigned)LINES)
{
move(curr_lines, 0);
clrtobot();
}
if (curr_columns < last_columns && last_columns < (unsigned)COLS)
{
for (line = 0; line < last_lines && line < (unsigned)LINES; line += 1)
{
move(line, last_columns);
clrtoeol();
}
}
last_lines = curr_lines;
last_columns = curr_columns;
/*
* Write the data to the screen.
*/
vidchar = vidbuf->vidbuf_chars;
for (line = 0; line < curr_lines && line < (unsigned)LINES; line += 1)
{
line_chars = 0;
for (column = 0; column < curr_columns; column += 1)
{
if (column >= (unsigned)COLS)
{
vidchar += curr_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;
}
if ((size_t)line_chars >= sizeof(line_buf)/sizeof(*line_buf))
{
move(line, column - line_chars);
addchnstr(line_buf, line_chars);
wchgat(stdscr, line_chars, curses_attribute, curses_colour, 0);
line_chars = 0;
}
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 == (size_t)-1)
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 < key_count+bytes_read; key_index += 1)
{ /* See if escape pressed 3 times */
if (keys_pressed[key_index] != '\033')
escape_pressed = 0;
else if (++escape_pressed == 3)
return;
if (keys_pressed[key_index] == ('L' & 0x1F))
wrefresh(curscr);
}
/*
* Insert all keys pressed into the virtual console's input
* buffer. Don't do this if the virtual console is in scan
* code mode - giving ASCII characters to a program expecting
* scan codes will confuse it.
*/
if (!opt_viewonly)
{
/*
* Close & re-open tty in case they have swapped virtual consoles.
*/
close(tty_handle);
tty_handle = open(tty_name, O_WRONLY);
if (tty_handle == -1)
syserror(tty_name);
key_count += bytes_read;
tty_result = ioctl(tty_handle, KDGKBMODE, &keyboard_mode);
if (tty_result == -1)
;
else if (keyboard_mode != K_XLATE && keyboard_mode != K_UNICODE)
key_count = 0; /* Keyboard is in scan code mode */
else
{
for (key_index = 0; key_index < key_count; key_index += 1)
{
tty_result = ioctl(tty_handle, TIOCSTI, keys_pressed + key_index);
if (tty_result == -1)
break;
}
if (key_index == key_count) /* All keys sent? */
key_count = 0; /* Yes - clear the buffer */
else
{
memmove(keys_pressed, keys_pressed+key_index, key_count-key_index);
key_count -= key_index;
}
}
/*
* We sometimes get spurious IO errors on the TTY as programs
* close and re-open it. Usually they will just go away, if
* we are patient.
*/
if (tty_result != -1)
ioerror_count = 0;
else if (errno != EIO || ++ioerror_count > 4)
{
if (errno == EPERM)
{
cleanup();
fprintf(stderr,
"%s: %s: %s.\n"
"Injecting keystrokes via TIOCSTI requires CAP_SYS_ADMIN"
" (typically run as root); use --viewonly to disable"
" keystroke injection.\n",
me, tty_name, strerror(EPERM));
exit(1);
}
syserror(tty_name);
}
}
}
}
conspy-1.17/ChangeLog.txt 0000644 0002157 0001751 00000010044 15205246677 014267 0 ustar rstuart it conspy-1.17 (unreleased)
Bug: -g/--geometry now applies the requested geometry instead of
printing the version and exiting.
Closes: https://sourceforge.net/p/conspy/tickets/9/
Bug: Reconstruct the console geometry algebraically from the vcsa
buffer length, supporting consoles larger than 1023x511
(e.g. 4K headless VTs); restore the terminal before exiting
when the geometry cannot be determined.
Closes: https://sourceforge.net/p/conspy/tickets/10/
New: Document the CAP_SYS_ADMIN requirement for TIOCSTI keystroke
injection (Linux 6.2+); print a helpful hint when the ioctl
fails with EPERM.
Closes: https://sourceforge.net/p/conspy/tickets/11/
Bug: Flush line_buf when full to prevent a stack buffer overflow
on terminals wider than 256 columns (e.g. HiDPI/4K displays)
when the spied console has long single-attribute runs.
Bug: Correctly detect read(2) errors on 64-bit systems by comparing
against (size_t)-1 instead of ~0U.
Bug: Cast to size_t inside VIDBUF_SIZE to avoid int overflow before
promotion when computing buffer sizes for large geometries.
Bug: Treat empty virtual-console arguments consistently between the
/dev/vcsa and /dev/vcc/a code paths.
Bug: Zero file descriptors after closing in cleanup() so a second
cleanup() call (e.g. from a signal racing normal exit) does
not double-close a recycled fd.
conspy-1.16 Wed, 19 Aug 2020 19:16:51 +1000
New: Bump debhelper version.
New: Bump debian standards version.
conspy-1.15 Tue, 16 Feb 2016 21:33:42 +1000
New: Debian build hardening.
New: Bump debian standards version.
conspy-1.14 Tue, 16 Feb 2016 20:36:33 +1000
Bug: Work around kernel limitations when there are more
than 255 lines or 255 columns.
conspy-1.13 Mon, 21 Sep 2015 09:40:17 +1000
Bug: Include for uint32_t
Closes: https://sourceforge.net/p/conspy/tickets/3/
conspy-1.12 Wed, 16 Sep 2015 21:23:09 +1000
Bug: Fix memory leak.
conspy-1.11 Wed, 16 Sep 2015 20:36:43 +1000
Bug: Use proper uscan redirector.
Bug: Keyboard not working on amd64.
New: Dynamically allocate screen size so any size screen
can be accommodated.
Closes: https://sourceforge.net/p/conspy/tickets/2/
New: New version of Makefile.release
conspy-1.10 Fri, 9 May 2014 19:46:16 +1000
New: Customise build system for new home - SourceForge.
conspy-1.9 Sun, 4 May 2014 23:15:06 +1000
New: Rename configure.in to configure.ac, in preparation
for autotools change, change to AGPL-3.
conspy-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: Epoch. Changes? What changes? I got it right first time.
conspy-1.17/conspy.spec 0000644 0002157 0001751 00000002214 15205543125 014052 0 ustar rstuart it Summary: Remote control for text mode virtual consoles
Name: conspy
Version: 1.17
Release: 1ras
Distribution: RedHat 7.2 Contrib
Group: Applications/System
License: AGPL-3.0+
Packager: Russell Stuart
Vendor: Russell Stuart
Url: http://sourceforge.net/projects/%{name}/files/%{name}-%{version}/%{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
automake --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
* Thu Jan 19 2006 Russell Stuart
- New upstream release.
* Mon 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.17/conspy.html 0000644 0002157 0001751 00000010452 15205543125 014067 0 ustar rstuart it
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, a
change log and a
README.
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 nigh 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,2014,2015,2016,2020,2026 Russell Stuart.
It is licensed under the GNU Affero General Public License.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The copyright holders grant you an additional permission under Section 7
of the GNU Affero General Public License, version 3, exempting you from
the requirement in Section 6 of the GNU General Public License, version 3,
to accompany Corresponding Source with Installation Information for the
Program or any work based on the Program. You are still required to
comply with all other Section 6 requirements to provide Corresponding
Source.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
Downloading, Feedback & Contributing
Development for conspy is hosted on
Source forge:
Russell Stuart, 2014-May-27.
conspy-1.17/conspy.1 0000644 0002157 0001751 00000005643 15205543125 013271 0 ustar rstuart it .\" Copyright (c) 2026 Russell Stuart
.TH CONSPY 1 "May 2026" "Version 1.17" "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\-g \fICOLSxROWS\fP, \fB\-\-geometry \fICOLSxROWS\fP"
Specify the console size.
.I Conspy
can almost always correctly guess the size
so this is only useful when it complains it can't.
.IP "\fB\-V\fP, \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.
.PP
The kernel reports the console geometry and cursor position
using bytes which limits both to 255 maximum.
.I Conspy
reconstructs the true display size from the truncated header by
factoring the buffer length, but if that is ambiguous you must
supply
.B \-\-geometry.
The cursor position will still be placed incorrectly if it is
beyond line 255 or column 255.
.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 PERMISSIONS
Reading a virtual console requires read access to the corresponding
.B /dev/vcsaX
device, which on most distributions is granted via the
.B tty
group.
.PP
Injecting keystrokes uses the
.B TIOCSTI
ioctl, which since Linux 6.2 requires the
.B CAP_SYS_ADMIN
capability (controlled by the
.B dev.tty.legacy_tiocsti
sysctl, off by default).
In practice this means
.I conspy
must be run as root, or be granted the capability with e.g.
.B "setcap cap_sys_admin+ep /usr/bin/conspy".
Use
.B \-\-viewonly
to spy on a console without needing this privilege.
.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, .
conspy-1.17/README.txt 0000644 0002157 0001751 00000004136 15205543125 013366 0 ustar rstuart it Conspy
======
This program is like VNC - but allows you to take over
a text mode Linux virtual console rather than GUI. It
works on Linux and BSD systems.
Documentation can be found in the man page.
All documentation is readable online at the home page:
http://conspy.sourceforge.net/
Dependencies
------------
- C library.
Building and Installing
-----------------------
Packages are available for Debian and RedHat style
distributions at the home page. If you install using
one of them you can skip this section.
The build dependencies are:
- GNU build system (autoconf, automake, make, gcc),
http://www.gnu.org/software/autoconf,
http://www.gnu.org/software/automake,
http://www.gnu.org/software/make,
http://gcc.gnu.org/.
- A POSIX system (unix shell, sed, etc).
To build the program, in the directory containing this file run:
make
To install, in the directory containing this file run:
make install
To run the test suite, in the directory containing this file run:
make test
License
-------
Copyright (c) 2007-2014,2015,2016,2020,2026 Russell Stuart.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The copyright holders grant you an additional permission under Section 7
of the GNU Affero General Public License, version 3, exempting you from
the requirement in Section 6 of the GNU General Public License, version 3,
to accompany Corresponding Source with Installation Information for the
Program or any work based on the Program. You are still required to
comply with all other Section 6 requirements to provide Corresponding
Source.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
--
Russell Stuart
2014-May-09
conspy-1.17/configure.ac 0000644 0002157 0001751 00000001120 15205543125 014144 0 ustar rstuart it # Process this file with autoconf to produce a configure script.
AC_INIT(conspy.c, 1.10)
AM_INIT_AUTOMAKE([foreign])
# 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_CONFIG_FILES([Makefile-automake])
AC_OUTPUT()