-2

Is there any way in Java where if I run my Java app in background and whenever I click on some App, I can get the name of it.

This Java program should run in background without the knowledge of the user and will send the app name to a remote server.

jefflunt
  • 33,527
  • 7
  • 88
  • 126
Mubasshir Pawle
  • 309
  • 1
  • 3
  • 19
  • Guys, there are legit reasons to do this, and besides, the malware genie has already left the bottle. It's the responsibility of users and the OS's security mechanisms to maintain system security, and not allow the installation of malware. The presumption that this is for malware isn't fair. – jefflunt Nov 23 '11 at 15:17
  • 1
    @normalocity: `without knowledge of the user` makes it hard to give the benefit of the doubt. – Dave Nov 23 '11 at 15:20
  • @normalocity So please tell, which legit application should "run in background without knowledge of user"? – Voo Nov 23 '11 at 15:21
  • My belief is that the appropriate action, if you're concerned about that, is to simply ignore the question, or flag it. Not knowing the user is a question of trust, which is completely outside the scope of the question itself, and kind of misses the point. – jefflunt Nov 23 '11 at 15:22
  • 3
    @normalocity So if the next person asks how he can use the newest security vulnerability XYZ to remotely install software on another PC - obviously without knowledge of the user - we should just tell him how to do so and at best write a small example program? To cite OotS: Good not stupid.. – Voo Nov 23 '11 at 15:24
  • @normalocity: If it's your computer you're using, is it OK to run this software without your knowledge? If it's not your computer that you're using does it matter? Either way, there's no good reason to run unannounced. – Dave Nov 23 '11 at 15:28
  • I provided an answer to the question that illustrates a legitimate use, and I'll leave it at that. If someone explicitly said they were trying to exploit a security vulnerability, that would be a different question - we're not answering that question - we're answering the question as written above. We're also getting off topic here. I'd be happy to continue the discussion of "malware + security + information used for malintent" in chat if you like. – jefflunt Nov 23 '11 at 15:30
  • @Dave - that situation doesn't always apply in business applications, where the machine the software is running on is owned by the company, and the user is an employee. Don't get me wrong, guys, I agree with what you're saying, and I'm all for privacy - but we're assuming a lot more *around* this question that isn't actually *asked* in the question itself. You can say that it's not a big leap to assume that this question is for malware, and that's true, but it's still an assumption - that's all I'm trying to say. That assumption, whether correct or not, doesn't make this a bad question. – jefflunt Nov 23 '11 at 15:33
  • 1
    @normalocity Umn wait no. Your example clearly showed a use case where the user KNEW that the program was running. If it had been formulated in such a way - sure he'd have gotten the answer (well the simple version is a 8loc c++ program, he would have gotten the code..). But "send data without knowledge of user to remote server" is clearly something a user doesn't want. Sometimes all the difference is in how your formulate a question. – Voo Nov 23 '11 at 15:41
  • @normalocity: `that situation doesn't always apply in business applications, where the machine the software is running on is owned by the company, and the user is an employee` is addressed by my second question above; there's no need to run unannounced. If there is (i.e. counter-espionage), you'll know how to do it without asking SO. I'll concede your point that it's a good question and we are jumping to conclusions, and I'll shut up now :) – Dave Nov 23 '11 at 15:45
  • @Dave - and I will concede your point that it's not good to run unannounced, even in business. If users are being monitored (for example, bank tellers for anti-fraud software), that is a legit use for monitoring, but there's no reason that the teller shouldn't be made aware that their activities are being monitored. – jefflunt Nov 23 '11 at 16:02
  • just because few years back, I posted this question and some fellows down-voted this, now I can't post any question. common people I even accept right answer long back and implemented what required years back – Mubasshir Pawle Oct 30 '14 at 11:50

2 Answers2

1

While I question the motives for this, this won't be possible within the bounds of the Java API. You would need to use JNI to interface with the underlying OS, or make calls to an external program that could provide you with these details.

ziesemer
  • 27,712
  • 8
  • 86
  • 94
0

I wrote a time-tracker app that does something similar back in the day, to track how I was spending time on various projects/applications, etc. The idea was to track my application usage locally, and use a POST request to a web server for centralized logging. I could also run this app on any machine I wanted, and the POST request would still go back to a central server, so I could track my own activity across multiple machines.

One thing you could use is JNI to bind to the Win32 API, which can then give you access to Window titles, process information, etc.

This Q/A should get you started: How can I read the window title with JNI or JNA?

Somewhere (I can't find it right now) there's a .JAR on the net that wraps the win32 API, making this sort of functionality very simple to do in Java.

Community
  • 1
  • 1
jefflunt
  • 33,527
  • 7
  • 88
  • 126