JNativehook not capturing passwords - java

Thank you for taking the time to read my question.
I'm learning Java and I'm experimenting with JNI. One thing I'm now doing is trying to make a keylogger. I've got it to write the keystrokes to a file, et cetera, but it's not capturing password keystrokes. My guess is that JNativehook disabled it intentionally.
So, I went looking into the source code but found nothing. I'm mainly looking for a solution on OS X, as that's all I need.
If anyone could help me with this, it would be greatly appreciated.
Thanks in advance!

This is probably the result of a security feature on OS X and is part of the way JNativeHook was designed to function. Most systems do not enforce this kind of policy, however, Apple has really lead the way on input security via their accessibility API. If you want to get password data on OS X, you will need to create something at the kernel level and it will require some kind of privilege escalation to at least install.

Related

How to input data programatically into a system that puts up a form but doesnt have data upload features

I'm not sure if this question is entirely appropriate for SO but it seemed to work better here than in SuperUser so apologies if its in the wrong place. Happy to move it if so.
I'm trying to figure out how I'd automate the input of data into a system that didn't accept data uploads, but rather used forms put up on a screen. Use cases are e.g. where an enterprise wide system does accept uploads but the user lacks admin rights to fill in data she is required to populate, or with very old and specialized legacy systems where the functionality just doesn't exist and a serial input-review-rollback-commit cycle is enforced.
I'm not a programmer by trade so this is partly thought experiment but also to answer a question that has arisen at a business that I'm involved in.
I'm reasonably familiar with python and java if libraries for keyboard emulation exist but would be happy interpreting a pseudo code response too.
Responses that point to existing providers of such functionality that is embeddable or that tell me if I'm barking up the wrong tree also gratefully accepted.
Once again apologies as I know this isnt intuitively the best spot for this. Please do point me to a better location if you know of one.
Thanks
Possible solutions exist but they're all pretty bad
Is it a desktop application or a web application? If it's a web application you can use ghost.py to automate the interaction and submission of new records/entries. This work will be a glorious bundle of fun for the lucky code jockey who draws the short straw.
If it's a desktop application, it will be a great deal more difficult. Is it on Windows? Linux? MacOSX? Is the software written in Java? Using the Swing toolkit? AWT? SWT?
If it is a native Windows application you might be able to use Autohotkey to automate desktop interaction. This can be as basic as automatic clicks in pre-recorded parts of the screen, automating TAB keypresses to move around the input cells and reading input text from a data file and writing that out into the input cells. This will be even more entertaining than the web-solution mentioned earlier: truly the necessary ingredients for an authentic war story worthy of the annals of internet lore.
This is likely to be a lot of intricate work, error-prone, and subject to failure in the future if the UI of the software is changed; and such changes are very likely. It would be a lot easier to help if you could add more detail to the question.
Before embarking down this road, if I were you I would beg and plead with the software vendor to either provide me with an upload API; I would even offer to pay the vendor to upload my data for me. I cannot imagine either of the solutions I mentioned will be any cheaper, unless the work time of your developers has no value.
Good luck.

Check for keystroke

Im making an application that should see if your online or away.
So i need to somehow see when the user hit a key on the keyboard last time.
The application is running in the background and you can only access it from the trey.
Is this possible and if it is how would i check.
Best regards
I believe that what you're looking for can be done via a global keyboard hook, but that doesn't have direct support in the JVM. From Googling, it would appear that your only options are to write a C++ shim which you can use via JNI, or go via libffi with JRuby.
From what I've read here it is not possible to add KeyListener to the SystemTray. The only listener that is supported, is the PropertyChangedListener.
Furthermore from that question it seems to be possible on Windows but not on Linux and MacOS.
This is possible, but not using Java. You'll have to use JNI to access OS APIs that provide this information (and implent it differently for each OS).

Block java hotkeys, like alt+esc, control-alt-delete

