Jump to content

How to implement a multi-user license system?


4Eyes
 Share

Recommended Posts

Folks,

I'd like to implement a licensing system whereby only up to X number of pc's could run a program. It doesn't really matter if it's any particular pc just only a total of X.

Obviously, they're connected to a LAN. They will use a common ini file stored on a network share for settings. At this stage I do NOT want to use a server program to track the licenses. I'm not asking for code and I have none to offer at this point. I'm just looking for ideas.

The only scheme that I can come up is that as a client pc starts the program, it decrements a license count value in the common ini file. There are many flaws to this idea though.

Is there anything else?

4Eyes

Link to comment
Share on other sites

I'm not very good with AuI (yet) but this was my initial thought:

Read the .ini file.
If not exist IniSection [License_1] Then
     IniWrite [License_1]
ElseIf not exist IniSection [Lieense_2] Then
     IniWrite [License_2]
etc.
etc.
etc.
ElseIf Exist IniSection [License_X] (X being your max number) Then
     Exit
EndIf

Sorry for my shitty code, lol. Like I said, I'm new to AuI and I'm not very good at it. But that is how I would do it. If you are worried about people overwritting it, you could encrypt it or something along those lines to prevent unauthorized users from editting it.

That was my thought, not sure if you like it (or even understand it, LOL)

Hope you figure it out!

00101101011110000101000001101100011011110110100101110100

Link to comment
Share on other sites

xPloit,

Thanks for your reply but it is pretty much what I already offered in my post.

As far as protecting the file with encryption, well if they delete it then the encryption won't matter. As I said... may flaws with that idea.

4Eyes

Link to comment
Share on other sites

For file based licensing, my $0.02:

<Program Start>

+Check for lock file

*Create if not found

*Wait for removal if found

+Check for license file

*Create if not found

+Count licenses in file

*Fail if max reached

+Add a MD5 or SHA1 hash of the computer's MAC address as the license key

+Remove lock file

<Wait n Seconds/Minutes>

+Rehash computer's MAC address

+Search license file for hash

*Add license if not found

-Lock program if $MaxLicenses reached

*Unlock program when a license is cleared (?)

The license.ini file can't be deleted or modified to bypass the license limit because of the periodic check. The MAC address of the computer can't be duplicated because of the nature of networking. Unfortunately, as AutoIT is single-threaded, you're going to have to "cut away" to do the check.

Link to comment
Share on other sites

I would suggest to create a citrix presentation server and upload it there.

That seems to be the best way for me and you can control everything.

The downside is that it can be an overkill if your app is something small

and the citrix costs.

Link to comment
Share on other sites

Thanks guys.

xPloit - protect what? The license file that is already encrypted? That won't help even if I understood what you mean.

Juvigy - hmmm... that's way too much of an overkill

sentry07 - that's a better idea. I really like the idea of the lock file to indicate another client pc is accessing the master file. That didn't occur to me, but is so essential. If the license files were deleted to try to get more client pc's running than the licensee was entitled to, then the client pc's could report their license file missing or stop. It's no prob to intermittently check for the license file. This idea does suffer from an issue I foresaw some time ago though. If the licenses aren't 'returned' (in this case, deleted by the client pc's themselves) say at power off, then the number of licenses used by them won't be available for other pc's to use. I could ping the others to see if their alive but that will make an unacceptable startup delay. I'll keep working on this idea though. I'm now starting to think that the Network Admin could have a 'console' version of the program that could oversee it's operation. If that happened then it could ping the pc's to ensure that the allocated licenses were in fact being used by pc's that were still active. It would be nice to have just 1 program to maintain, but if it comes to it...

As far as getting the MAC address is concerned it's not as easy as it seems. I went thru this exercise some time ago and it was rather painful. Consider if the user has 2 nic's and maybe a mobile phone attached. I had to use WMI and it is slow, but as it only needs to be done once. It would be easier to use the PC's name as it has to be unique on the network and is easier to determine.

Way back in the old days Netware 2.10 had a 'keycard' (serial number in a rom on a ISA bus card) that needed to be in the server and a copy protected diskette that was used during install. 2.11 did away with the diskette. I think 2.12 did away with the keycard, but if servers detected the same license code on multiple servers on the one network all client pc's got a broadcast message. Now that was protection! I'm not that paranoid.

Regards,

4Eyes

Link to comment
Share on other sites

I dont password protect any of my files, but I thought there was some way to require a password before the file was moved/edited/deleted/etc. That way, they would have to know your password in order to edit it AND decrypt it in order to do anything

00101101011110000101000001101100011011110110100101110100

Link to comment
Share on other sites

Honest people will abide by your licencing agreement, and others will not.

Spend more time developing your software and making people want to licence/upgrade again instead of wasting your time and resources on something that has been proven time and again to not work.

Stick to a simple inifile or registry entry.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Thanks guys.

xPloit - protect what? The license file that is already encrypted? That won't help even if I understood what you mean.

Juvigy - hmmm... that's way too much of an overkill

sentry07 - that's a better idea. I really like the idea of the lock file to indicate another client pc is accessing the master file. That didn't occur to me, but is so essential. If the license files were deleted to try to get more client pc's running than the licensee was entitled to, then the client pc's could report their license file missing or stop. It's no prob to intermittently check for the license file. This idea does suffer from an issue I foresaw some time ago though. If the licenses aren't 'returned' (in this case, deleted by the client pc's themselves) say at power off, then the number of licenses used by them won't be available for other pc's to use. I could ping the others to see if their alive but that will make an unacceptable startup delay. I'll keep working on this idea though. I'm now starting to think that the Network Admin could have a 'console' version of the program that could oversee it's operation. If that happened then it could ping the pc's to ensure that the allocated licenses were in fact being used by pc's that were still active. It would be nice to have just 1 program to maintain, but if it comes to it...

As far as getting the MAC address is concerned it's not as easy as it seems. I went thru this exercise some time ago and it was rather painful. Consider if the user has 2 nic's and maybe a mobile phone attached. I had to use WMI and it is slow, but as it only needs to be done once. It would be easier to use the PC's name as it has to be unique on the network and is easier to determine.

Way back in the old days Netware 2.10 had a 'keycard' (serial number in a rom on a ISA bus card) that needed to be in the server and a copy protected diskette that was used during install. 2.11 did away with the diskette. I think 2.12 did away with the keycard, but if servers detected the same license code on multiple servers on the one network all client pc's got a broadcast message. Now that was protection! I'm not that paranoid.

Regards,

4Eyes

Just FYI, at a command prompt type "getmac /nh". You could parse that for the first entry that doesn't say Media Disconnected and that should be your NIC. It doesn't really matter which MAC you use as long as you store that to check later. As far as removing licenses, in your routine that checks to see if the license is still in the ini file, add a "last seen" timestamp for the license in the file and if the timediff(last_seen,now) > threshold, delete the license. That way every computer that is checking in the file is also cleaning up after the other computers and you don't need a gatekeeper program.

Link to comment
Share on other sites

sentry07,

I didn't know about getmac. Thanks for that. There's quite a number of useful but seldom used little utilities stashed away in the windows dir.

Again, I like your license cleanup idea too. It would be best to have the client program look after everything that's for sure.

Thanks for your great input.

Regards,

4Eyes

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...