I'm working on a program that operates like a TOTP protocol. The program is giving the user passwords to other applications every 30 seconds. For security reasons, I want to be able to block the PrintScreen key and similar screen capture methods. Does anyone have any idea how I can prevent this? I am working with Windows programs.
Your question is incredibly vague and provides no context or research, but here goes:
You cannot completely prevent screen capture programs (like snipping tool or OBS) from capturing your software on a screen. However, here's a couple of ways you can prevent the printscreen tool in windows.
Method 1: Disable unwanted keystrokes
You can read the Windows API to disable unwanted keystrokes. This CodeProject documentation should show you how to do it in C#.
Method 2: Hide your application
You can use something similar to this to hide your application on screen so if the PrintScreen button is pressed, it will hide your application (and thus hide the password(s) on screen) from the screenshot.
private void Display_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Snapshot)
{
this.Hide();
}
}
Please note that this piece of code is not guaranteed to fix the problem. Use it as an idea or template to build your own methods of hiding the window.
If you are still absolutely desperate, you can change the software to show a button that says "Copy Password to Clipboard". Instead of displaying the password in a textbox, the user can see a label like "Amazon Account" and then click on the button that says to copy their password to the clipboard. This means the actual password is never revealed on screen yet the user can still copy and paste it into their Amazon account etc.
You should not be developing a TOTP client on a system that is also used as the main system to authenticate. If it is a different system, then you should not care about prntscrn at all.
Related
I am using Gnome 3.34.3.
When I need to unlock a private key (ssh, git, etc.), a modal window appear and ask me to write the key's passphrase.
The GUI is modal and it is not convenient for me.
I would like to unlock my private keys from either the terminal or a not modal GUI.
Is it possible ?
Thank you !
echo "pinentry-program /usr/bin/pinentry-gtk" >> ~/.gnupg/gpg-agent.conf
gpg-connect-agent reloadagent /bye
Almost solved.
In short; no. [sorry]
The dialog is kept modal to mark its importance. For example, such password, urgent info windows must be kept modal to get the user's attention as soon as possible. Modal also prevents you from accessing the other part of application, which otherwise would spoil the application entirely.
For example:
if the dialog wasn't modal while getting authentication, there is no meaning at all. The dialog could be just kept down by the window manager without you even knowing it. There are possibilities.
I agree, modal windows are irksome as many crazy developers use it for everything (You can read more about this on GNOME's HIG guidelines), but a dialog should be modal when it has to be.
It depends on the developer to choose what should be modal and what should not be. That is it depends on the application, and there is no system wide settings available to change that behavior. You can, so, ask the respective developer to replace the modal windows with convenient ones.
To your question of accessing it from terminal, it also depends on the application.
I'm writing a WinRT game for Windows 8, in C#, using the excellent MonoGame. I've reached the part where the user has achieved a high score and needs to enter their name. This is causing me more pain than I'd anticipated so I thought I'd ask for help.
First of all, is there a simple "enter some text" function that I can call, similar to Guide.BeginShowKeyboardInput in Windows Phone 7, or the ancient InputBox command in VB? I'm using Windows.UI.Popups.MessageDialog for displaying simple dialog messages, but can't find any similar thing for requesting text from the user.
Failing that, is there a way I can easily use a little piece of XAML to present a textbox for the user to use?
If neither of these are possible, I guess I'll have to wire this all up myself... I then would plan to intercept keystrokes and display the required text on screen myself. As I don't have a physical tablet (just the simulator) I'm struggling to start with this. How can I:
Detect whether the device has a physical keyboard, so I know whether or not to display the on screen keyboard?
If there is no physical keyboard, how can I show and hide the on screen keyboard?
Some of these sound like they should be easy to answer, but I've yet to track down answers to any of them.
Many thanks!
Adam.
Hey there is such a way to do this in monogame. There is a new template that allows you to create a XAML + Game game which allows you to use the game class you a used to with the xaml bits as well. These links should get you started. The monogame team rocks.
There are the three game types listed there. You want XAML + Game there is a template for it now if you get the proper version of monogame.
https://github.com/mono/MonoGame/wiki/Windows-8-Project-Types
let me know if you need more help
This is not a cross platform solution but you could use a FlyOut and place the controls for data entry on the window. FlyOut guidelines are here and UI Controls for text input guidelines are here. I have also used MessageDialog in a MonoGame for asking the user simple questions (up to 3 options) or to get a Yes|No response. You can get details of that class here.
I'm trying to configure an automatic, Bluetooth-powered computer lock and unlock system. So far, I've got the lock script down, but I can't think of a script which would unlock the screen, as my comp is password protected. Any ideas?
You normally have two options when you're trying to script something. First, if the application is scriptable then you can issue applescript commands directly to the application. If it's not scriptable then your only other option is with GUI scripting where you simulate pressing buttons and typing keystrokes like if you were sitting in front of the computer doing it yourself. You use System Events commands to do this.
In your case I think you need the second option. In general when you gui script the application has to be frontmost. Since the "unlock screen" is probably frontmost at that moment you have a chance this will work. However I have not tried it so you'll need to do some testing to see if it's possible. Just do some searching for gui scripting examples and give it a try.
I would imagine your script will look something like the following. This assumes the cursor automatically is placed in the password section of the window so that the "keystroke" command will actually be typing in the proper place... otherwise you need to figure a way to put the cursor there before you type anything.
tell application "System Events"
keystroke "unlock password"
delay .5
click button "OK" of window 1
end tell
I create a program that simulates me browsing to gmail, entering the user name and password and clicking the submit button.
All this with C#.
I would appreciate two kinds of answers:
One that tells how to do this programaticaly. Since I may be interested in automating more
sophisticated user activities.
On that tells me about a program that already does that.
Thanks!!
I want to access my mail account with a double click (without browsing, entering username and password and pressing submit).
Why not check the 'stay signed in' box, and add a bookmark toolbar item for Gmail?
alt text http://img192.imageshack.us/img192/6240/picture5zw.png
Do it once, and all future logins are a one-click process. Am I missing something? Why overcomplicate this with a C# program?
Well, depending on the browser you're using, it might be much simpler to use a greasemonkey userscript (on FireFox) that does auto-login for you.
If you want to simulate user activity take a look at AutoHotKey.
Also if the issue is specific to logging into websites take a look at LastPass. They have plug-ins for every major browser and mobile device. I haven't type out a user name or password on a website in months.
If your ok with clicking 'go' (or wharever) on your application and then clickingin the username field. Look into Sendkeys:
Put this in the onClick event of a button and replace text with your user details:
SendKeys.Send("USER#DOMAIN.COM{TAB}PASS{TAB}{TAB}{ENTER}");
You might also want to put a timer or make your program wait a few seconds before actually sending the keys to give you time to click in the username box.
Use WatIn. and this is a placeholder to get to 30 Chars answer
My problem is very simple, but implementation can be hard!
I want that my application (Windows Application:: Visual C# .net) is launched whenever the user uses some keys combinations (on his keyboard).
For example it types Ctrl+W+W and my application is launched, that's all, I want the simplest implementation, less code, memory...
Thanks :D
You would need to write a keylogger type application in conjunction with your app which monitors for keyboard events. Once your specific shortcut is triggered you could then load your application.
See here for information on how to capture keystrokes.
Create a shortcut to the application, and assign a hot-key combination to the shortcut. Depending on the O/S, not every keystroke combination can be assigned to a shortcut, e.g. you may be able to assign Ctrl+Alt+W but not Ctrl+W+W.
On Windows, you can create a shortcut (on the desktop) to your application.
When you open the properties of the shortcut, on the second tab (labeled "Shortcut"), you can assign a shortcut key. But you can use only Ctrl+Alt+key shortcuts.
I don't think this is possible in the way that you framed this question. What is possible, however, is to have your application run automatically on startup without showing any forms, have it hook into Windows to monitor all keystrokes (I'm not sure how to do that part, exactly) and then show a form when the user presses a particular sequence of keys.
So in other words, your application would have to be running from the time Windows starts, but only show itself (make a form visible) when the user clicks a particular key sequence.
Update: here is a link to an article that discusses how to do global keystroke capture using C#: http://blogs.msdn.com/toub/archive/2006/05/03/589423.aspx.