Replaced lkl and lklk scripts with llk and llkk setuid0 programs that run logkeys-start.sh and logkeys-kill.sh.
git-svn-id: https://logkeys.googlecode.com/svn/trunk@42 c501e62c-e7d1-11de-a198-37193048d1ed
This commit is contained in:
parent
8359aa3598
commit
2ec46c0140
|
@ -1,3 +1,3 @@
|
|||
AUTOMAKE_OPTIONS = foreign
|
||||
SUBDIRS = src man scripts
|
||||
EXTRA_DIST = src/keytables.cc build man/logkeys.8 scripts/lkl scripts/lklk
|
||||
EXTRA_DIST = src/keytables.cc build man/logkeys.8 scripts/llk scripts/kllk
|
|
@ -191,7 +191,7 @@ top_builddir = @top_builddir@
|
|||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
SUBDIRS = src man scripts
|
||||
EXTRA_DIST = src/keytables.cc build man/logkeys.8 scripts/lkl scripts/lklk
|
||||
EXTRA_DIST = src/keytables.cc build man/logkeys.8 scripts/llk scripts/kllk
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
|
|
21
README
21
README
|
@ -58,15 +58,18 @@ A copy of these instructions is in the accompanying INSTALL file.
|
|||
===============================================================================
|
||||
|
||||
logkeys is simple. You can either invoke it directly, by typing full command
|
||||
line, or use the provided scripts. There are two scripts in this package:
|
||||
line, or use the provided scripts. There are two helper programs in this
|
||||
package:
|
||||
|
||||
bin/lkl , which starts the logkeys daemon, and
|
||||
bin/lklk , which kills it.
|
||||
bin/llk , which is intended to start the logkeys daemon, and
|
||||
bin/llkk , which is intended to kill it.
|
||||
|
||||
bin/llk runs etc/logkeys-start.sh, and bin/llkk rund etc/logkeys-kill.sh.
|
||||
|
||||
You can use these two scripts for starting and stopping the keylogger quickly
|
||||
and covertly. You can modify the scripts as you like.
|
||||
Note that logkeys is installed setuid, so the root password need not be
|
||||
provided at runtime.
|
||||
You can use these two setuid root programs for starting and stopping the
|
||||
keylogger quickly and covertly. You can modify the .sh scripts as you like.
|
||||
As the programs are installed setuid, the root password need not be provided
|
||||
at runtime.
|
||||
|
||||
Default log file is /var/log/logkeys.log and is not readable by others.
|
||||
|
||||
|
@ -110,13 +113,13 @@ missing or incorrectly determined mappings. From then on, execute logkeys by
|
|||
$ logkeys --start --keymap my_lang.keymap
|
||||
|
||||
Again, see if it now works correctly (character keys appear correct when you
|
||||
are viewing the log file in editor), and opt to modify bin/lkl starter script.
|
||||
are viewing the log file in editor), and opt to modify bin/llk starter script.
|
||||
|
||||
logkeys acts as a daemon, and you stop the running logger process with
|
||||
|
||||
$ logkeys --kill
|
||||
|
||||
(or bin/lklk provided script).
|
||||
(or bin/llkk provided script).
|
||||
|
||||
For more information about logkeys log file format, logkeys keymap format, and
|
||||
command line arguments, read the application manual,
|
||||
|
|
|
@ -22,8 +22,11 @@ and function keys, while also being fully aware of Shift and AltGr key modifiers
|
|||
It tries to automatically determine the correct input device, and may in some cases
|
||||
also get the character keys mapping right.
|
||||
.PP
|
||||
It is installed setuid root and may be invoked by any user anytime, either directly
|
||||
or using the accompanying \fBlkl\fR and \fBlklk\fR scripts.
|
||||
Two helper \fBsetuid root\fR programs are shipped with logkeys. \fIllk\fR, which runs
|
||||
\fIetc/logkeys-start.sh\fR script, and \fIllkk\fR, which runs \fIetc/logkeys-kill.sh\fR script.
|
||||
Because llk and llkk are installed setuid root, you can edit the two .sh scripts
|
||||
(mostly just logkeys-start.sh) to your preference, then issue logkeys via llk whenever
|
||||
you have to run it covertly (e.g. when you don't want to su to root or type sudo password).
|
||||
.SH OPTIONS
|
||||
Non-optional arguments are required for short options too.
|
||||
.TP
|
||||
|
@ -111,7 +114,7 @@ Using US keyboard layout, one example log file could look like:
|
|||
.IP
|
||||
Logging started ...
|
||||
.IP
|
||||
2009-12-11 09:58:17+0100 > lkl
|
||||
2009-12-11 09:58:17+0100 > llk
|
||||
.br
|
||||
2009-12-11 09:58:20+0100 > sudo cp <RShift>~/foo.<Tab> /usr/bin
|
||||
.br
|
||||
|
@ -121,7 +124,7 @@ Logging started ...
|
|||
.br
|
||||
2009-12-11 09:58:44+0100 > c<#+53><BckSp><#+34><LCtrl>c
|
||||
.br
|
||||
2009-12-11 09:58:54+0100 > lklk
|
||||
2009-12-11 09:58:54+0100 > llkk
|
||||
.IP
|
||||
Logging stopped at 2009-12-11 09:58:54+0100
|
||||
.PP
|
||||
|
@ -130,7 +133,7 @@ option, it would look like:
|
|||
.IP
|
||||
Logging started ...
|
||||
.IP
|
||||
2009-12-11 09:58:17+0100 > lkl
|
||||
2009-12-11 09:58:17+0100 > llk
|
||||
.br
|
||||
2009-12-11 09:58:20+0100 > sudo cp ~/foo. /usr/bin
|
||||
.br
|
||||
|
@ -140,7 +143,7 @@ Logging started ...
|
|||
.br
|
||||
2009-12-11 09:58:44+0100 > c<#+53>c
|
||||
.br
|
||||
2009-12-11 09:58:54+0100 > lklk
|
||||
2009-12-11 09:58:54+0100 > llkk
|
||||
.IP
|
||||
Logging stopped at 2009-12-11 09:58:54+0100
|
||||
.PP
|
||||
|
@ -206,12 +209,18 @@ To start logging to default log file with a custom keymap:
|
|||
.IP
|
||||
$ logkeys --start --keymap my_keymap
|
||||
.PP
|
||||
To use a custom event device (e.g. /dev/input/event4):
|
||||
.IP
|
||||
$ logkeys --start --device /dev/input/event4 # or just
|
||||
.br
|
||||
$ logkeys --start --device event4
|
||||
.PP
|
||||
To end running logkeys process:
|
||||
.IP
|
||||
$ logkeys --kill
|
||||
.PP
|
||||
After updated to one's liking, helper scripts \fI/usr/bin/lkl\fR (start) and
|
||||
\fI/usr/bin/lklk\fR (kill) can be used as well.
|
||||
After \fIetc/logkeys-start.sh\fR is updated to one's liking, helper programs \fIbin/llk\fR (start) and
|
||||
\fIbin/llkk\fR (kill) can be used as well.
|
||||
.SH BUGS
|
||||
logkeys relies on numeric output of \fIdumpkeys\fR(1), which \fIkeymaps\fR(5)
|
||||
manual page specifically discourages as unportable.
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
bin_SCRIPTS = lkl lklk
|
||||
#myconfdir=$(prefix)/etc
|
||||
myconfdir=$(sysconfdir)
|
||||
myconf_SCRIPTS = logkeys-start.sh logkeys-kill.sh
|
||||
|
|
|
@ -63,8 +63,8 @@ am__nobase_list = $(am__nobase_strip_setup); \
|
|||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
SCRIPTS = $(bin_SCRIPTS)
|
||||
am__installdirs = "$(DESTDIR)$(myconfdir)"
|
||||
SCRIPTS = $(myconf_SCRIPTS)
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
@ -158,7 +158,10 @@ target_alias = @target_alias@
|
|||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
bin_SCRIPTS = lkl lklk
|
||||
|
||||
#myconfdir=$(prefix)/etc
|
||||
myconfdir = $(sysconfdir)
|
||||
myconf_SCRIPTS = logkeys-start.sh logkeys-kill.sh
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
@ -192,10 +195,10 @@ $(top_srcdir)/configure: $(am__configure_deps)
|
|||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||
install-myconfSCRIPTS: $(myconf_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
|
||||
test -z "$(myconfdir)" || $(MKDIR_P) "$(DESTDIR)$(myconfdir)"
|
||||
@list='$(myconf_SCRIPTS)'; test -n "$(myconfdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
|
||||
|
@ -213,19 +216,19 @@ install-binSCRIPTS: $(bin_SCRIPTS)
|
|||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(myconfdir)$$dir'"; \
|
||||
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(myconfdir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binSCRIPTS:
|
||||
uninstall-myconfSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
|
||||
@list='$(myconf_SCRIPTS)'; test -n "$(myconfdir)" || exit 0; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 's,.*/,,;$(transform)'`; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
echo " ( cd '$(DESTDIR)$(myconfdir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(myconfdir)" && rm -f $$files
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
@ -267,7 +270,7 @@ check-am: all-am
|
|||
check: check-am
|
||||
all-am: Makefile $(SCRIPTS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)"; do \
|
||||
for dir in "$(DESTDIR)$(myconfdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
|
@ -315,13 +318,13 @@ info: info-am
|
|||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
install-data-am: install-myconfSCRIPTS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binSCRIPTS
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
|
@ -359,20 +362,20 @@ ps: ps-am
|
|||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binSCRIPTS
|
||||
uninstall-am: uninstall-myconfSCRIPTS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-binSCRIPTS install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am uninstall uninstall-am uninstall-binSCRIPTS
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-myconfSCRIPTS install-pdf install-pdf-am install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
|
||||
uninstall-am uninstall-myconfSCRIPTS
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
logkeys --start
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
logkeys --kill
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
logkeys --kill
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
logkeys --start
|
|
@ -1,8 +1,13 @@
|
|||
CXXFLAGS = -Wall -O3
|
||||
CXXFLAGS = -Wall -O3 -DSYS_CONF_DIR=\"$(sysconfdir)\"
|
||||
|
||||
bin_PROGRAMS = logkeys
|
||||
bin_PROGRAMS = logkeys llk llkk
|
||||
logkeys_SOURCES = logkeys.cc
|
||||
llk_SOURCES = llk.cc
|
||||
llkk_SOURCES = llkk.cc
|
||||
|
||||
install-exec-hook:
|
||||
chown root $(bindir)/logkeys
|
||||
chmod u+s $(bindir)/logkeys
|
||||
chown root\: $(bindir)/llk
|
||||
chmod u+s $(bindir)/llk
|
||||
chown root\: $(bindir)/llkk
|
||||
chmod u+s $(bindir)/llkk
|
||||
|
|
@ -32,7 +32,7 @@ POST_INSTALL = :
|
|||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
bin_PROGRAMS = logkeys$(EXEEXT)
|
||||
bin_PROGRAMS = logkeys$(EXEEXT) llk$(EXEEXT) llkk$(EXEEXT)
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
|
@ -45,6 +45,12 @@ CONFIG_CLEAN_FILES =
|
|||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_llk_OBJECTS = llk.$(OBJEXT)
|
||||
llk_OBJECTS = $(am_llk_OBJECTS)
|
||||
llk_LDADD = $(LDADD)
|
||||
am_llkk_OBJECTS = llkk.$(OBJEXT)
|
||||
llkk_OBJECTS = $(am_llkk_OBJECTS)
|
||||
llkk_LDADD = $(LDADD)
|
||||
am_logkeys_OBJECTS = logkeys.$(OBJEXT)
|
||||
logkeys_OBJECTS = $(am_logkeys_OBJECTS)
|
||||
logkeys_LDADD = $(LDADD)
|
||||
|
@ -57,8 +63,8 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
|||
CXXLD = $(CXX)
|
||||
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
SOURCES = $(logkeys_SOURCES)
|
||||
DIST_SOURCES = $(logkeys_SOURCES)
|
||||
SOURCES = $(llk_SOURCES) $(llkk_SOURCES) $(logkeys_SOURCES)
|
||||
DIST_SOURCES = $(llk_SOURCES) $(llkk_SOURCES) $(logkeys_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
@ -72,7 +78,7 @@ CPPFLAGS = @CPPFLAGS@
|
|||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = -Wall -O3
|
||||
CXXFLAGS = -Wall -O3 -DSYS_CONF_DIR=\"$(sysconfdir)\"
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
|
@ -153,6 +159,8 @@ top_build_prefix = @top_build_prefix@
|
|||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
logkeys_SOURCES = logkeys.cc
|
||||
llk_SOURCES = llk.cc
|
||||
llkk_SOURCES = llkk.cc
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
@ -224,6 +232,12 @@ uninstall-binPROGRAMS:
|
|||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
llk$(EXEEXT): $(llk_OBJECTS) $(llk_DEPENDENCIES)
|
||||
@rm -f llk$(EXEEXT)
|
||||
$(CXXLINK) $(llk_OBJECTS) $(llk_LDADD) $(LIBS)
|
||||
llkk$(EXEEXT): $(llkk_OBJECTS) $(llkk_DEPENDENCIES)
|
||||
@rm -f llkk$(EXEEXT)
|
||||
$(CXXLINK) $(llkk_OBJECTS) $(llkk_LDADD) $(LIBS)
|
||||
logkeys$(EXEEXT): $(logkeys_OBJECTS) $(logkeys_DEPENDENCIES)
|
||||
@rm -f logkeys$(EXEEXT)
|
||||
$(CXXLINK) $(logkeys_OBJECTS) $(logkeys_LDADD) $(LIBS)
|
||||
|
@ -234,6 +248,8 @@ mostlyclean-compile:
|
|||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/llk.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/llkk.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logkeys.Po@am__quote@
|
||||
|
||||
.cc.o:
|
||||
|
@ -451,8 +467,10 @@ uninstall-am: uninstall-binPROGRAMS
|
|||
|
||||
|
||||
install-exec-hook:
|
||||
chown root $(bindir)/logkeys
|
||||
chmod u+s $(bindir)/logkeys
|
||||
chown root\: $(bindir)/llk
|
||||
chmod u+s $(bindir)/llk
|
||||
chown root\: $(bindir)/llkk
|
||||
chmod u+s $(bindir)/llkk
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#include <cstdlib>
|
||||
#include <unistd.h>
|
||||
|
||||
int main() {
|
||||
setuid(0);
|
||||
exit(system(SYS_CONF_DIR "/logkeys-start.sh")); // SYS_CONF_DIR defined in CXXFLAGS in Makefile.am
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#include <cstdlib>
|
||||
#include <unistd.h>
|
||||
|
||||
int main() {
|
||||
setuid(0);
|
||||
exit(system(SYS_CONF_DIR "/logkeys-kill.sh")); // SYS_CONF_DIR defined in CXXFLAGS in Makefile.am
|
||||
}
|
|
@ -61,10 +61,10 @@ void usage()
|
|||
"\n"
|
||||
" -s, --start start logging keypresses\n"
|
||||
" -m, --keymap=FILE use keymap FILE\n"
|
||||
" -o, --output=FILE log output to FILE (" DEFAULT_LOG_FILE ")\n"
|
||||
" -o, --output=FILE log output to FILE [" DEFAULT_LOG_FILE "]\n"
|
||||
" -u, --us-keymap use en_US keymap instead of configured default\n"
|
||||
" -k, --kill kill running logkeys process\n"
|
||||
" -d, --device=FILE input event device (eventX from " INPUT_EVENT_PATH ")\n"
|
||||
" -d, --device=FILE input event device [eventX from " INPUT_EVENT_PATH "]\n"
|
||||
" -?, --help print this help screen\n"
|
||||
" --export-keymap=FILE export configured keymap to FILE and exit\n"
|
||||
" --no-func-keys log only character keys\n"
|
||||
|
|
Loading…
Reference in New Issue