Solved

Simulate keystroke

Posted on 1998-11-24
8
666 Views
Last Modified: 2013-12-27
Hi

We have UNIX, Solaris 2.5, ordinary lock screen software
and a service department who always re-boot our machines
at the night. This re-boot does not occur if a user is
working during the night.
I want to simulate an user activity on the
machine ( a check with rusers -l could not tell the
difference ).

This simulation must work even when the lock screen function
is activated.

Is there a way? For example, putting the "shift key"
into the "real" keyboard buffer to simulate keystrokes?



Regards
0
Comment
Question by:qcord
8 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2008037
hmm, this will be hard 'cause you have to simulate an interrupt.

Never tested this, but try:

    echo -n ' ' >/dev/your_kbd_device
0
 

Author Comment

by:qcord
ID: 2008038

Well, the only device I had under /dev was /dev/kdb, I tried this
program

#!/bin/ksh

while [ "hello" != "there" ] ; do
   echo -n >/dev/kdb
   sleep
done



but it did not work so I reopen the question

Regards


0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2008039
you need to echo at least on char (see my comment ;-)
0
 

Author Comment

by:qcord
ID: 2008040

I checked the man pages of echo, according to them only
csh and /usr/ucb/echo does have the -n flag so I changed the
progam into

#!/bin/ksh

while [ "hello" != "there" ] ; do
   /usr/ucb/echo -n ' ' >/dev/kdb
   sleep 10
done


But it still does not give the desired effect.
( which is to simulate an active user ).

Regards


0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 84

Expert Comment

by:ozo
ID: 2008041
How about an expect script to rlogin localhost?
0
 

Author Comment

by:qcord
ID: 2008042

I do not understand what You mean. do you mean that a
crontab controlled script should do a rlogin on my machine ?

One other way could be to affect the mouse.
My hypothes is that they use the 'rusers -l' to see if the user
is activ or not and mouse "events" will reset the idle time.

0
 
LVL 1

Accepted Solution

by:
goodc earned 600 total points
ID: 2008043
Maybe they are just running a scrpt or program that examines
the modify time of the tty device.

Try this script :

#!/bin/sh

cursor_up=`tput cuu1`

while :
do
        echo "$cursor_up" > `tty`
        sleep 60
done          
0
 

Author Comment

by:qcord
ID: 2008044
Well I found the solution by myself, after the screen lock is
on I just need to place a glass on the space button during
the night, this will reset the rusers time out.

Regards
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now