This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am new tio java networking concepts.Please tel me how to get Serial number of exernal hard disk/Thumbdrive using java code.and it should work for both linux and windows(platform independent).please send any Documentaton or example if You knw.
Please do not ask for answer to be emailed to you. Please read this for more information.
Also, please use real words when posting to the forums. Abbreviations such as "knw" in place of "know" only serve to make your posts more difficult to read and less likely to generate useful responses.
Himanshu Kansal wrote:Alright, just in the interest of the community or atleast mine, do we have an answer to that?
Moreover is it ethical to do so if possible?
I am not really sure what you are trying to say here. Your first statement gives me the impression that "ok. enough of this rules and regulations. just give out the answer.". I am sure you did not mean it that way, but that's how it came off to me.
I also, am not sure what do you mean by ethical. Could you please rephrase?
There could be various reasons why nobody has posted the answer. For me, I know how to do it, but only on windows and the OP wants a cross platform solution.
We all are here to learn and help learn. The one who started the thread was evident to not reply and I wished the interest of the community be maintained. It's not only the one asking question gets the solution and off he goes. Many others get to learn, surfing through.
That's all what I meant. No offences.
"Ethical" has been used as in "ethical hacking". Is getting SID ok?
Why assume that manucng wants this because he is "hacking"?
Maybe he wants to secure his application in a way, so that it only runs on the computer for which his client bought a license. The program would check, by looking at some unique serial number of the harddisk or motherboard, if it's really running on the computer that the license was bought for.
Note that security measures like that are not infallible; someone who really wants to break the security could decompile or reverse engineer the application and try to remove the security check.
Anyway, this kind of thing is not possible in pure Java. You'd need a platform-specific native library for different platforms on which you want to support such a feature.
Jesper Young wrote: Why assume that manucng wants this because he is "hacking"?
Atleast I am not assuming this, other I don't know of. I use the term to explain the meaning of the word "ethical", would have been better to 'copy paste' from a dictionary I guess.
If such a mechanism is used for securing, re-installation is the easiest way to break it. Usually a registry key would be setup to prevent re-installation. Also such a mechanism would not be format safe.
Anyhow, I think we are deviating from the original question. If I may know, how can we do this?
i am not willing to hack any os or application.i want to secure my application such that no one can steel my application using their thumdrive or EXTERNAL hard disk.i don want to read serial number of cd/internal hard disk.i can get code for windows os.but i want code such that it has to work for both linux and windows.
Joined: Aug 10, 2009
Rob Prime wrote:You will have to go native, but you can simply provide two implementing libraries; one DLL ("javaranch.dll") for Windows and one shared library ("libjavaranch.so") for Linux.
means? whether i have to create mfc/win32 dll using visual studio?.if so i can create dll for windows os.i don know how to create for linux?.will the same dll work for linux?.
For Windows, you can use Visual Studio, but not with MFC as Jesper said. If you don't have Visual Studio you can also use MinGW in combination with gcc. You can also use Delphi with the help of this page.
For Linux, gcc is usually the way to go. No idea what Mac OS X uses.
manucng davangere wrote:i want to secure my application such that no one can steel my application using their thumdrive or EXTERNAL hard disk.i don want to read serial number of cd/internal hard disk.i can get code for windows os.but i want code such that it has to work for both linux and windows.
I'm confused by your stated aims versus your way of attempting to go about it. The only way I can reconcile this is if you were distributing your application on a thumbdrive, and wanted to confirm that the thumbdrive is present on it.
I agree with Andrew here. If you need a value that is unique to a machine, the mac address is the way to go. These values are actually assigned by the vendors to make sure that they are unique -- as duplicate values will cause it to not work on a switch/hub.
And yes, they can be reassigned... and in the case of a virtual environment, I did this all the time, after copying a VM. You can also automatically get a new mac, when multiple NICs are bonded. etc. The point is... this is still probably your best bet at locking the application to a machine. Sure, a mac address can be reassigned, but if the user has that skill, he can decompile your program too, and even if the mac is reassigned, it won't work if it is on the same LAN as the other machine.