Post Reply 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[MENU] Another action on Enter than timeout
2014-03-10, 13:19 (This post was last modified: 2014-03-10 13:29 by sebastian.)
Post: #3
RE: [MENU] Another action on Enter than timeout
I tought you were to find out that from the menu title :-)

But here comes:
I have a keyboard-type HID cardreader that outputs CARDNUMBER+ENTER (as if it were typed on keyboard) when a card is swiped through.

As a simple anti-hacking measure, I did make so each menu item has a shortcut corresponding to a digit, and then the first menu in a menu loop, does have unlimited time to begin, and then each subsuquent menu, then the user only have 56 milliseconds to make a selection.

When a card is swiped through, it will send the keypresses with a delay of 20ms between, so the card reader will be fast enough to type the card number, but a human typing on the keyboard, will be unable to type sufficently fast.
56 milliseconds was the minimum delay allowed by "CHOOSE" Before it did ignore the delay and allow unlimited time.

Currently, ENTER now checks if a cardnumber of exactly 10 digits has been entered, faster than 56 ms between each digit, else it restarts from the beginning.

If the user hammers on the keyboard and are lucky enough, he will enter exactly 10 digits by luck, and then the user does not need to press enter since 56 milliseconds implies ENTER.
Of course, it will be a random cardnumber, but he could hit a valid user by luck.

If I could separate the "Timeout" to actually execute Action A, and the "ENTER" to actually execute Action B, then I can code timeout to Always restart from the beginning, thus making it even harder since the user must, to hack the system, press 10 digits AND enter, with a maximum delay of 56 ms between keypresses.

A nice thing could be to add --timeoutaction [action], for example "--default done --timeoutaction cancel" would execute "done" menu item if user press ENTER without doing anything else, and execute the selected menu item, if the user selects a menu item and press ENTER, and would execute "cancel" if the user Waits the timeout.

This also would have use cases in other cases, for example if a system administrator want the user to press enter within 3 seconds to initiate recovery, OR select a menu item within 3 seconds to do Another thing OR simply wait 3 seconds to do a normal boot.
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: [MENU] Another action on Enter than timeout - sebastian - 2014-03-10 13:19

User(s) browsing this thread: 1 Guest(s)