4

I have developed a small application and now i want to protect it.

I want to run it only on my own computer and i have developed it for myself.

How can i do that?

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
Web Worm
  • 2,080
  • 12
  • 40
  • 65
  • 2
    What exactly do you want to protect it from? If you only run it on your own computer, surely no one can steal it? Presumably no-one else uses your computer, or if they do, you trust them? – MarkJ Mar 04 '10 at 14:34
  • 3
    You should view the following link: http://stackoverflow.com/questions/651291/securing-a-net-application/651375#651375 and use @Jay's answer if you really want to pursue this. – David Mar 04 '10 at 14:35
  • Are you saying you *accidentally* wrote a virus and now you want to stop it spreading? – Daniel Earwicker Mar 04 '10 at 14:54

7 Answers7

6

A. Don't publish it.
B. Hard-code your computer name in the code, and make the first thing the program does to be verifying that System.Environment.MachineName matches it.

Jay
  • 56,361
  • 10
  • 99
  • 123
  • if i re install fresh copy of window, i don't think that machinename remains same...... – Web Worm Mar 04 '10 at 14:31
  • 1
    @testkhan: You can make the machine name whatever you like. – Adam Robinson Mar 04 '10 at 14:33
  • 1
    ...which also means anybody else could set a machine name to match what is required to run your code, assuming that (1) they really want to run your code, and (2) they know that a specific machine name is required. – Jay Mar 04 '10 at 18:04
  • Bad idea. Specific machine name is required. – user4951 Mar 22 '17 at 07:56
2

You could always check the processor ID or motherboard serial number.

Private Function SystemSerialNumber() As String
    ' Get the Windows Management Instrumentation object.
    Dim wmi As Object = GetObject("WinMgmts:")

    ' Get the "base boards" (mother boards).
    Dim serial_numbers As String = ""
    Dim mother_boards As Object = _
        wmi.InstancesOf("Win32_BaseBoard")
    For Each board As Object In mother_boards
        serial_numbers &= ", " & board.SerialNumber
    Next board
    If serial_numbers.Length > 0 Then serial_numbers = _
        serial_numbers.Substring(2)

    Return serial_numbers
End Function


Private Function CpuId() As String
    Dim computer As String = "."
    Dim wmi As Object = GetObject("winmgmts:" & _
        "{impersonationLevel=impersonate}!\\" & _
        computer & "\root\cimv2")
    Dim processors As Object = wmi.ExecQuery("Select * from " & _
        "Win32_Processor")

    Dim cpu_ids As String = ""
    For Each cpu As Object In processors
        cpu_ids = cpu_ids & ", " & cpu.ProcessorId
    Next cpu
    If cpu_ids.Length > 0 Then cpu_ids = _
        cpu_ids.Substring(2)

    Return cpu_ids
End Function

Was taken from where: http://www.vb-helper.com/howto_net_get_cpu_serial_number_id.html

Here's a question by Jim to convert this for Option Strict.

Community
  • 1
  • 1
the_lotus
  • 12,668
  • 3
  • 36
  • 53
1

I have made things like this in VB DOS.

I either made a non-deletable file that is key to a specific machine with a code inside, and/or read the .pwl files and have several checks, that are only on your machine. The non-editable file is made with extended character sets like char 233 so when a person tries to look at it, it will open a blank copy (edit) (write.ex), so data cannot be read and it cannot be edited moved or deleted.

It needs to be certain characters; I am not sure if every charter between 128 and 255 will work it, some extended characters work to do this some will not, also it can be defeated, but it will keep some people out,

But it can be read or checked in a program environment. Nothing is totally secure, this is some of the things I mess with.

Note: the file will be very hard to delete, maybe make a test directory to test this.

I hope this is OK I am not very good at conveying info to people; I have programmed since 1982.

steven
  • 11
  • 3
  • I also made a program,back when we all used floppy drives, called keyway I put a non deletable file on a floppy disk , and make a program that read the floppy and looked for that file, and signiture – steven Oct 08 '12 at 04:05
1

It really depends on who is the "enemy".

If you wish to protect it from your greedy, non-cracker, friends, then you can simply have the application run only if a certain password is found in the registry (using a cryptographically secure hash function), or use the MachineName as Jay suggested.

But if you're thinking of protecting it from serious "enemies", do notice: It has been mathematically proven that as long as the hardware is insecure, any software running on it is inherently insecure. That means that every piece of software is crackable, any protection mechanism is bypassable (even secured-hardware devices such as Alladin's Finjan USB product key, since the rest of the hardware is insecure). Since most (if not all) of today's hardware is insecure, you simply cannot get 100% security in a software.

In between, there are lots of security solutions for licensing and copy-protection. It all comes down to who is the enemy and what is the threat.

M.A. Hanin
  • 8,044
  • 33
  • 51
1

No matter how hard you try, if someone really want to run it on another computer, they will.

All need to do is reverse engineer your protection to

  1. remove it
  2. play with it
Fredou
  • 19,848
  • 10
  • 58
  • 113
1

Another option might be to have your program ask the USER a question that has a derived answer. Here's a brain dead example....

Your Program: "What time is it now?"

You Enter: (TheYear + 10 - theDay + 11) Mod 13

In this way its actually ONLY YOU that can run the program instead of it being MACHINE dependent.

tobrien
  • 618
  • 5
  • 7
0

Another idea ... I wrote a program that cannot be run directly, it is only ran by an external file, so you could add in a password entry section to it and encrypt password so it cannot be read very easily ,I made an executable version of a vb program to test. it writes in to slack space a character so if the program sees that value it will not run, BUT the runner program has a different character, and it changes it to that character ,and the program is designed to only let in if the character is the proper one ,made only by the runner , then when it enters it changes it back so it is not left open , I have made this sorta thing, and it does work, there is always a way to defeat any protection , the goal is to slow them down or discourage them from running or using your program if you do not want them to.I may include examples at a later date.

steven
  • 11
  • 3