473,545 Members | 524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing into Keyboard buffer in AIX

2 New Member
Hello All,

I'm really looking for a help in reading/writing the keyboard buffer in AIX (IBM Unix). In DOS, there is some memory addres (I remember it as 0x417) from where the keyboard buffer starts. But I need the same in AIX.

My requirement is this. In AIX, we need to change the password every 60 days or so. And while changing, it wont accept the previous 4 passwords we used. But when you change to a new one, its difficult to remember the current pwd everytime. (You may say to write it some where. But thats clumsy!!).

Suppose my pwd is "welcome". When it expires, I will change it to a new pwd, say passwd1. Then I will change the same 3 more times with some junk pwds and the fourth time, I will give the old pwd itself (ie, "welcome").

In AIX, we can change the password using "passwd", but here the issue is that, it wont accept the password as a parameter and will be waiting for us to enter it through keyboard. Also, please note that I'm a normal user and not the "root".

Thats when I planned to go for mutli-threading where in one thread, I will be running the "passwd" program and when it waits for the pwd, through another thread I will provide the password. There comes the requirement of writing into the keyboard buffer directly...

Any body knows about this, please help me... :(

T&R
Muthursyamburi
Dec 12 '07 #1
3 5218
RRick
463 Recognized Expert Contributor
From what I can tell, you want to use the passwd program to change the user's password without any user intervention. That's fine.

Passwd is expecting info on stdin, and one way to fix the problem is to redirect passwd's stdin. From a script,
Expand|Select|Wrap|Line Numbers
  1. ##  Input from a file
  2. passwd < newStuff.txt
  3.  
  4. ## Input from File Descriptor 5 (I think)
  5. passwd <5
  6.  
This can be done programmaticall y, via fork and exec calls, but I don't have the details.

There are some programs that check to see if stdin is from a terminal, and won't let you redirect a file to it. In that case, you can directly access the input buffer, but this is based on what Unix calls tty. Try "man -k tty" for more details.
Dec 12 '07 #2
muthursyamburi
2 New Member
From what I can tell, you want to use the passwd program to change the user's password without any user intervention. That's fine.

Passwd is expecting info on stdin, and one way to fix the problem is to redirect passwd's stdin. From a script,
Expand|Select|Wrap|Line Numbers
  1. ##  Input from a file
  2. passwd < newStuff.txt
  3.  
  4. ## Input from File Descriptor 5 (I think)
  5. passwd <5
  6.  
This can be done programmaticall y, via fork and exec calls, but I don't have the details.

There are some programs that check to see if stdin is from a terminal, and won't let you redirect a file to it. In that case, you can directly access the input buffer, but this is based on what Unix calls tty. Try "man -k tty" for more details.
Hi,

Thanks for understanding my requirement exactly and giving me a prompt reply. However, I tried both the ways but in vain... :(.

1) I tried to redirect a file containing pwds to that it didn't work.
2) I wrote one c program which, using fork() & execvp(), will call a shell in another thread in which I will be running the "passwd". Then through the c program I tried sending the pwds thru message pipes and in the shell program I redirected it from the pipe (I used the file descriptor 3) to the passwd. That also didn't worked out...

After a lot of search in the web, I could get one function called "g32_send_keys( )" (see this: g32_send_keys ) but the associated header files (g32_api.h & g32_keys.h) is not there in my system and thus that also didn't work out... :((

T&R
Muthursyamburi
Dec 13 '07 #3
RRick
463 Recognized Expert Contributor
I took a look at the man info for passwd on my Linux box. Since you are not root, you will be able only change your account's password. You can't change anyone else's passwd.

On linux, there is a --stdin option that allows information to be received from, you guessed it, stdin. Unfortunately, you must be root to use this. From everything I've seen, this looks like the best solution.

Finally, I'm not sure you will be able to trick passwd with the keybuffer tricks. There are ways to tell if the program is being run interactively, and no amount of keyboard games is going to fix this.

Sorry for the negative post, but good luck.
Dec 13 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

23
7684
by: herrcho | last post by:
What's the difference between STDIN and Keyboard buffer ? when i get char through scanf, i type in some characters and press enter, then, where do the characters go ? to STDIN or Keyboard buffer ? are they same ? thanks ^^
5
21039
by: nx-2000 | last post by:
I've got a very large C# forms app and now that its being used in bigger environments we're getting a steady stream of "why does it do this?" problems. The most nagging of which right now is that when a MessageBox.Show() is displayed, if the user hits enter or esc, those keys get passed back to the form. From searching online, this is...
0
6634
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as my keyboard. the USB keyboard is detected as HID keyboard device. the program finds the keyboard if it is attached. and I am getting valid handles....
2
8743
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as my keyboard. the USB keyboard is detected as HID keyboard device. the program finds the keyboard if it is attached. and I am getting valid handles....
1
2739
by: NvrBst | last post by:
I'd like to simulate keypresses at the lowest level I can (writing to the keyboard buffer if possible). I can find x86 solutions but nothing for a higher level language. Does anyone know how I can do this in C#? I'm also wondering if the "keybd_event" or "SendInput" goes as low as writing to the Keyboard Controller Buffer? or do they use...
1
4594
by: Damir | last post by:
Hallo everybody Does anyone knows how to access Keyboard buffer? At the moment I'm catching KeyDown event of the form, and waiting for carrige return or return key, but sometimes the Keyboard scanner doesn't send those keys, so I would like to wait so long until keyboard buffer is empty. Any helb will be appriciated
12
7103
by: Sven | last post by:
Can someone point out source code for a safe circular buffer receiver transmitter? It's for sending and receiving bytes via RS232. Thanks in advance.
11
13158
by: vbguy2008 | last post by:
Hi, I am coding a Windows Form Application in VB.NET 2008. I would like to clear the keyboard buffer or at least empty all outstanding key presses queued up for my application at certain points in my program. I looked at System.Console.Read, but that doesn't seems appropriate. I also looked into EnableWindow Lib "user32". I ran into a...
3
2991
by: NaN | last post by:
I've been trying to use _kbhit() but it didn't do what I thought it would from books, "Detects whether a keypress is available for reading." Herbert Schildt says, "If the user has pressed a key, this function returns true(non-0), but does not read the character. If no keystroke is pending, kbhit() returns false (0)." Here is the test...
1
7410
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7743
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5959
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5319
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4940
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3437
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1010
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
692
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.