Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Retrieving hardware information through Perl

by ctgIT (Initiate)
on Jan 04, 2002 at 02:51 UTC ( [id://136132]=perlquestion: print w/replies, xml ) Need Help??

ctgIT has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am interested in creating a hardware-based key to protect my application from unauthorized copying. I look for a way to read the CPU ID or other hardware information through Perl. Is there a way to do it? Thanks, Chris
  • Comment on Retrieving hardware information through Perl

Replies are listed 'Best First'.
Re: Retrieving hardware information through Perl
by chip (Curate) on Jan 04, 2002 at 05:28 UTC
    Many intelligent and dedicated people have tried to accomplish copy protection. In the end, it was almost all wasted effort.

    My informed advice: Don't bother trying.

        -- Chip Salzenberg, Free-Floating Agent of Chaos

Re: Retrieving hardware information through Perl
by Juerd (Abbot) on Jan 04, 2002 at 03:05 UTC
    Perl is an _interpreted_ language. Anyone who can read/write the script can hack it to avoid your checking mechanisms. There's no use in copy protecting your scripts.
    (No, perlcc is not the answer)

    2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

      In fact, I do not try to protect a Perl script but a Java application. Since Java does not really have any mechanism to access the hardware and create a key I was hoping to do it through Perl and pass the CPU ID or something like that back to Java. Any ideas? Thanks, Chris
        Perl hasn't got any native solutions to get hardware information.
        Under Linux, you can use the /proc filesystem, under Win32 I'm sure there's a win32api solution, etcetera.

        By the way, all that needs to be done to work around your so called protection would be changing the perl script, so embed it and encode it. Even then, it'll not be hard to work around it.

        2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

        Anyone who can read/write the script can hack it to avoid your checking mechanisms. There's no use in copy protecting your scripts.

        Same goes for Java, as even .class files can be decompiled.

        see this page or this one for examples.

        "Only Bad Coders Code Badly In Perl" (OBC2BIP)
Re: Retrieving hardware information through Perl
by dhable (Monk) on Jan 04, 2002 at 21:20 UTC
    The other posting do have valid points. 1) It will be easy to defeat protection in interperted languages. 2) Unless you spend a lot of time on the problem, it's not worth it.

    If you really do need serious copy protection for your killer app, you should just purchase a pre-built solution from a vendor. You can find hardware key solutions from Aladdin and Rainbow Technology.

    One final thought. All of these copy protection methods only attempt to make the cost of stealing the software much higher. There is no way to achieve perfect protection on the PC.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://136132]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 17:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found