6

Let me explain what it's like. I want a program that's installed in a PC but you can't run it unless you insert a USB drive where some part of the program is stored. So the point is, the program is useless if you don't have both PC and USB drive. Since I want it to run in Windows, what kind of language shall I use apart of .NET and C#?

Can I done with Python?

Devyn
  • 2,255
  • 7
  • 32
  • 40
  • 3
    http://www.fsf.org/bulletin/2007/fall/antifeatures/ – Flexo Feb 12 '11 at 12:58
  • How worried are you about the extra code being on a USB drive? Because there's almost no way of telling the difference between the code being on a USB drive and the code being on a specific place on an internal hard disk. Or on a network share. Its all just files. – Spacedman Feb 12 '11 at 12:58
  • It's just all file but what I want is the program must not be accessible if there is not match USB and PC. – Devyn Feb 13 '11 at 12:21

5 Answers5

4

If you're trying to do this for copy protection or license management, there are commercial solutions for this that are very difficult (but still not impossible) to beat. For you to develop something that's robust will end up costing you more than it would cost to license a solution from Pace or Aladdin or any of their competitors.

bgporter
  • 35,114
  • 8
  • 59
  • 65
4

Commercial solutions often have (usb) devices with a microchip that can do public-key cryptography. This rules out faking the device.

Example: program generates a challenge-code, encrypts it with public key -> device decrypts it with it's secret key (stored in microchip) and gives the challenge-code back for verification.

An attacker can only attack the communication between program and device or directly the program. This is were code obfuscation, on-demand code decryption, ... comes into play. Very complicated :) and no system is 100% safe.

tauran
  • 7,986
  • 6
  • 41
  • 48
2

You can have the whole program installed on a computer and allow it to start only when a specific USB drive is inserted.

For example you could read the serial key of the drive(each USB drive has one that's unique).

For more information on how to do this have a look here.

Community
  • 1
  • 1
Adrian Fâciu
  • 12,414
  • 3
  • 53
  • 68
  • That's easy enough to fake on virtualised machines and not too hard to just hack out from whatever you leave installed anyway. – Flexo Feb 12 '11 at 13:01
  • 1
    Any solution is going to be pretty easy to fake once you get into the land of virtual machines. – Jonathan Grynspan Feb 12 '11 at 13:03
  • Maybe the USB key is going to be physically held by someone so that the program only runs when that trusted person is present? WE DONT KNOW!! Will the OP please enlighten us? WHAT IS THE REAL QUESTION HERE??? (okay, I'll calm down now) – Spacedman Feb 12 '11 at 13:08
  • This is slightly harder to fake than the solution of just keeping part of the program on a USB. A combination of both would be fine but like Jonathan said, nothings really going to be hard to fake. To get a secure solution you would need some specialist hardware on the USB key I would imagine – ForbesLindesay Aug 01 '11 at 16:00
2

To get back to the OP's question, you will certainly want a dongle from us (Wibu-Systems), Aladdin (now part of SafeNet), KeyLok, or some similar product. Each has pros and cons. Our system, for example, has never been cracked and has protections against license violations on VMs.

Prices vary.

I know our product and SafeNet's will allow you to write your app in C++, C#, and probably Python, since they are encrypting your final binary (mostly they don't care how it is created). Some research is needed; all the vendors I listed have free SDKs that provide you with an actual hardware device and the tools you need to test your app.

To roll your own, or to check for the SN of a USB flash drive, will almost certainly be problematic. SNs are easy to crack and fake. Good software-protection devices pack a LOT of thought, development time, and technology into a simple-appearing gadget. You can write your own BIOS or build your own motherboard, too, but why bother?

John Browne
  • 700
  • 4
  • 6
1

If you can live with starting the program after you've inserted the USB drive, it's pretty easy. You can put the code that's actually doing what the program is supposed to do in a separate module, which the part of your programm running on the PC imports (for example with the imp module) and then starts the main part (that was imported from the USB drive).

Wieland
  • 1,663
  • 14
  • 23
  • What's to stop copying the contents of the USB stick? You can keep the path the same trivially (e.g. map network drive, add an extra disk partition to make it keep the drive letter) – Flexo Feb 12 '11 at 13:04
  • The problem is not copying the content. It can be copied but won't be able to run or get the data from the program if they only have either USB drive or PC. – Devyn Feb 12 '11 at 14:59
  • the program can be run after USB drive is inserted. Will that be also possible done with Java? – Devyn Feb 12 '11 at 15:03