How to get client MAC address in java servlet? [duplicate] - java

This question already has answers here:
how to get a client's MAC address from HttpServlet?
(5 answers)
Closed 9 years ago.
i want to identify a client machine uniquely from servlet.
Basically my application is about to take visitors detail. In my application i have offers for a user who visited me first time. In this scenario, i need to get information of client's machine so that if get back on site then my application can recognize that from this machine client is already visited.
I am using JAVA SERVLET.
Any point regarding this scenario will appreciated.
Thanks in advance.

Using only Servlet technologies, it is impossible to get MAC addresses. MAC address detection need software running on the client machine - a browser plugin, ActiveX control, JavaScript script or something like that. It would also most likely trigger security warnings, if the browser tried to access such information.
Cookies should be used as a first method of returning visitor detection. It is quite easy to clear them or use a different browser, but the majority of internet users don't think about such things.
Going for MAC addresses seems needlessly invasive to me.

Related

Get client windows username

Can i get the username of the currently looged in person using applets. If yes, how can i use the applet in my dynamic web project?
I know in I.E we can do like this
var objUserInfo = new ActiveXObject("WScript.network");
document.write(objUserInfo.ComputerName+"<br>");
document.write(objUserInfo.UserDomain+"<br>");
document.write(objUserInfo.UserName+"<br>");
var uname = objUserInfo.UserName;
alert(uname);
but i want it using applet so that it will work in any browser.
Be aware that this is in fact an attempt to circumvent the browser security.
look at the answer to this similar (but not excactly the same) question.
http://www.coderanch.com/t/243316/Applets/java/windows-NT-login-applet
ActiveX will not run properly in Chrome / Firefox.
Javascript won't (due to security reasons) allow you to get that information from the operating system.
Flash is cross browser, and can be used for this, but it is difficult to get around chromes sandbox.
so my best suggestion is java.
Here is a similar question that is answered on why you can't without an applet.
https://security.stackexchange.com/questions/36728/can-your-windows-or-linux-username-be-exposed-to-websites
And the provided link from an answer to another similar question points to a java solution, but there are limits to the success:
http://www.rgagnon.com/javadetails/java-0441.html
However I think you should start from there, and then post a solution here when it works ;)
See the problem here is that when the applet tries to interact with local resources the browser must allow it, or block it..
Security settings in IE, may prevent that if set to high, and Chromes sandbox may block it if you do it wrong. I don't know of problems with Firefox or Safari, but I guess you'll find them when testing...
Good luck.

Is java code decompilable? [duplicate]

This question already has answers here:
How do I "decompile" Java class files? [closed]
(19 answers)
Closed 8 years ago.
I would like to know if Java code is decompilable? Because I am doing an app for Android and i'm wondering if using the mysql connector is safe or not?
Talking about the java code into an android application.
Thanks for your answers.
Your question is a nice example of the XY problem. It seems that you intend to, actually, have an android app use a database. Decompilation is the least of your worries. A user can use a packet sniffer to also get your authentication details in some cases. A simple strings foo.apk search can come up with the DB authentication details. Someone could hit your DB server from outside irrespective of your app;
A more viable solution would be to set up a web server that can handle untrusted requests and forward them to the database after filtering them. Then, you no longer have the risk of people stealing your DB credentials from the APK or device, since they no longer live there.

Java Game Server on website

If I were to have a website with a webhost like godaddy, how could I run a java program on that website as a server so that people can connect to the game with the address: www.whatever.com as opposed to an ip to connect to my pc?
The answer depends on your goal. You either have them give you a virtual or dedicated server that you can log in to the OS and create the application as an executable, or they allow java servlets.
You can read a little bit about servlets here: http://en.wikipedia.org/wiki/Java_Servlet
I know crappy, I posted a wikipedia entry...lol :) Cheers
EDIT:
I just saw the last part of your question and realized also what you are attempting. You need a virtual or actual server that you can log into the OS remotely. You need a DNS server for the domain name resolution. This can be provided by go daddy. I think you can get a virtual dedicated for like...30 a month or something? Depends how much performance you need.

Web Service or a simple url that can give me the last Java version

I have an application that is having problems with some java old versions, I would like to know if there is a URL (that's not a web page for humans) that I could check and parse to know if there is a new version of java.
I want to do inform the user that there is a new version of java every time a new one is released. My application is done for Windows and Mac so it would be nice if this URL could give me information about different platforms.
Thank you so much.
P.S. Yes, I googled this question and I didn't find anything.
The answer is simple but unsatisfactory: no, there isn't. A work around might be if you embed a JEditorPane (possibly hidden), direct it to http://java.com/en/download/testjava.jsp, parse the content and look for "An old version of Java has been detected on your system." or so.
Update
I monitored the network traffic from testjava.jsp. Turns out it requests this URL http://java.com/applet/JreCurrentVersion2.txt which currently returns 1.7.0_10...which is the latest and greatest, indeed.
Java can tell you what version of java the client machine is running. I don't think the browser can discover this without running an applet. A Web service is running on some remote server; I would find it disturbing if that server could tell you what version of java the local machine is running.
Your application can display an error message if the user has an older version of java. Otherwise JNLP is a greatest out of the box solution. See http://javatester.org/version.html
The code to determine your java version is simple :
System.getProperty("java.version")

Desktop Sharing without installing software

Helo ,
I want to create desktop sharing solution , without having the user to download any software .
Can java help ? I have seen such a solution so I know it for sure that desktop sharing without downloading software via browser is possible .
I am not sure how to achieve it .
Does any one know ?
You can achieve this on client side. This means that you have to create thin client that shows screen of remote machine, catches keyboard and mouth events and passes them to other side. If you wish to complete the task without downloading solution on server side you can use existing software already supported by targeted OS. For example remote desktop for Windows or XWindow remoting for Unix systems.
So, architecture of system you are dreaming about will look like the following.
Server that creates remote desktop connections to target machines.
Web front-end that delivers the screenshots from the remote desktop to client's browser, catches events, brings them back and emulate user's behavior for the remote desktop session.
Please pay attention that if you wish to create something that will really work, e.g. be responsive enough, support many concurrent connections etc you need at least 5 developers for at least 1 year (full time). After a year you will get solution similar to LogMeIn but worse (I mean quality).
Anyway I wish you good luck.
Almost all OS's support this out of the box. Windows and Mac with Remote Desktop, Linux with X server

Categories