相关疑难解决方法(0)

我如何保护Python代码?

我正在开发一个Python软件,将分发给我的雇主的客户.我的雇主希望使用时间限制的许可证文件来限制软件的使用.

如果我们分发.py文件甚至.pyc文件,那么很容易(反编译)删除检查许可文件的代码.

另一个方面是我的雇主不希望我们的客户阅读代码,担心代码可能被盗或至少是"新颖的想法".

有没有一个很好的方法来处理这个问题?优选使用现成的解决方案.

该软件将在Linux系统上运行(所以我认为py2exe不会这样做).

python obfuscation licensing copy-protection

607
推荐指数
22
解决办法
27万
查看次数

python中的受保护方法

可能重复:
在python子类中将方法设为
私有Python中的私有变量和方法

如何在受保护的python类中定义一个方法,只有子类可以看到它?

这是我的代码:

class BaseType(Model):
    def __init__(self):
        Model.__init__(self, self.__defaults())


    def __defaults(self):
        return {'name': {},
                'readonly': {},
                'constraints': {'value': UniqueMap()},
                'cType': {}
        }


    cType = property(lambda self: self.getAttribute("cType"), lambda self, data:              self.setAttribute('cType', data))
    name = property(lambda self: self.getAttribute("name"), lambda self, data: self.setAttribute('name', data))
    readonly = property(lambda self: self.getAttribute("readonly"),
                        lambda self, data: self.setAttribute('readonly', data))

    constraints = property(lambda self: self.getAttribute("constraints"))

    def getJsCode(self):
        pass

    def getCsCode(self):
        pass


    def generateCsCode(self, template=None, constraintMap=None, **kwargs):
        if not template:
            template = self.csTemplate

        if not constraintMap: constraintMap …
Run Code Online (Sandbox Code Playgroud)

python oop access-modifiers

27
推荐指数
2
解决办法
3万
查看次数