read terminal command


 
Thread Tools Search this Thread
Top Forums Programming read terminal command
# 1  
Old 01-08-2007
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
# 2  
Old 01-08-2007
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
# 3  
Old 01-08-2007
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 ............?
# 4  
Old 01-08-2007
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
# 5  
Old 01-08-2007
system ("history >/root/txtx.txt");
not working,it run properly(create file txtx.txt ) but file doent contain any thing
# 6  
Old 01-11-2007
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.
# 7  
Old 01-11-2007
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies

2. OS X (Apple)

Read and manage mail under Terminal

When opening Terminal window under Mac OS Lion, I have a message saying I've got mail . It seems to be somewhere close to ~/Library/Server/Mail/Data/spool/ but I ignore what command to be typed in order to read it and suppress it later once read. (1 Reply)
Discussion started by: shub22
1 Replies

3. UNIX for Dummies Questions & Answers

read from terminal/keyboard > /dev/tty

Hi, I need to provide more than one character to "> /dev/tty" through terminal/keyboard input, I have this: ok=false while do echo " Enter r1 to reformat " > /dev/tty read choice case $choice in ) echo " bla bla bla " ;; done However, in this way,... (3 Replies)
Discussion started by: Gery
3 Replies

4. Shell Programming and Scripting

Is command line invocation of gnome-terminal to run more than one command possible?

Hello, I am trying to learn how to pass something more than a one-command startup for gnome-terminal. I will give an example of what I'm trying to do here: #! /bin/bash # #TODO write this for gnome and xterm USAGE=" ______________________________________________ ${0##*/} run... (0 Replies)
Discussion started by: Narnie
0 Replies

5. UNIX for Dummies Questions & Answers

read a .bin through terminal and output a checksum?

Hi all, Ive been given a .bin file that I want to do a checksum on to make sure that it is consistant with what I know should be the checksum. I have tried using md5sum but it spits out a 128 bit line rather than a 32 bit line, which is what I want. Can someone help set me off in the right... (7 Replies)
Discussion started by: TeamUSA
7 Replies

6. Programming

How to read terminal attributes using ioctl()

I want to get the terminal attributes such as , terminal width terminal height current cursor position Can I use ioctl function. Please help me how to use this function to get these details.. If possible please explain with a sample code. I'm very new to UNIX progrmming.... Thanks... (1 Reply)
Discussion started by: Sreejesh.S
1 Replies

7. UNIX for Dummies Questions & Answers

How to read lock terminal values in solaris

Hi all I am using sun solaris 5.8. I wanna know where the value stored if we lock/unlock the terminal and how i can read and use it to my script. I am helpless . So plzzzzzz... (0 Replies)
Discussion started by: pankajarora_12
0 Replies

8. UNIX for Dummies Questions & Answers

Plz Help : How to use write command to execute command on some other terminal

Hi Group , I m trying to execute commands on some other system using write command but inspite of executing the commands they r passed as simple messages. - i m writing >write user-id ! ls o ctrl-d inspite of executing the command ls,other terminal shows ! ls. Thnx in advance. (2 Replies)
Discussion started by: Aashish
2 Replies

9. Shell Programming and Scripting

read from terminal

If I do: cat file | write user I can cat a file to a users terminal. My question is, how can this user read the input and cat it into a file? I tried the reverse: read | file or read > file etc. But it didn't work. (1 Reply)
Discussion started by: rein
1 Replies

10. Shell Programming and Scripting

Terminal Hungup at the time of read

Hi, There are two scripts. The second script is called from the first one. These will create two processes on unix. In the second script, there is a read statement in the while loop. Under unexpected conditions, at the time of reading response from the user, if the terminal hungup happens,... (1 Reply)
Discussion started by: pkusumam
1 Replies
Login or Register to Ask a Question