pwnlib.util.web — 处理 web 层的实用程序

pwnlib.util.web.wget(url, save=None, timeout=5) → str[源代码]

Downloads a file via HTTP/HTTPS.

参数:
  • url (str) – URL to download
  • save (str or bool) – Name to save as. Any truthy value will auto-generate a name based on the URL.
  • timeout (int) – Timeout, in seconds

Example

>>> url    = 'https://httpbin.org/robots.txt'
>>> result = wget(url, timeout=60)
>>> result
'User-agent: *\nDisallow: /deny\n'
>>> result2 = wget(url, True, timeout=60)
>>> result == file('robots.txt').read()
True