boy-hack / hack-requests

The hack-requests is an http network library for hackers
MIT License
466 stars 90 forks source link

Centos7.6下使用HackRequests请求HTTPS网站链接被重置 #7

Closed ihoneysec closed 5 years ago

ihoneysec commented 5 years ago

这个问题我在Windows下测试是没有的,但在新安装的Centos7.6系统上使用HackRequests请求HTTPS网站就会抛异常提示链接被重置,Openssl相关的包已经安装过了,不知道是不是只有我一个遇到这个问题,麻烦w8ay表哥看一下。 论坛发你短消息一个星期了没回复,所以发到这里了。 CentOs7.6 Python3.7.3

Centos7.6系统在 hh = hack.http(url) 这一步发生了链接被重置的异常,这个测试的HTTPS站点我的服务器使用curl -i -k和requests库都是可以正常访问的。

报错如下: `]# python3.7 Python 3.7.3 (default, May 6 2019, 03:47:41) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux Type "help", "copyright", "credits" or "license" for more information.

import HackRequests hack = HackRequests.hackRequests() url = 'https://www.51oz.com' hh = hack.http(url) Traceback (most recent call last): File "", line 1, in File "/usr/local/python3/lib/python3.7/site-packages/HackRequests/HackRequests.py", line 309, in http conn.request(method, path, post, tmp_headers) File "/usr/local/python3/lib/python3.7/http/client.py", line 1229, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/python3/lib/python3.7/http/client.py", line 1275, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/python3/lib/python3.7/http/client.py", line 1224, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/python3/lib/python3.7/site-packages/HackRequests/HackRequests.py", line 142, in _send_output_hook oldfun(*args, **kwargs) File "/usr/local/python3/lib/python3.7/http/client.py", line 1016, in _send_output self.send(msg) File "/usr/local/python3/lib/python3.7/http/client.py", line 956, in send self.connect() File "/usr/local/python3/lib/python3.7/http/client.py", line 1392, in connect server_hostname=server_hostname) File "/usr/local/python3/lib/python3.7/ssl.py", line 412, in wrap_socket session=session File "/usr/local/python3/lib/python3.7/ssl.py", line 853, in _create self.do_handshake() File "/usr/local/python3/lib/python3.7/ssl.py", line 1117, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [Errno 104] Connection reset by peer `

Windows下测试HTTP和HTTPS站点都是正常的: `

url = 'http://www.yafen0769.com/' hh = hack.http(url) hh.log.get('response') 'HTTP/1.1 200 OK\r\nServer: nginx\nDate: Sun, 05 May 2019 20:10:45 GMT\nContent-Type: text/html\nLast-Modified: Wed, 03 Apr 2019 02:57:40 GMT\nTransfer-Encoding: chunked\nConnection: close\nSet-Cookie: yunsuo_session_verify=e6c827177ed4cd47b111f376dcc68589; expires=Thu, 09-May-19 04:10:45 GMT; path=/; HttpOnly\nContent-Encoding: gzip\n\n'

`

ihoneysec commented 5 years ago

我又换了一台Windows7,Python3.5.3,浏览器是可以正常访问这个HTTPS站的,但是使用hh = hack.http(url) 还是会报错:

报错信息: `C:\Users\Administrator>python3.5 Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AM D64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

hack = HackRequests.hackRequests() Traceback (most recent call last): File "", line 1, in NameError: name 'HackRequests' is not defined import HackRequests hack = HackRequests.hackRequests() url = 'https://www.51oz.com' hh = hack.http(url) Traceback (most recent call last): File "", line 1, in File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\ HackRequests\HackRequests.py", line 308, in http conn.request(method, path, post, tmp_headers) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\client.py ", line 1107, in request self._send_request(method, url, body, headers) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\client.py ", line 1152, in _send_request self.endheaders(body) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\client.py ", line 1103, in endheaders self._send_output(message_body) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\ HackRequests\HackRequests.py", line 142, in _send_output_hook oldfun(*args, **kwargs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\client.py ", line 934, in _send_output self.send(msg) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\client.py ", line 877, in send self.connect() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\client.py ", line 1261, in connect server_hostname=server_hostname) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\ssl.py", line 385, in wrap_socket _context=self) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\ssl.py", line 760, in init self.do_handshake() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\ssl.py", line 996, in do_handshake self._sslobj.do_handshake() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\ssl.py", line 641, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。

boy-hack commented 5 years ago

了解,这段时间太忙了,抽空修复