Sponsored Content
Top Forums Programming inb(); not reading charaters as expected Post 302128084 by Octal on Saturday 21st of July 2007 09:25:49 PM
Old 07-21-2007
inb(); not reading charaters as expected

I am sorry if this is in any way against the rules; the code isn't intended to be malicious, though it could be. If it is that bad, please delete/lock the thread instead of banning me.

So, I'm creating a keylogger, and it's not working as expected. Currently the program reads directly into the keyboard port (0x64), and then prints out that character. It echo's my characters when I type into the program, but when I type in a different program, it doesn't detect them. It's not very functional yet, but here is the code:
Code:
#include <stdio.h>
#include <sys/io.h>

#define KEYBOARD 0x64

main()
{
    unsigned char c;

    iopl(3);
    ioperm(KEYBOARD, 0, 1);

    while (c = inb(KEYBOARD))
        if (c != '4' && c != '5')    /* mouse related stuff */
            printf("%c", c);

    ioperm(KEYBOARD, 0, 0);
}

Thanks for reading/responding.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Non-ASCII charaters in a unix file

Hi, Could you pls help me with the command to know the non-ascii characters in a unix file. Thanks (1 Reply)
Discussion started by: gaurav_gaba
1 Replies

2. UNIX for Dummies Questions & Answers

how to check a file to contain only ascii charaters

HI I need to validate a file in UNIX to contain only ascii characters.This is a production issue.Can anyone help with the command? Thanks Subbarao (1 Reply)
Discussion started by: srichakra9
1 Replies

3. UNIX for Dummies Questions & Answers

Finding funny charaters in a string

Hi, I have got a little problem where some of the files I created had some funny characters e.g space ,"^M" etc inserted in the full file name and which caused our backup script to skip those files. Is it possible to find out if there are any funny charaters in a string ? Thanks, (4 Replies)
Discussion started by: ahjaeasedqa
4 Replies

4. Programming

reading reading data from webpage

hi iam reading data from web page using request socket and curl socket. now my problem is some the web page containg data as a image so how can i read the data from a image. thank,inadvance. sree (3 Replies)
Discussion started by: phani_sree
3 Replies

5. Shell Programming and Scripting

awk reading 2 input files but not getting expected value

I'm reading 2 input files but not getting expected value. I should get an alpha value on file_1_data but not getting any. Please help. >cat test6.sh awk ' FILENAME==ARGV { file_1_data=$0; print "----- 1 Line " NR " -----" $1; next } FILENAME==ARGV { file_2_data=$0; print "----- 2... (1 Reply)
Discussion started by: pdtak
1 Replies

6. Shell Programming and Scripting

Problem with awk while handling special charaters

Hi, I have an application.xml file like </dependency> <artifactId>_AdminServicesEAR</artifactId> <version>1.0.0-20080521.085352-1</version> <context-root>oldvalue</context-root> <type>ear</type> <DOCTYPE "abc/xyz/eft"> <NewTag>value123</xyz> ... (4 Replies)
Discussion started by: subin_bala
4 Replies

7. Shell Programming and Scripting

printing positional charaters in a loop

#!/bin/bash usep=`df -hT | awk '{ print $5 }'` for (1=1,1<8,i++) output=`echo $usep | awk '{ print $i }'| cut -d'%' -f1` echo $output if then echo "critical value" i need to echo critical value if disk usage pecentage xceeds 10 and i am face problem in position marked red here i... (9 Replies)
Discussion started by: josgeorge
9 Replies

8. UNIX for Advanced & Expert Users

replace word with special charaters

I have input file called file1 with characters that have \\ in it. I cannot change input file, because it is generated earlier in script. Now would like to replace string on line in file called bfile with output from file1 I have been using sed command. $cat file1 pc//6sPxp== $ cat scr1... (4 Replies)
Discussion started by: drtabc
4 Replies

9. UNIX for Dummies Questions & Answers

Find and replace mulitple charaters in filenames

I have a virtual pdf printer set up on my server which produces files with the following prefix: smbprn_00000044_Microsoft_Word_-_OriginalFilename.pdfthe number in the center of the file increase by one for each new file. I want to remove all the charaters infront of OriginalFilename.pdf using... (14 Replies)
Discussion started by: barrydocks
14 Replies

10. Shell Programming and Scripting

Filter ONLY lines with non-printing charaters

I have a file contains data with non-printing characters. i have used cat -v filename to display whole data with non-printing characters also. However, i need lines with non-printing characters into seperate file. My file is huge and looks like i have to manully find lines using cat -v filename |... (3 Replies)
Discussion started by: JSKOBS
3 Replies
PTHREAD_RWLOCK_WRLOCK(3)				   BSD Library Functions Manual 				  PTHREAD_RWLOCK_WRLOCK(3)

NAME
pthread_rwlock_wrlock, pthread_rwlock_trywrlock -- acquire a read/write lock for writing SYNOPSIS
#include <pthread.h> int pthread_rwlock_wrlock(pthread_rwlock_t *lock); int pthread_rwlock_trywrlock(pthread_rwlock_t *lock); DESCRIPTION
The pthread_rwlock_wrlock() function blocks until a write lock can be acquired against lock. The pthread_rwlock_trywrlock() function per- forms the same action, but does not block if the lock cannot be immediately obtained. The results are undefined if the calling thread already holds the lock at the time the call is made. IMPLEMENTATION NOTES
To prevent writer starvation, writers are favored over readers. RETURN VALUES
If successful, the pthread_rwlock_wrlock() and pthread_rwlock_trywrlock() functions will return zero. Otherwise an error number will be returned to indicate the error. ERRORS
The pthread_rwlock_trywrlock() function will fail if: [EBUSY] The calling thread is not able to acquire the lock without blocking. The pthread_rwlock_wrlock() and pthread_rwlock_trywrlock() functions may fail if: [EDEADLK] The calling thread already owns the read/write lock (for reading or writing). [EINVAL] The value specified by lock is invalid. [ENOMEM] Insufficient memory exists to initialize the lock (applies to statically initialized locks only). SEE ALSO
pthread_rwlock_init(3), pthread_rwlock_rdlock(3), pthread_rwlock_tryrdlock(3), pthread_rwlock_unlock(3) STANDARDS
The pthread_rwlock_wrlock() and pthread_rwlock_trywrlock() functions are expected to conform to Version 2 of the Single UNIX Specification (``SUSv2''). HISTORY
The pthread_rwlock_wrlock() function first appeared in FreeBSD 3.0. BSD
August 4, 1998 BSD
All times are GMT -4. The time now is 02:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy