阅读不同网页的内容,然后将其加在一起以放入另一个URL

C4RN4GE

我对python并不了解,但是我知道它是最好的编码语言。我正在挑战5个URL,它们每10秒更改一次内容。它们每个都包含代码的一部分。还有一个验证链接,它检查我单击的网址,并检查它是否正确的代码,如果正确,它将给我一个代码。因此,为了解决这个问题,我正在编写一个脚本,该脚本将获取5个URL的所有内容并将它们连接在一起,并将其粘贴到验证链接的URL中,然后将给我提供我需要的代码。

这是我的代码

import urllib.request

fp1 = urllib.request.urlopen("https://assess.joincyberdiscovery.com/challenge-files/clock-pt1?verify=Gl7fPRYxQvgBdbmhMo8vkA%3D%3D")
mybytes1 = fp1.read()
fp1.close()

fp2 = urllib.request.urlopen("https://assess.joincyberdiscovery.com/challenge-files/clock-pt2?verify=Gl7fPRYxQvgBdbmhMo8vkA%3D%3D")
mybytes2 = fp2.read()
fp2.close()

fp3 = urllib.request.urlopen("https://assess.joincyberdiscovery.com/challenge-files/clock-pt3?verify=Gl7fPRYxQvgBdbmhMo8vkA%3D%3D")
mybytes3 = fp3.read()
fp3.close()

fp4 = urllib.request.urlopen("https://assess.joincyberdiscovery.com/challenge-files/clock-pt4?verify=Gl7fPRYxQvgBdbmhMo8vkA%3D%3D")
mybytes4 = fp4.read()
fp4.close()

fp5 = urllib.request.urlopen("https://assess.joincyberdiscovery.com/challenge-files/clock-pt5?verify=Gl7fPRYxQvgBdbmhMo8vkA%3D%3D")
mybytes5 = fp5.read()
fp5.close()

fp6 = urllib.request.urlopen("https://assess.joincyberdiscovery.com/challenge-files/get-flag?verify=Gl7fPRYxQvgBdbmhMo8vkA%3D%3D&string=" + mybytes1 + mybytes2 + mybytes3 + mybytes4 + mybytes5)
mybytes6 = fp6.read()
fp6.close()

print(mybytes6)

但是我遇到了一个我不明白的错误。

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket
_context=self, _session=session)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 808, in __init__
self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sarvesh/Documents/scriptdis.py", line 3, in <module>
fp1 = urllib.request.urlopen("https://assess.joincyberdiscovery.com/challenge-files/clock-pt1?verify=Gl7fPRYxQvgBdbmhMo8vkA%3D%3D")
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>

谁能帮助我了解问题所在?

伊恩

urllib和“ SSL:CERTIFICATE_VERIFY_FAILED”错误

您正在尝试打开没有有效证书的网站。如果您信任该网站,则需要创建一个未经认证的上下文,否则urllib会抛出您看到的错误。

import ssl

# This restores the same behavior as before.
context = ssl._create_unverified_context()
fp1 = urllib.request.urlopen("https://assess.joincyberdiscovery.com/challenge-files/clock-pt1?verify=Gl7fPRYxQvgBdbmhMo8vkA%3D%3D", context=context)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

将2个变量加在一起以创建另一个变量

找出加在一起的字节等于另一个字节

如何使用 ffmpeg 将一个视频与 2 个不同的视频叠加在一起?

如何根据来自另一个向量的信息将向量中的元素添加在一起

将多个列表的内容加在一起

将两个选定的值加在一起,然后显示结果JavaScript

将多个对象简化为一个,将值加在一起

将代表不同类型的两个结构加在一起

将 4 个不同的 Tablix 数据列加在一起 SSRS

我如何找到重复的公司并将其合并为一个公司并将其权重加在一起

Javascript检查一个项目出现在列表中的次数,然后将这些列表加在一起

如何将文件的某些行中的值加在一起然后删除一个数字?

如何从窗体将数组添加在一起并将其添加到数据库的一个字段中?

SQL帮助:如何将两个不同的行加在一起作为一个值?

如何将两个函数加在一起并存储在 JavaScript 中的另一个函数(第三个函数)中?

如何找到每行的2个最大值,然后将它们加在一起?

试图将两个链表添加在一起但得到一个 AttributeError

当其中一个为空时,将2个输入字段加在一起

将三个数组加在一起以在python中形成一个数组

如何将多个属性添加在一起并将它们存储在 Python 面向对象编程中的另一个属性中?

AngularJS-抓取多个JSON键值,然后将它们加在一起

将n行乘以m行,然后将它们加在一起

如何分隔数字中的数字,然后用Java将它们加在一起?

如何将其他所有列加在一起

查找字符串中的数字并将其加在一起

来自不同行的1个值加在一起,其中列中的值匹配

我们如何将两个不同的嵌套列表添加在一起?

根据另一列中的条件将值加在一起

SQL将列加在一起