Posts

Showing posts from April 17, 2011

Terminal input output logger / Teminal recording

Logging terminal input and output
------------------------------------------

After a lot of googling I found a tool that can log all input and output of terminal in Unix system

The tool is rootsh and its not only used for logging but also used for root login for normal users using sudo.

So that the command entered by the user will be logged in a file as well as on syslog

We can make rootsh as a shell , So that all the activity by that particular user will be logged

The tool is released under GNU Open source license

You can download the tool from

http://sourceforge.net/projects/rootsh/

I made a modified copy of mine on
https://sites.google.com/site/ansilh/rootsh

The tool will log username,commands and its output in a file -- But no client IP
The command can be started as a shell -But it will take the default shell

I made some modification on this and it's working perfectly on my Linux machine
The link here

https://sites.google.com/site/ansilh/rootsh/rootsh-1.5.3-final.tar.gz

The extra modules I ad…

Shell Scripting - part 3

Fun with Shell scripting
-----------------------------


tput cup command
-----------------
This command is used to set properties of terminal

tput cup 0 0
This command will set courser position to top left corner of terminal

e.g:-
[root@localhost]#vi file6.sh
tput cup 0 0
echo "Ansil"


Save and execute script
The output "Ansil" will be displayed on top left corner of the terminal

e.g:-
Lets make this example more interesting

#!/bin/bash
clear
tput cup 12 35
echo "Ansil"
read

Save the file and execute the script
The out put will display "Ansil" on almost center of the screen,
Surprisingly you will not get your terminal back until you press enter OR you have to kill/terminate the script(we will discuss this later)

The read command is used to read values from terminal(by default standard input)

here the read command read values till an occurrence of ENTER key ,but the value will not be stored

e.g:-