为什么我要将python将c 代码转换为python放在

他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)python为什么要发布?我写了个py文件,直接import也能用呀?_百度知道
python为什么要发布?我写了个py文件,直接import也能用呀?
我有更好的答案
不过你也要了解到Python一个非常大的优势就是它的第三方库非常丰富,而这些库是怎么来的?就是我们这些人自己写的,每个人都在贡献自己的力量,同时称赞你的代码怎么会这么妙不可言,让别人也可以用你写的东西,这是一件互帮互助共同进步的事情。说白了,就是大部分情况下是不需要发布的,import足够自己用了,而且使用你的代码的人也会感谢你,所以Python才这么强力如果只是自己用确实不用发布,因为那是多此一举。而要分享自己的代码那就要需要用到发布了。但如果你写了一段非常妙的代码呢,让别人也可以使用,这是不是一件很棒的事情?你也为Python的发展贡献了自己的力量,何乐而不为?只能让自己使用是不是太可惜了?这个时候你就可以分享出去
有一点不太明白呀,直接上传py文件给别人,不是也可以用吗?
是可以用,不过你要更新代码的时候怎么办?再起个名字?别人想联系作者提一些建议怎么办?去哪联系你?这些问题都需要解决。怎么解决好呢?也许对这个库有一个描述文件会很方便管理,发布就是这个描述文件,通过发布别人可以了解到这个库的版本、作者、作者联系方式、库的描述等等基本信息,本地的Python安装第三方库时也是根据发布里的内容来判断是不是进行安装等操作。把第三方库比作一个人,发布就相当于这个人的简历档案什么的,我们要用这个人,可以通过他的简历来了解很多基本信息,这个人有了什么新的经历,也可以通过修改简历来描述,有了简历,我们可以统一管理方式,更加方便。也许你有其他的更好的管理方式,不过既然Python选择了”发布“来充当库的”简历“,我们也只好用这种方式来共享代码了
采纳率:67%
为您推荐:
其他类似问题
勃兰兑斯的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。我如何保护Python代码?
扫码加入我们
我如何保护Python代码?
I am developing a piece of software in Python that will be distributed to my employer's customers. My employer wants to limit the usage of the software with a time restricted license file.
If we distribute the .py files or even .pyc files it will be easy to (decompile and) remove the code that checks the license file.
Another aspect is that my employer does not want the code to be read by our customers, fearing that the code may be stolen or at least the "novel ideas".
Is there a good way to handle this problem? Preferably with an off-the-shelf solution.
The software will run on Linux systems (so I don't think py2exe will do the trick).
py2exe just stores the .pyc byte code files in a .zip archive, so this is definitely not a solution.
Still, that can be useful when combined with a suitable starup script to make it run unter Linux
日10分01秒
like this: stackoverflow.com/questions//&
日10分01秒
Even if the license-checking code were hard to reverse engineer because it's written in C, wouldn't it still be relatively easy to remove the calls to the license-checking code?
日10分01秒
Yes it would, depending on where the license check is performed.
If there are many calls to the extension, it could be difficult to eradicate.
Or you can move some other crucial part of the application into the license check as well so that removing the call to the extension cripples the app.
日10分01秒
Really, all of this work is not about preventing modification, but about increasing its difficulty so that it's no longer worth it. Anything can be reverse-engineered and modified if there's enough benefit.
日10分01秒
Blair Conrad: Not if the license-checking code hides functionality, too.
E.g. mylicensedfunction(licenseblob liblob, int foo, int bar, std::string bash)
日10分01秒
I think the clever way is implementing critical parts in C and implement all license checking stuff in there. (I use hardware dongle which can implement some calculation inside it. So it's almost impossible to reverse it back.)
日10分01秒
Point 2 is even more important. If it's cheaper buy than reverse engineering, plus yearly updates, no one will try and even if it does, no one will pay a hacker instead the provider of the software.
日10分01秒
That's true. Reverse engineering is doable but expensive in most situations. S.Lott, I believe point 6 holds more importance based on the question. If the source code really needs to be protected then it should be remote from the end user.
日10分01秒
Python is not the tool you need. Malbolge is. :)
日10分01秒
How does one &easily discover& if someone misuses my code?
日10分01秒
Good answer, but &casual legal issue&? Really? Where do you live that you have any legal issues that are casual?
日10分01秒
So what programming language?
日10分01秒
I think, if we have a frequency - how often expensive obfuscated code is hacked - we could say about practicability of using Python and obfuscated code.
日10分01秒
There is a tutorial in how to do it here :)
日10分01秒
Macke, consider citing nuitka
日10分01秒
Would compiling with cython work with a python 3.4 Django app, or could it be made to work without a huge amount of effort?
日10分01秒
stackoverflow.com/questions//&
日10分01秒
mlvljr FWIW, IMHO compiling to binaries is a nice tradeoff between selling all your secrets and trying to protect against NSA-class reverse engineering. Esp if you have a big python code base and reasons to be paranoid. ;)
日10分01秒
Other possibilities in the same vein: Shed Skin code.google.com/p/shedskin and Nuitka kayhayen24x7.homelinux.org/blog/nuitka-a-python-compiler
日10分01秒
I just gave a look on Shed Skin as suggested by TyPyPy and it appears to be really good stuff!
日10分01秒
What if they release software to customers, and the customer modifies it internally without re-releasing it?
日10分01秒
Nick: Doesn't change the situation in any way. See my edits.
日10分01秒
+1 for stealing ideas back. Why limit your client-serving power to your in-house solutions, when you could see how others improve on your solution and accordingly improve your own product? &If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.&
日10分01秒
Like this extreme idea. Gets it out there in a huge way and massive market share, then you have a very big customer base for support and addons. I have also been grappling with this question and all the &licensing& answers are basically bull because it doesn't protect against widespread copying, yet doesn't give you any market share advantage.
日10分01秒
The good point on this, is to demoralize anyone who try to decode functionallity. Combine that with Cython and some extra crypt over modules or internet calls, and you probably got prize.
日10分01秒
+1 (back to 0): it seems the only true solution to the problem, assuming such an approach to be practical for the setting.
日10分01秒
Beaware that if your licensing webserver goes down or the customers internet access is down your customer will not be happy that they can't run thier business because of loss of access to licensing checks.
日10分01秒
DevPlayer There are solutions to this. You could implement a local key mechanism that allows temporary access when the software cannot reach the remote licensing server.
日10分01秒
Jeffrey: That gets you right back to where you started - how to you protect that code. To be safer, you need to put some of the key functionality on your own server, so replacing it would involve substantially effort (at which point, why not just start an open-source competitor?)
日10分01秒
The native library approach makes it much easier for someone to programmatically brute force your license key system as they can use your own code and API to validate their licenses.
日10分01秒
So? Use RSA to sign your licence and let them brute force your private key, say consisting of 1024 bits. It is possible, but takes a lot of time... and thus - money.
日10分01秒
+1 F -1 for the obfuscator You can at least prevent the code from being changed.
日10分01秒
Signing does not work in this context. It's always possible to bypass the signature-checking loader. The first thing you need for useful software protection is an opaque bootstrap mechanism. Not something that Python makes easy.
日10分01秒
Yes, bootstrap in non-python.
日10分01秒
Or validate the licence not only on startup but in several other places. Can be easily implemented, and can severely increase the time to bypass.
日10分01秒
but the fact that it was gotten past meant that they failed - the bottom line is just don't try, but go for legal protection.
日10分01秒
Is there any information published on how to get pass this protection mechanisms?
日10分01秒
I think that simply bundles the .pyc files. Cython, Shed Skin, and PyPy go beyond bytecode.
日10分01秒
& 2017 内容协议在 SegmentFault,学习技能、解决问题
每个月,我们帮助 1000 万的开发者解决各种各样的技术问题。并助力他们在技术能力、职业生涯、影响力上获得提升。
问题对人有帮助,内容完整,我也想知道答案
问题没有实际价值,缺少关键内容,没有改进余地
如何把python代码放到某个服务器上运行?阿里云,新浪云?有免费的吗?代码有用到redis数据库
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
亚马逊的aws有一年免费时间。
你拿到服务器后,选择一个linux操作系统,然后把python,redis的环境装上去,最后把你的python代码上传到服务器上,配置好环境,就可以运行了。
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
如果楼主是学生,可以申请阿里云或者腾讯云的学生认证,腾讯云学生认证后每月一块钱,域名一年一元钱,阿里是9.9元一年,如果不是学生,可申请试用亚马逊云服务,一年的免费期。至于说redis,可自行在云服务器上搭建,也可以买,买的成本高一些
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
PaaS平台上传代码使用SVN或者GIT,具体参考产品文档了。
Redis国内应该都是收费的,国内PaaS平台的话推荐BAE和SAE。BAE最低配的很便宜,SAE有云豆送。
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
Heroku 有免费PostgreSQL CI等
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
python的代码放到服务器上运行,其实就是把代码放到已经装好python和所用到的一些其他组件的机器上就可以了。如果要选择公有云的话,亚马逊的AWS其实是比较不错的,但是貌似AWS中国现在只针对企业级用户开放,个人申请会有好多的流程,各种打电话,可以申请美国本土的。个人建议用阿里云或者UCloud,如果自己不愿意手动搭建环境,可以在云市场直接购买包含python、redis、mysql、nginx等等的N合一镜像(说是购买,其实有很多是免费的,但是创建实例是需要交钱的)。之前阿里云有1元试用半年的活动,还有什么账号推荐活动,不知道现在有没有了。如果都花钱的话,头一阵子我用UCloud觉得资费相对会低一点。希望可以帮到你 :)
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
其实可以试着用docker部署一下。国内几个貌似都有免费的资源。
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
楼主可以看看,感觉应该可以帮到你。相对来说操作上面不是很复杂
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
干货还是挺多的
该答案已被忽略,原因:
同步到新浪微博
分享到微博?
关闭理由:
删除理由:
忽略理由:
推广(招聘、广告、SEO 等)方面的内容
与已有问题重复(请编辑该提问指向已有相同问题)
答非所问,不符合答题要求
宜作评论而非答案
带有人身攻击、辱骂、仇恨等违反条款的内容
无法获得确切结果的问题
非开发直接相关的问题
非技术提问的讨论型问题
其他原因(请补充说明)
我要该,理由是:
在 SegmentFault,学习技能、解决问题
每个月,我们帮助 1000 万的开发者解决各种各样的技术问题。并助力他们在技术能力、职业生涯、影响力上获得提升。

我要回帖

更多关于 python代码示例 的文章

 

随机推荐