LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-14-2022, 09:19 AM   #1
ibrha
LQ Newbie
 
Registered: Oct 2022
Posts: 1

Rep: Reputation: 0
C++ Get key pressed even when program is in background


Hi dear!

I am tryna developin' a key logger in C++ for Linux kernel OS-based. Actually I am inKali.

I had been tried getch() of ncurses library, but it works only when the terminal is in foreground.

Some tips about my achieve?
 
Old 10-14-2022, 09:32 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 19,248

Rep: Reputation: 6525Reputation: 6525Reputation: 6525Reputation: 6525Reputation: 6525Reputation: 6525Reputation: 6525Reputation: 6525Reputation: 6525Reputation: 6525Reputation: 6525
the key events are always sent to the active app (which is in focus).
 
Old 10-14-2022, 12:34 PM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,736
Blog Entries: 13

Rep: Reputation: 4784Reputation: 4784Reputation: 4784Reputation: 4784Reputation: 4784Reputation: 4784Reputation: 4784Reputation: 4784Reputation: 4784Reputation: 4784Reputation: 4784
You'd have to write code modifications for the keyboard driver or grab from the resource which presents key presses. I forget /dev/input0 maybe?
 
Old 10-14-2022, 12:50 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 10,701

Rep: Reputation: 5062Reputation: 5062Reputation: 5062Reputation: 5062Reputation: 5062Reputation: 5062Reputation: 5062Reputation: 5062Reputation: 5062Reputation: 5062Reputation: 5062
Read the keyboard device node.
 
Old 10-15-2022, 08:58 PM   #5
suramya
Member
 
Registered: Jan 2022
Location: Earth
Distribution: Debian
Posts: 230

Rep: Reputation: 96
try a github search for keyloggers, there are a few sample programs available. However, please do remember installing a keylogger on a system without approval of all the users using it can be illegal so please proceed accordingly.
 
  


Reply


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
[SOLVED] Keyboard doesn't sense key strokes if key kept pressed yogesh_attarde Linux - Software 1 06-24-2014 10:28 AM
Puppy 5 needs any key to be pressed to get boot up at grub on old hp laptop asokkrishna Linux - Newbie 2 08-16-2011 11:06 PM
Map a keypress to a GUI button (when keycode 175 pressed a GUI button pressed) wikapuki Linux - Desktop 0 09-16-2010 10:08 AM
Which ioctl to use to get the key pressed in the key board? Sreeram B S Linux - Kernel 0 02-24-2007 03:02 AM
VCD does not eject even eject button pressed ic_torres Linux - Software 4 12-01-2005 06:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:20 PM.

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
Open Source Consulting | Domain Registration