LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-22-2007, 08:48 AM   #31
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,452

Rep: Reputation: 85

I tried your C program. It's producing garbage output in the key.log file. Here is what I got in it.

Code:
10020500.137657-30
10020503.577657+48
10020503.745656-48
10020506.145656+46
10020506.305657-46
10020506.641657+32
10020506.777656-32
10020507.401657+18
10020507.545657-18
10020507.769657+33
10020507.937660-33
10020508.177655+34
10020508.321656-34
10020508.865656+35
10020508.953658-35
10020509.209657+23
10020509.313655-23
10020509.569657+36
10020509.673656-36
10020510.345658+37
10020510.457659-37
10020510.729657+38
10020510.841655-38
10020511. 41657+50
10020511.169655-50
10020511.377656+49
10020511.473657-49
10020511.753658+24
10020511.833652-24
10020512. 65655+25
10020512.177656-25
10020512.361657+16
10020512.513656-16
10020512.801655+19
10020512.937658-19
10020513.505657+31
10020513.625654-31
10020513.777656+20
10020513.897655-20
10020514.129654+22
10020514.249655-22
10020514.449658+47
10020514.609655-47
10020515.889656+17
10020516.  9656-17
10020516.273655+45
10020516.409656-45
10020516.849656+21
10020516.969654-21
10020517.137656+44
10020517.305654-44
 
Old 05-24-2007, 08:20 AM   #32
phi
LQ Newbie
 
Registered: Jan 2005
Posts: 27

Rep: Reputation: 3
Not Garbage, but not clearly documented

First of all I want to state, that my code is not a final application.
It only was a simple try to get the pressed keys together with the time, they were pressed.

I wanted to write an keylogger, which finds the keycodes, the characters and times of each press (the releass is not relevant for my application).
The keylogger should generate a file which will make it possible to enhance the keyboard layout for myself. I have my own key assignment already, because
as a german programmer I use all the "umlauts" () but also some french symbols (...) and of course all the programmers symbols like "{([" and so on.
Attention: The closing parentheses, brackets and so on I do not use a lot, because the editors (like eclipse) normally enter them automatically.

I have not finished my project yet, because I have not yet found a simple way to get the characters out of the key codes.
The "xmodmap -pk" gives some information, but I have to find all the pressed modifier keys myself? Any Idea is welcome.



But now to the heavy Word "garbage" for my SUPER code example ;-)

Replace the fprintf to the follwing and the code is not as "garbage" any more: the leading zeros are now filled with "0"s and not with blanks " ".
But still garbage, if you don't know what it means (see Explanation below).

Code:
fprintf(output, "%i.%06d", makeSeconds(data), makeMicros(data));
The result may look like the following:

Code:
10190741.798544+31
10190741.819493+32
10190741.840557-30
10190741.871797+33
10190741.892722-31
10190741.923755-32
10190741.965280-33
10190742.013934+30
10190742.037998+31
10190742.069367+32
10190742.110791+33
10190742.121436-30
10190742.132060-31
10190742.153096-32
10190742.194779-33
10190742.249864+30
Explanation

Here the number before the period(.) indicate the seconds, the number after the point show the microseconds of the key press or release.
A + means that the key was pressed and a - means that the key was released.
The last 2 numbers are the keys identifier (not the ascii or UTF number !!), but the keyboard-key-id: The character "a" for example is normally (us, german) located at key 30. But - and that's still my question - the character "A" is also located at key 30! I should find a simple way to find out, if shift, control and alt are pressed at a given time. I realy don't want to programmatically trace each press of a shift, control or alt key. Any ideas?


Attention: Sometimes (i have not found when) the
Code:
/dev/input/event0
should be replaced by
Code:
/dev/input/event1
. Why? I ' don't know.

Last edited by phi; 05-24-2007 at 08:43 AM.
 
Old 05-28-2007, 10:29 PM   #33
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,452

Rep: Reputation: 85
Currently there is not a working keylogger for USB keyboards for Linux. LKL (Linux KeyLogger) works on ps/2 keyboards, but not for usb keyboards.
 
Old 07-05-2008, 10:42 AM   #34
phi
LQ Newbie
 
Registered: Jan 2005
Posts: 27

Rep: Reputation: 3
XEvents

Hello

I have still the same problem. Because I want to find out, which keys are pressed how many times, I want to use a keylogger. The Dvorak Keyboard is generated for the english language, but I mostly write German or Java. So, I want to generate my own .Xmodmap (phi-dvorak).

Because eclipse writes some code for me, it is not sufficient to analyse my texts and code to find out, which keys I press most. Example: The "{" is pressed much more times than the "}"-Key, because eclispe writes the "}" itself.

But the above mentioned keyloger gets me the key-events rather than the key-codes. Thats why I was looking for another solution. Now, my code hangs at the XPeekEvent()-routine. Is it possible, that there is no way to get the X-Keycodes of all applications?

Heres my Idea, but I need help with that, because the program hangs at the XPeekEvent routine.

Code:
/* Kompilieren mit
  >gcc XKeylogger.c -L/usr/X11R6/lib -lX11
*/

#include <X11/Xlib.h> 
#include <X11/Xutil.h>

#include <stdlib.h>
#include <stdio.h>



Display * d;
XKeyEvent evt;
char buffer[256];
KeySym keysym;
XComposeStatus statusInOut;

int main(int argc, char * args[]) {

  printf("debug xyz\n");

  d = XOpenDisplay(":0.0");

  if(0 == d) {
    printf("EXIT no display\n");
    return EXIT_FAILURE;
  }

  while(-1) {
    printf("debug before peek\n"); // Hier hakts ...
    XPeekEvent(d, (XEvent*) &evt);

    printf("debug before lookup\n");
    XLookupString(&evt,  buffer, 255, &keysym, &statusInOut);

    printf("Buffer :[%s]\n", buffer);
  }

 
}
 
