xcode 是否可以查看mac应用程序的来源?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10268907/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to view the source of a mac app?
提问by Jamesp1989
Would be usefull to see how things work but not sure on the legality of it
了解事情如何运作会很有用,但不确定它的合法性
回答by Williham Totland
Most Mac apps are written using Cocoa in Objective-C; which, while it is a compiled language, means that there is a fair bit of information left over that could be used by a decompiler.
大多数 Mac 应用程序是使用 Objective-C 中的 Cocoa 编写的;虽然它是一种编译语言,但这意味着有相当多的信息可以被反编译器使用。
I'm not sure if there are a lot of decompilers out there that leverages this information, at least I haven't heard of any.
我不确定是否有很多反编译器可以利用这些信息,至少我没有听说过。
However, there are also another option; F-Script.
然而,还有另一种选择;F脚本。
F-Script can be used to attach to an executable and explore its interfaces, while not as good as source, it can give you a pretty clear idea of how the executable is built, and how it operates.
F-Script 可用于附加到可执行文件并探索其接口,虽然不如源代码好,但它可以让您非常清楚地了解可执行文件是如何构建的,以及它是如何运行的。
As for the legality issue:
至于合法性问题:
IANAL, but as far as I know, reverse-engineering for the purposes of compatibility is legal in many jurisdictions, and I can't imagine that decompiling an executable to look at its code is illegal, unless the specific EULA specifically prohibits it.
IANAL,但据我所知,出于兼容性目的的逆向工程在许多司法管辖区都是合法的,我无法想象反编译可执行文件以查看其代码是非法的,除非特定的 EULA 明确禁止这样做。
Edit:WRT Steam specifically, it is probably NOT written in Cocoa, but C# with some manner of .NET compatibility layer; and it's probably not a good place to start if you want to learn how to make applications for Mac OS X.
编辑:特别是 WRT Steam,它可能不是用 Cocoa 编写的,而是带有某种 .NET 兼容层的 C#;如果您想学习如何为 Mac OS X 制作应用程序,这可能不是一个好的起点。
回答by Arius Kahn
By far, the best Mac OS X disassembler I've used is Hopper available here: http://www.hopperapp.com/
到目前为止,我用过的最好的 Mac OS X 反汇编程序是 Hopper,这里提供:http: //www.hopperapp.com/
It will also convert the assembly to C pseudo code as best it can. It will generate code flow diagrams with blue lines (true blue, love it) for true and red for false paths.
它还将尽可能将程序集转换为 C 伪代码。它将生成代码流程图,蓝线(真蓝色,喜欢它)代表真路径,红色代表错误路径。
It's The Mac OS reverse engineering tool. There are even Youtubevideos that will show you how to use it.
它是 Mac OS 逆向工程工具。甚至有Youtube视频会向您展示如何使用它。
回答by Arius Kahn
If it's an open-source app, yes. Otherwise it's possible through decompilationbut the output will be a real pain in the ass to look at. If you just want the protocols and the interfaces of categories and classes, have a look at class-dump.
如果它是一个开源应用程序,是的。否则可以通过反编译,但输出将是一个真正的痛苦。如果您只需要类别和类的协议和接口,请查看class-dump。
I'm not aware of a nib decompiler.
我不知道笔尖反编译器。
Whether decompilation is legal: ask a lawyer. This may (and probably does) differ per jurisdiction.
反编译是否合法:咨询律师。这可能(并且可能确实)因司法管辖区而异。
回答by Caleb
Is it possible to view the source of a mac app?
是否可以查看mac应用程序的来源?
Realistically, no. Sure, you might be a able to use a decompiler to get a peek, but the kind of output you'll get won't be easy to read. If you're asking this question, this route probably isn't going to be helpful to you.
实际上,没有。当然,您可能能够使用反编译器进行查看,但是您将获得的输出类型并不容易阅读。如果你问这个问题,这条路线可能对你没有帮助。
Specifically interested in GUI and how the steam app for mac works
对 GUI 以及适用于 mac 的 Steam 应用程序的工作方式特别感兴趣
It's a good bet that it works about the same way that most other applications work. It might use custom controls to lookdifferent from a typical application that mostly uses the standard Cocoa controls. But underneath, just about any GUI application written for MacOS X will use the run loops, responder chain, and view hierarchy that Cocoa provide. The main exceptions would be applications that are built mostly using an alternate framework like OpenGL or WebKit.
可以肯定的是,它的工作方式与大多数其他应用程序的工作方式大致相同。它可能使用自定义控件看起来与主要使用标准 Cocoa 控件的典型应用程序不同。但在底层,几乎任何为 MacOS X 编写的 GUI 应用程序都将使用 Cocoa 提供的运行循环、响应者链和视图层次结构。主要的例外是主要使用 OpenGL 或 WebKit 等替代框架构建的应用程序。
Figure out what, specifically, the Steam application does that you'd like to do. Take a look at the tools that Cocoa provides to see if you can figure it out yourself; if not, ask about it here.
弄清楚您希望 Steam 应用程序做什么。看看 Cocoa 提供的工具,看看你是否能自己弄明白;如果没有,请在此处询问。