Scapy HTTPS \ TLS数据包

时间:2019-03-15 09:13:43

标签: python python-2.7 https scapy packet-sniffers

我正在尝试使用Scapy嗅探我的HTTPS网络数据包。我已经安装了scapy_ssl_tls

Requirement already satisfied: scapy-ssl_tls in path\python36\lib\site-packages (2.0.0)
Requirement already satisfied: pycryptodomex>=3.4 in path\python36\lib\site-packages (from scapy-ssl_tls) (3.7.3)
Requirement already satisfied: scapy==2.4.* in path\python36\lib\site-packages (from scapy-ssl_tls) (2.4.2)
Requirement already satisfied: tinyec>=0.3.1 in path\python36\lib\site-packages (from scapy-ssl_tls) (0.3.1)

但是当我尝试以下代码段时:

from scapy_ssl_tls.ssl_tls import TLS

我有这个例外:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "path\Python36\lib\site-packages\scapy_ssl_tls\ssl_tls.py", line 8, in <module>
    from scapy.layers import x509
  File "path\Python36\lib\site-packages\scapy\layers\x509.py", line 31, in <module>
    class ASN1P_OID(ASN1_Packet):
  File "path\Python36\lib\site-packages\scapy\layers\x509.py", line 33, in ASN1P_OID
    ASN1_root = ASN1F_OID("oid", "0")
  File "path\Python36\lib\site-packages\scapy\asn1fields.py", line 55, in __init__
    self.default = self.ASN1_tag.asn1_object(default)
  File "path\Python36\lib\site-packages\scapy\asn1\asn1.py", line 120, in asn1_object
    return self._asn1_obj(val)
  File "path\Python36\lib\site-packages\scapy\asn1\asn1.py", line 403, in __init__
    val = conf.mib._oid(plain_str(val))
AttributeError: 'Conf' object has no attribute 'mib'

我已经尝试使用Python 2.7,当我运行相同的命令时,输出为:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "path\Python27\lib\site-packages\scapy_ssl_tls\ssl_tls.py", line 7, in <module>
    from scapy.layers.inet import TCP, UDP
  File "path\Python27\lib\site-packages\scapy\layers\inet.py", line 14, in <module>
    from scapy.layers.l2 import *
  File "path\Python27\lib\site-packages\scapy\layers\l2.py", line 14, in <module>
    from scapy.ansmachine import *
  File "path\Python27\lib\site-packages\scapy\ansmachine.py", line 14, in <module>
    from sendrecv import send,sendp,sniff
  File "path\Python27\lib\site-packages\scapy\sendrecv.py", line 13, in <module>
    import arch
  File "path\Python27\lib\site-packages\scapy\arch\__init__.py", line 80, in <module>
    from windows import *
  File "path\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 17, in <module>
    from scapy.sendrecv import debug, srp1
ImportError: cannot import name debug

有人可以帮我吗,或者他们可以建议另一种使用scapy嗅探网络中的https数据包的方法?

1 个答案:

答案 0 :(得分:1)

  • 您可以通过load_layer("tls")尝试使用内置的Scapy TLA模块而不是Scapy-ssltls
  • 确保您正在运行最新的Scapy版本
  • 安装wireshark(Scapy从中获取其制造数据)