What you want to do cannot be done in a failsafe way. As long as your user has control over the environment your program runs under, the program cannot reliably check that it is just being installed into a specific environment and only once. As a simple proof to that statement, consider virtual machines (such as VMWare or QEMU, a user can simulate an identical environment as often as he wants using such virtualisers.

Keeping that in mind, if I were to attempt such a thing I'd have the installer gather some system information that's hard to duplicate (e.g. on Linux output of lspci -vv, ethernet card MAC addresses, output of "hdparm -i " for main harddrive). Have the installer "call home" to a server you control, with a unique registration number that's embedded in the installer and disable that registration number on the server afterwards (so installation can only happen once). Hash the system information together with the registration number and store the hash. Then have the program modify its executable so that it will only run if it can recompute the stored hash at startup. This will break if the user ever changes any hardware, and can be circumvented using a virtual machine as described above, but it may be a reasonable approach for a demo/test of the app.


There are ten types of people: those that understand binary and those that don't.

In reply to Re: system signature? by tirwhan
in thread system signature? by xmerlin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.