gpt4 book ai didi

python - 在 splinter 中强制使用 SSLv3 或 TLSV1

转载 作者:太空宇宙 更新时间:2023-11-03 15:00:04 26 4
gpt4 key购买 nike

我正在尝试访问 gateway.playneverwinter.com有碎片

from splinter import Browser

browser = Browser()
browser.visit('https://gateway.playneverwinter.com')

if browser.is_text_present('Neverwinter'):
print("Yes, we made it to the entrance of the Prime Material Plane!")
else:
print("Fumble")

browser.quit()

它失败了

 File "gateway_bot.py", line 10, in <module>
browser.visit('https://gateway.playneverwinter.com')
File "/usr/local/lib/python3.4/dist-packages/splinter/driver/webdriver/__init__.py", line 53, in visit
self.connect(url)
File "/usr/local/lib/python3.4/dist-packages/splinter/request_handler/request_handler.py", line 23, in connect
self._create_connection()
File "/usr/local/lib/python3.4/dist-packages/splinter/request_handler/request_handler.py", line 53, in _create_connection
self.conn.endheaders()
File "/usr/lib/python3.4/http/client.py", line 1061, in endheaders
self._send_output(message_body)
File "/usr/lib/python3.4/http/client.py", line 906, in _send_output
self.send(msg)
File "/usr/lib/python3.4/http/client.py", line 841, in send
self.connect()
File "/usr/lib/python3.4/http/client.py", line 1205, in connect
server_hostname=server_hostname)
File "/usr/lib/python3.4/ssl.py", line 364, in wrap_socket
_context=self)
File "/usr/lib/python3.4/ssl.py", line 578, in __init__
self.do_handshake()
File "/usr/lib/python3.4/ssl.py", line 805, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:598)

Firefox 能够毫无问题地连接和浏览该站点,非常困难。经过一些诊断

$ openssl s_client -connect gateway.playneverwinter.com:443               
CONNECTED(00000003)
139745006343840:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:177:

我发现它看起来像a fixed issue in OpenSSL并且强制 SSLv3 或 TLSv1 允许我连接(然后我可以使用 cURL 下载目标)例如任一个

openssl s_client -ssl3 -connect gateway.playneverwinter.com:443
openssl s_client -tls1 -connect gateway.playneverwinter.com:443

根据 OpenSSL ticket 中的评论,我预计问题出在服务器端,但由于我无权访问它,所以它毫无帮助。那么,为了快速修复,有没有办法强制 splinter 使用 SSLv3 或 TLSv1?

最佳答案

在研究之后,我能想到的唯一方法是进入 client.py 文件并更改其 ssl 内容的初始化。

关于python - 在 splinter 中强制使用 SSLv3 或 TLSV1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23544543/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com