In Windows the Dropbox client uses python25.dll and the MS C runtime libraries (msvcp71.dll, etc). On OS X the Python code is compiled bytecode (pyc).
在Windows中,Dropbox客户端使用python25.dll和MS C运行时库(msvcp71.dll等)。在OS X上,Python代码是编译的字节码(pyc)。
My guess is they are using a common library they have written then just have to use different hooks for the different platforms.
我猜他们正在使用他们编写的公共库,然后只需要为不同的平台使用不同的钩子。
What method of development is this? It clearly isn't IronPython or PyObjC. This paradigm is so appealing to me, but my CS foo and Google foo are failing me.
这有什么发展方法?它显然不是IronPython或PyObjC。这种模式对我很有吸引力,但我的CS foo和Google foo让我失望。
6 个解决方案
#1
35
Dropbox uses a combination of wxPython and PyObjC on the Mac (less wxPython in the 0.8 series). It looks like they've built a bit of a UI abstraction layer but nothing overwhelming—i.e., they're doing their cross-platform app the right way.
Dropbox在Mac上使用了wxPython和PyObjC的组合(0.8系列中的wxPython较少)。看起来他们已经构建了一些UI抽象层,但没有什么是压倒性的 - 即,他们正在以正确的方式做他们的跨平台应用程序。
They include their own Python mainly because the versions of Python included on the Mac vary by OS version (and Dropbox supports back to 10.4 IIRC); also, they've customized the Python interpreter a bit to improve threading and I/O behavior.
它们包括自己的Python,主要是因为Mac上包含的Python版本因操作系统版本而异(Dropbox支持回到10.4 IIRC);此外,他们还对Python解释器进行了一些定制,以改善线程和I / O行为。
(I do not work for Dropbox or have any inside knowledge; all I did was read their forums and examine the filenames in site-packages.zip
in the Dropbox app bundle.)
(我不为Dropbox工作或有任何内部知识;我所做的只是阅读他们的论坛并检查Dropbox应用程序包中site-packages.zip中的文件名。)
#2
18
For WINDOWS, Dropbox have employed a module similar to py2exe to package all their .py scripts, required libraries, resources etc into the distribution that you have mentioned above (.exe
, library.zip
, MS C runtime library
and python25.dll
) so that they can be run without requiring Python installation. Here's a sample code of how you can achieve this with py2exe.
对于Windows,收存箱已采用类似py2exe到其所有的.py脚本,所需的库,资源等打包成您已上述(.EXE,library.zip,MS C运行时库和python25.dll)中提到的分布的模块,从而它们可以在不需要Python安装的情况下运行。以下是使用py2exe实现此目的的示例代码。
from distutils.core import setup
import py2exe
options = {'py2exe': {
'compressed':1,
'bundle_files': 2,
'dll_excludes': ['w9xpopen.exe']
}}
setup(console=['myapp.py'],options=options)
Please see the tutorial here for more explanation.
有关更多说明,请参阅此处的教程。
PS: the number of files in the distribution can be controlled using the options parameter as shown in the above example.
PS:可以使用options参数控制分发中的文件数,如上例所示。
#3
5
Indeed they do bundle their own Python 2.5.4 interpreter found at /Applications/Dropbox.app/Contents/MacOS/python
. Poking around in /Applications/Dropbox.app/Contents/Resources/lib/python2.5/lib-dynload
it looks to be bundled by PyObjC.
实际上,他们将自己的Python 2.5.4解释器捆绑在/Applications/Dropbox.app/Contents/MacOS/python中。在/Applications/Dropbox.app/Contents/Resources/lib/python2.5/lib-dynload中查找它看起来是由PyObjC捆绑的。
I'm no authority on this, but it seems it is exactly as you suggest in the OP:
我对此没有权威,但它似乎正如你在OP中所建议的那样:
My guess is they are using a common library they have written then just have to use different hooks for the different platforms
我猜他们正在使用他们编写的公共库,然后只需要为不同的平台使用不同的钩子
#4
5
These guys reverse engineered Dropbox client code
这些人反向设计了Dropbox客户端代码
http://www.openwall.com/presentations/WOOT13-Security-Analysis-of-Dropbox/ https://github.com/kholia/dedrop
http://www.openwall.com/presentations/WOOT13-Security-Analysis-of-Dropbox/ https://github.com/kholia/dedrop
#5
4
Python25.dll is probably not their application code, it is a dll containing a copy of the python interpreter which can be called from within a windows application. Those pyc files are probably there in some form on windows, but they might be in an archive or obfuscated.
Python25.dll可能不是他们的应用程序代码,它是一个包含python解释器副本的DLL,可以在Windows应用程序中调用它。那些pyc文件可能在Windows上以某种形式存在,但它们可能存在于存档中或被混淆。
Python is included in OS/X, so it would be possible for them to execute those pyc file without shipping a python, but would not be surprised if they have there own python version lurking in the app bundle.
Python包含在OS / X中,所以它们可以在不发布python的情况下执行那些pyc文件,但如果他们在应用程序包中潜伏着自己的python版本就不会感到惊讶。
I don't know how dropbox builds there distributions, but there are several tools to bundle python apps into executable packages. Take a look at py2exe, py2app, and or cx_freeze.
我不知道dropbox如何在那里构建发行版,但是有几种工具可以将python应用程序捆绑到可执行包中。看一下py2exe,py2app和/或cx_freeze。
#6
1
Recently I published an article on reversing the dropbox client on windows. It is available on slideshare.
最近我发表了一篇关于在Windows上反转Dropbox客户端的文章。它可以在slideshare上使用。
In short,
On Windows dropbox uses py2exe. py2exe embeds the python dll as a resource within the executable. The compiled python source files aka pyc files are stored as a zip archive appended to the end of the executable (which is called an overlay).
简而言之,On Windows dropbox使用py2exe。 py2exe将python dll嵌入到可执行文件中作为资源。已编译的python源文件(即pyc文件)存储为附加到可执行文件末尾的zip存档(称为覆盖)。
Extracting the zip archive will give you the pyc files, but that is not the end of the story. The pyc files are encrypted and not decompilable. They are decrypted only when they are loaded by the embedded python interpreter.
提取zip存档将为您提供pyc文件,但这不是故事的结尾。 pyc文件是加密的,不可编译。它们仅在嵌入式python解释器加载时才被解密。
However there is a way to not bother too much about the encryption algorithm used. We can directly grab decrypted code objects from memory letting dropbox do the decryption for us.
但是,有一种方法不会过多地使用加密算法。我们可以直接从内存中获取解密的代码对象,让dropbox为我们解密。
#1
35
Dropbox uses a combination of wxPython and PyObjC on the Mac (less wxPython in the 0.8 series). It looks like they've built a bit of a UI abstraction layer but nothing overwhelming—i.e., they're doing their cross-platform app the right way.
Dropbox在Mac上使用了wxPython和PyObjC的组合(0.8系列中的wxPython较少)。看起来他们已经构建了一些UI抽象层,但没有什么是压倒性的 - 即,他们正在以正确的方式做他们的跨平台应用程序。
They include their own Python mainly because the versions of Python included on the Mac vary by OS version (and Dropbox supports back to 10.4 IIRC); also, they've customized the Python interpreter a bit to improve threading and I/O behavior.
它们包括自己的Python,主要是因为Mac上包含的Python版本因操作系统版本而异(Dropbox支持回到10.4 IIRC);此外,他们还对Python解释器进行了一些定制,以改善线程和I / O行为。
(I do not work for Dropbox or have any inside knowledge; all I did was read their forums and examine the filenames in site-packages.zip
in the Dropbox app bundle.)
(我不为Dropbox工作或有任何内部知识;我所做的只是阅读他们的论坛并检查Dropbox应用程序包中site-packages.zip中的文件名。)
#2
18
For WINDOWS, Dropbox have employed a module similar to py2exe to package all their .py scripts, required libraries, resources etc into the distribution that you have mentioned above (.exe
, library.zip
, MS C runtime library
and python25.dll
) so that they can be run without requiring Python installation. Here's a sample code of how you can achieve this with py2exe.
对于Windows,收存箱已采用类似py2exe到其所有的.py脚本,所需的库,资源等打包成您已上述(.EXE,library.zip,MS C运行时库和python25.dll)中提到的分布的模块,从而它们可以在不需要Python安装的情况下运行。以下是使用py2exe实现此目的的示例代码。
from distutils.core import setup
import py2exe
options = {'py2exe': {
'compressed':1,
'bundle_files': 2,
'dll_excludes': ['w9xpopen.exe']
}}
setup(console=['myapp.py'],options=options)
Please see the tutorial here for more explanation.
有关更多说明,请参阅此处的教程。
PS: the number of files in the distribution can be controlled using the options parameter as shown in the above example.
PS:可以使用options参数控制分发中的文件数,如上例所示。
#3
5
Indeed they do bundle their own Python 2.5.4 interpreter found at /Applications/Dropbox.app/Contents/MacOS/python
. Poking around in /Applications/Dropbox.app/Contents/Resources/lib/python2.5/lib-dynload
it looks to be bundled by PyObjC.
实际上,他们将自己的Python 2.5.4解释器捆绑在/Applications/Dropbox.app/Contents/MacOS/python中。在/Applications/Dropbox.app/Contents/Resources/lib/python2.5/lib-dynload中查找它看起来是由PyObjC捆绑的。
I'm no authority on this, but it seems it is exactly as you suggest in the OP:
我对此没有权威,但它似乎正如你在OP中所建议的那样:
My guess is they are using a common library they have written then just have to use different hooks for the different platforms
我猜他们正在使用他们编写的公共库,然后只需要为不同的平台使用不同的钩子
#4
5
These guys reverse engineered Dropbox client code
这些人反向设计了Dropbox客户端代码
http://www.openwall.com/presentations/WOOT13-Security-Analysis-of-Dropbox/ https://github.com/kholia/dedrop
http://www.openwall.com/presentations/WOOT13-Security-Analysis-of-Dropbox/ https://github.com/kholia/dedrop
#5
4
Python25.dll is probably not their application code, it is a dll containing a copy of the python interpreter which can be called from within a windows application. Those pyc files are probably there in some form on windows, but they might be in an archive or obfuscated.
Python25.dll可能不是他们的应用程序代码,它是一个包含python解释器副本的DLL,可以在Windows应用程序中调用它。那些pyc文件可能在Windows上以某种形式存在,但它们可能存在于存档中或被混淆。
Python is included in OS/X, so it would be possible for them to execute those pyc file without shipping a python, but would not be surprised if they have there own python version lurking in the app bundle.
Python包含在OS / X中,所以它们可以在不发布python的情况下执行那些pyc文件,但如果他们在应用程序包中潜伏着自己的python版本就不会感到惊讶。
I don't know how dropbox builds there distributions, but there are several tools to bundle python apps into executable packages. Take a look at py2exe, py2app, and or cx_freeze.
我不知道dropbox如何在那里构建发行版,但是有几种工具可以将python应用程序捆绑到可执行包中。看一下py2exe,py2app和/或cx_freeze。
#6
1
Recently I published an article on reversing the dropbox client on windows. It is available on slideshare.
最近我发表了一篇关于在Windows上反转Dropbox客户端的文章。它可以在slideshare上使用。
In short,
On Windows dropbox uses py2exe. py2exe embeds the python dll as a resource within the executable. The compiled python source files aka pyc files are stored as a zip archive appended to the end of the executable (which is called an overlay).
简而言之,On Windows dropbox使用py2exe。 py2exe将python dll嵌入到可执行文件中作为资源。已编译的python源文件(即pyc文件)存储为附加到可执行文件末尾的zip存档(称为覆盖)。
Extracting the zip archive will give you the pyc files, but that is not the end of the story. The pyc files are encrypted and not decompilable. They are decrypted only when they are loaded by the embedded python interpreter.
提取zip存档将为您提供pyc文件,但这不是故事的结尾。 pyc文件是加密的,不可编译。它们仅在嵌入式python解释器加载时才被解密。
However there is a way to not bother too much about the encryption algorithm used. We can directly grab decrypted code objects from memory letting dropbox do the decryption for us.
但是,有一种方法不会过多地使用加密算法。我们可以直接从内存中获取解密的代码对象,让dropbox为我们解密。