Ubuntu RFID Screensaver lock-unlock
So, I have this el-cheapo RFID scanner and some RFID tags.
I thought to myself, You know what would be neat? Enabling and disabling the lock screen with this thing.
So the package arrived (along with my IBM carbine, woohoo!) and I tore it apart and hooked it up.
This device emulates a USB keyboard (that explains the driver-less thing they were pushing) and essentially, types out the card ID and hits enter. I thought I could just open a constant stream from /dev/stdin (a la keylogger) and watch for when the card I want was punched in. Thats what lead me to creating this stupid simple script:
!/bin/bash
cat /dev/stdin | while read line
do
if [ "$line" == "0000996716" ]
then echo "Correct!"
fi
done
Which worked!
But, I then changed the THEN statement to say gnome-screensaver unlock command
gnome-screensaver-command -d
And locked my screen manually. (CTRL+ALT+L) Swiped my card aaand.... nothing. The scanner had just typed the card # in the password field and hit enter, resulting in a 'password incorrect' to show up on the lock screen. So I unlocked my screen via the password and noticed there was nothing on the terminal screen. So I opened a direct pipe to /dev/stdin and locked my screen. Unlocked it with my password and... nothing again. Does /dev/stdin not contain information that is being typed during the lock screen? What does?
Haaaaalp D:
So, I have this el-cheapo RFID scanner and some RFID tags.
I thought to myself, You know what would be neat? Enabling and disabling the lock screen with this thing.
So the package arrived (along with my IBM carbine, woohoo!) and I tore it apart and hooked it up.
This device emulates a USB keyboard (that explains the driver-less thing they were pushing) and essentially, types out the card ID and hits enter. I thought I could just open a constant stream from /dev/stdin (a la keylogger) and watch for when the card I want was punched in. Thats what lead me to creating this stupid simple script:
!/bin/bash
cat /dev/stdin | while read line
do
if [ "$line" == "0000996716" ]
then echo "Correct!"
fi
done
Which worked!
But, I then changed the THEN statement to say gnome-screensaver unlock command
gnome-screensaver-command -d
And locked my screen manually. (CTRL+ALT+L) Swiped my card aaand.... nothing. The scanner had just typed the card # in the password field and hit enter, resulting in a 'password incorrect' to show up on the lock screen. So I unlocked my screen via the password and noticed there was nothing on the terminal screen. So I opened a direct pipe to /dev/stdin and locked my screen. Unlocked it with my password and... nothing again. Does /dev/stdin not contain information that is being typed during the lock screen? What does?
Haaaaalp D:
No comments:
Post a Comment