I'm building a Java App, and I need to block the hotkeys, like Alt+Tab, Control+Alt+Delete... Basically theses. My application requires this, because it is a control application. If the solution is not possible on java, any one knows another way to do this.
Thanks you!
Edit1: I'm build a "computer manager" that requires a password. If the password is not type or its wrong, the user can't do nothing on computer.
It works like a default login screen view, but with many users. Got it?
Edit2: After users type the password, he can use all (or some, like alt+tab :) these hot keys! Got it? [2]
Generally speaking you can't, because those keys are intercepted by the operating system before they get to Java.
Give us more info about the OS and enviornment you're in and we might be able to come up with workarounds.
I don't think there is an easy, programatic way to do it.
Unless there is some hidden class inside JDK6 I would say that these combinations are handled by the OS (that catches keystrokes in anycase before dispatching them to applications) so your OS will decide what to do wth keystrokes before Java
If something exists, then it's a hack unrelated with Java but more with registry or similar things :)
One of the whole points of CTRL-ALT-DELETE is that it specifically wants to prevent applications from overriding their functionality. If that were not the case then anybody could write an app that brought itself up when CTRL-ALT-DELETE was pressed and either made itself look like the 'change password' app or the screen saver. Either case would allow the app to steal passwords from people.

Java: how to disable mouse and keyboard system wide

Alright, I am not sure if this is even possible with Java specifically, but I am working on a a small program very similar to synergy and I need to be able to completely disable input from the mouse and keyboard on the host computer, but still record the input within the program. I can not think of any clean and robust ways to do this with Java. Is this possible?
Any way you will have to use JNI for such a purpose.Have a look at this blog ,it will give you some idea.

Java VNC Applet vs Screen Capture

I am trying to make an application in which one component captures the screen of the user (for screen casting). I am aware that there are two options to achieve the same using a Java applet (please correct me if I am wrong). First is to use the java applet to take screen shots continuously and convert it into a video and upload it as a video file. And second is to create a java vnc server and record it as a .fbs file and play it using a player like: http://www.wizhelp.com/flashlight-vnc/index.html
I would like to know the best solution in terms of video quality, file size, cross-platform compatibility (windows and mac), firewall problems and finally ease of implementation.
I am very new to Java. Please tell me whats the best solution for my problem. Also, is it easy enough for me to program it on my own or should I get it developed via a freelancer. I have tons of programming experience (5+ years in LAMP) but none in Java.
Thank you very much.
I agree that this is pretty hard. I implemented those two solutions (VNC and onboard screen capture) plus a third (capture from an external VGA source via an Epiphan grabber) for a former employer. I had the best bandwidth-to-quality ratio with VNC, but I got higher framerate with VGA capture. In all three cases, I reduced the frames + capture times to PNGs and sequenced them in a QuickTime reference movie. Then I made flattened video (MPEG4 or SWF) of the results. In my case, I then synchronized the screen video with a DV stream.
In the end the technology worked (see a sample of the output) but our business model failed.
From what I know, the older versions of applet had security restrictions that may not allow for screen capture. Instead, a java application may be feasible.
Regarding the build-it-yourself vs the fire-a-coder, it depends on how you value your time compared to what you can find on a freelancer site.
I think you can find someone from India/Romania/Poland/Other countries that can make it for an affordable price
Given your Java knowledge and the difficulty of the task, have you considered taking an alternative approach? For example, how about a native VNC server for the end-user, which is just a small download and then they click "Run." And that native server is programmed to capture the screen and send it straight to your web server, which has a client like vnc2swf or other means of converting the VNC stream to a video or .fbs file? Does all that make sense?
Admittedly, without Java, you have to prepare one executable program per platform you want to support, however, I don't know. That still sounds easier to me. Consider Copilot.com. They are doing VNC but they still use small native apps for each platform.
Sorry but this seems the kind of job that requires a lot of experience. Even if you find code snippets all around the net to fix this and that, the overall result may be way worse than simply hiring an experienced Java programmer.

Categories