The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to read terminal attributes using ioctl() Sreejesh.S High Level Programming 1 05-17-2008 10:56 AM
How to read lock terminal values in solaris pankajarora_12 UNIX for Dummies Questions & Answers 0 07-11-2006 07:31 AM
Plz Help : How to use write command to execute command on some other terminal Aashish UNIX for Dummies Questions & Answers 2 03-03-2006 08:25 AM
read from terminal rein Shell Programming and Scripting 1 10-21-2005 07:43 AM
Terminal Hungup at the time of read pkusumam Shell Programming and Scripting 1 11-30-2001 12:19 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-08-2007
Registered User
 

Join Date: Nov 2006
Posts: 17
read terminal command

hi
how to read terminal command,
just i want to read all command which write on terminal
so please tell me any system call, api avilable in c for above purpose
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-08-2007
Registered User
 

Join Date: Nov 2006
Posts: 22
do this

do you wanna of previous commands

which you run in terminal

for this type

history

i dont understand wether your problem about this or not

ignore if not
Reply With Quote
  #3 (permalink)  
Old 01-08-2007
Registered User
 

Join Date: Nov 2006
Posts: 17
my problem is i want to create one file which store all command or which write on terminals (bad command) in day, for that i read console terminal

now clear problem ............?
Reply With Quote
  #4 (permalink)  
Old 01-08-2007
Registered User
 

Join Date: Feb 2006
Posts: 3
chk this out

hi u can write a deamon proc in C to read all the command in the terminal.

use the "system" system call in the c program and redirect all the commands in the history to a file to analyse.writing a deamon allows u to do this in background.

system("history>test.$$);

include this in the code.

mail me if u have any concerns
Reply With Quote
  #5 (permalink)  
Old 01-08-2007
Registered User
 

Join Date: Nov 2006
Posts: 17
system ("history >/root/txtx.txt");
not working,it run properly(create file txtx.txt ) but file doent contain any thing
Reply With Quote
  #6 (permalink)  
Old 01-11-2007
Registered User
 

Join Date: Feb 2005
Posts: 52
My strange idea:
You can remove ~/.bash_history
and then place FIFO of that name:
mkfifo ~/.bash_history
and then run some program for reading and saving
all commands.

Or maybe you would like to use "script" command.
Reply With Quote
  #7 (permalink)  
Old 01-11-2007
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,491
If you need a keylooger - the kind of program you're describing - odys mentioned the script utility.

IF this is a real security problem, put something like this in /etc/profile
Code:
if [[ $USER = " badguy" ]]; then
  script <somedirectory the user can write to>/filename
fi
This way the user cannot circumvent logging by editing the .profile or .bashrc file.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0