Old 10-14-2008, 01:19 PM   #35
geogauci
LQ Newbie
 
Registered: Oct 2008
Posts: 2

Rep: Reputation: 0
flush keyboard buffer

Hi! I just mapped the keycodes generated by the code written by PHI some time ago to the actual letters and symbols.

Now I need to flush the buffer just after reading the data so it will not be "picked up" by other software if possible.
What I mean is that I want to have my keylogger running while mplayer is running, but I don't want mplayer to interact to the keyboard keys except maybe for ESC.

Any help would be greatly appreciated!
 
Old 10-14-2008, 01:59 PM   #36
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,452

Rep: Reputation: 85
Is there any chance in getting keylogging working with usb keyboards?
 
Old 11-11-2008, 11:19 PM   #37
esaghor
LQ Newbie
 
Registered: Nov 2008
Posts: 1

Rep: Reputation: 0
hello evryone!
i need to a linux keylogger,so plz hellp me!
thnx
Esa
Esa_ghur@yahoo.com
 
Old 11-12-2008, 12:39 AM   #38
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,685

Rep: Reputation: 2492Reputation: 2492Reputation: 2492Reputation: 2492Reputation: 2492Reputation: 2492Reputation: 2492Reputation: 2492Reputation: 2492Reputation: 2492Reputation: 2492
I believe the tools 'script' and/or 'screen' may be an easier way to record what you've done.
 
Old 04-15-2009, 09:11 AM   #39
phi
LQ Newbie
 
Registered: Jan 2005
Posts: 27

Rep: Reputation: 3
I have finally created my own keyboard (without the use of a keylogger, but using statistics on german texts and java code). I don't know, if this is the best choice, but for me, it works fine:

www.freimann.eu/eliphi/phi/keyboard/
 
Old 01-03-2010, 01:28 AM   #40
kernc
LQ Newbie
 
Registered: Jan 2010
Distribution: Xubuntu
Posts: 13

Rep: Reputation: 0
Thumbs up logkeys linux keylogger

Hello all!

I sincerely apologize for bumping this old thread, but I honestly believe my post is relevant and appropriate.

In search of a usable and reliable linux keylogger I stumbled upon this thread, and also with its help I created what is now another lkl and berkey comparable keylogger.

logkeys linux keylogger

features:
  • dynamically interprets console keymap (not very reliable, read documentation :P)
  • writes to log file

I'm sorry to say that it doesn't seem to work with USB keyboards despite them using input event interface. (I'm lacking USB peripherals to test with.)
I guess I'll keep working on it as time allows.

For now, logkeys suits me really well, better than lkl or uberkey ever did.
Thanks for listening!
 
Old 01-04-2010, 07:37 AM   #41
roscogruen
LQ Newbie
 
Registered: Jul 2009
Posts: 22

Rep: Reputation: 15
is there an easy to use GUI package i could use? i just can't seem to learn code/language/programming.

i've a usb keyboard. hopefully things have changed since this thread was last active.

i tried sudo od -tx1 /dev/input/dev0 but got errors. yeah, i need GUI

Last edited by roscogruen; 01-04-2010 at 07:49 AM.
 
Old 01-04-2010, 07:50 AM   #42
roscogruen
LQ Newbie
 
Registered: Jul 2009
Posts: 22

Rep: Reputation: 15
kernc,
is this "logkey" from a trusted repo? what is the repo? i don't find logkey in the ones i use.

thx - r
 
Old 01-04-2010, 07:55 AM   #43
roscogruen
LQ Newbie
 
Registered: Jul 2009
Posts: 22

Rep: Reputation: 15
keylogger for usb and "computer boob" friendly?

Quote:
Originally Posted by chrism01 View Post
I believe the tools 'script' and/or 'screen' may be an easier way to record what you've done.
could you explain further?

do you mean in the menu's, "file," "edit," "view," ...?

would the "'script' and/or 'screen'" approach work with a usb keyboard? i'd love to know!
 
Old 01-04-2010, 01:58 PM   #44
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292
Well, I recently wrote a rather nice keylogger (with some borrowed code), if you want I could post it somewhere (maybe even here) ... if the mods are ok with that...

or maybe I'll put it on my site.

Last edited by H_TeXMeX_H; 01-04-2010 at 01:59 PM.
 
Old 01-05-2010, 02:57 AM   #45
roscogruen
LQ Newbie
 
Registered: Jul 2009
Posts: 22

Rep: Reputation: 15
TeXeMeX - please post or send

Quote:
Originally Posted by H_TeXMeX_H View Post
Well, I recently wrote a rather nice keylogger (with some borrowed code), if you want I could post it somewhere (maybe even here) ... if the mods are ok with that...

or maybe I'll put it on my site.
If it works for a USB, awesome. you can send it to my email if i gave you that in private message. or you could post it here, paste it on a imagebin.ca.org or give me a link.

i'm not good with code. will i know how to tailor it to this system?

along with recording from local peripherals, would this keylogger also cover outside (intrusive) traffic? just curious.
 
  


Reply

Tags
keylogger


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
keylogger? |2ainman Linux - Security 4 08-21-2013 04:48 AM
anti keylogger lini Linux - Security 4 01-07-2006 06:56 AM
keylogger in java? Laptop2250 Programming 2 01-08-2005 06:27 PM
help with lkl keylogger br0k3n Linux - Software 0 07-22-2004 05:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration