【发布时间】:2013-10-21 03:49:07
【问题描述】:
在这里原谅我的无知。 Python我读的不好,根本不会写。
我正在尝试审核 CVE-2013-1445 的 python 项目。我相信找到了一个可能需要注意的源文件(以及其他改进机会)。文件是util.py,它有一行:
import base64
from Crypto.Hash import HMAC
from Crypto import Random
...
当我查看Python crypto docs 时,我没有看到提到Random 类。只有hashlib 和hmac:
The modules described in this chapter implement various algorithms of a
cryptographic nature. They are available at the discretion of the
installation. On Unix systems, the crypt module may also be available.
Here’s an overview:
15.1. hashlib — Secure hashes and message digests
15.2. hmac — Keyed-Hashing for Message Authentication
...
Random 究竟来自哪里?是原生的还是第三方的?
或者我的问题应该是,Crypto 来自哪里?如果Crypto 它的第三方,我如何确定第三方库和类的包含方式/位置(相对于本机库和类)?
为了完整起见,我试图理解 Python 的作用域和命名空间,但目前对我来说毫无意义(正如这个问题可能表明的那样)。例如,Crypto 或 Random 没有明显的 Scope 或 Namespace(Random 是 Crypto 的一部分除外)。
提前致谢。
【问题讨论】:
-
Crypto 不是标准库模块。