Serial check - how ?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/10/2012 at 07:35, xxxxxxxx wrote:
Hello Forum,
we would like to protect our Python script.
How do we get the serial number out of C4D, so that we can limit the Script to our customers?Some code snippets would be appreciated...
Kind regards,
Ronald -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/10/2012 at 08:35, xxxxxxxx wrote:
Scripts (expressions and Commands) cannot be protected. You need to make plugins of them to -somewhat- protect
them using the Scripts ->"Source Protector..." command in Cinema. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/10/2012 at 10:26, xxxxxxxx wrote:
Das muss gehe!
import c4d
from c4d import gui
#Welcome to the world of Pythondef main() :
gui.MessageDialog('Hello World!')si = c4d.GeGetSerialInfo(c4d.SERIALINFO_MULTILICENSE)
if len(si['nr']) > 0:
# Multi-license, do something
print "Multi-license"
print si
else:
si = c4d.GeGetSerialInfo(c4d.SERIALINFO_CINEMA4D)
print "Single-license"
print si
# Single-license, do somethingif __name__=='__main__':
main()Thit code works fine!
But:
I need te eleven digits from the right
like in EXCEL "right(si,11)".
This could be compaired with something.
If the result is "true" the Phyton-Script would be executet.With the Souce-protector the Script should be protected.
Kind regards
Ronald -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/10/2012 at 10:46, xxxxxxxx wrote:
Hi, as tcastudios said only Python Plugins can be protected. Scripts can not be encrypted.
Cheers, Sebastian
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/10/2012 at 10:51, xxxxxxxx wrote:
Ok,
Thanks a lot.
This ist the reason why it dosen't work!So I have to translate my Script to a Plugin.
I think questions will follow
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/10/2012 at 06:09, xxxxxxxx wrote:
Everything in my plugin works greate
Only on last Problem:The serialchek never turns to the ok???
I've filtert the serialnumber,only the 11 numbers to a varriable.
Then i Compare it with a number.
But it never runs through the "true" - part
Could it be that I compare a sting with a number?
How can I solve the problem?Thanks to all here
------------------------------------------------
import c4d
import math
import osfrom c4d import documents, plugins, bitmaps
PLUGIN_ID = 1000000
SERIENNUMMER = 'hier muss zum Testen die eigene Seriennummer eingegebenwerden'def check_serialinfo() :
si = c4d.GeGetSerialInfo(c4d.SERIALINFO_CINEMA4D)
print "Single-license"
sn = si['nr']
print sn
print SERIENNUMMER
if (sn == SERIENNUMMER) :# !!! here is the problem!!!
print 'ok'
else:
print 'not ok'
# Single-license, do something
print 'Seriennummerncheck beendet'class MYPLUGIN(plugins.CommandData) :
pass
def Execute(self, doc) :
check_serialinfo()
return True#----------------------------------------------------------------------------
if __name__ == "__main__":
# load icon.tif from res into bmp
bmp = bitmaps.BaseBitmap()
dir, file = os.path.split(__file__)
fn = os.path.join(dir, "res", "icon.tif")
bmp.InitWith(fn)
# register the plugin
okyn = plugins.RegisterCommandPlugin(id=PLUGIN_ID, str="V4D-Seriennummerncheck", info=c4d.PLUGINFLAG_COMMAND_HOTKEY, icon=bmp, help="", dat=MYPLUGIN())
print " "
print "----------------------------------"
print "Seriennummernchek ", okyn
print "----------------------------------" -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/10/2012 at 06:19, xxxxxxxx wrote:
Well, according to how I read your code, you're comparing the variable 'sn' which is a string to the string constant 'SERIENNUMMER' which is a different string. So it will always fail.
What you should be doing is taking the plugin serial number your user entered and somehow getting the C4D serial out of that so you can compare it to 'sn'. How you do that depends on how you generated the serial number in the first place, and only you know that. But you would normally generate a plugin serial from the 11 digits of the user's C4D serial which they send you when they buy a licence.
Of course, f you are going to give this plugin away then you don't need to do any serial checking at all.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/10/2012 at 06:27, xxxxxxxx wrote:
Hi Spedler,
you are wright.
I want to type my serial number in the variable at the beginning.
Then ich want to compare it with the serialnumber of my license.
The print sn and print SERIENNUMMER shows the same values in the console.
But: the compare (sn == SERIENNUMMER) retuns a false!!!
Do you know why?Thanks a lot
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/10/2012 at 06:37, xxxxxxxx wrote:
Beats me then, sorry. I don't use Python but I would have thought that your code should work.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/10/2012 at 06:41, xxxxxxxx wrote:
Hi spedler,
thats the problem
Beleave me! It dosn't work
But why??? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/10/2012 at 07:11, xxxxxxxx wrote:
Ok, i found something:
one is string and one is long!
So: how can I check the type of a varriable and how can I convert it.Thanks a lot
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/10/2012 at 09:34, xxxxxxxx wrote:
The serial number returned by GeGetSerialInfo returns a string, so you either have to declare the SERIENNUMMER variable as a string (by putting the digits in quotes) or you can typecast sn to an integer with int(sn).
I recommend the latter.SERIENNUMMER = 14300012345 def check_serialinfo() : si = c4d.GeGetSerialInfo(c4d.SERIALINFO_CINEMA4D) print "Single-license" sn = si['nr'] print sn print SERIENNUMMER if (int(sn) == SERIENNUMMER) :# !!! here was the problem!!! print 'ok' else: print 'not ok' # Single-license, do something print 'Seriennummerncheck beendet'
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/10/2012 at 00:12, xxxxxxxx wrote:
Thanks to Sparkle,
it works now greate.
slowly but shurly I will learn how to use Phyton in C4D.
Thanks a lot again