- Python Penetration Testing Cookbook
- Rejah Rehim
- 98字
- 2021-07-02 23:08:41
With Python 2
- First, import the required module, urllib:
>>> import urllib
- With the urlopen method, you can download the web page:
>>> webpage = urllib.urlopen("https://www.packtpub.com/")
- We can read the file like a returned object with the read method:
>>> source = webpage.read()
- Close the object when it's done:
>>> webpage.close()
- Now we can print the HTML, which is in a string format:
>>> print source
- It is very easy to update the program to write the contents of the source string to a local file on your computer:
>>> f = open('packtpub-home.html', 'w') >>> f.write(source) >>> f.close
推薦閱讀
- 白話網絡安全2:網安戰略篇
- 零信任網絡:在不可信網絡中構建安全系統
- INSTANT Metasploit Starter
- 計算機病毒分析與防范大全(第3版)
- Enterprise Cloud Security and Governance
- 工業物聯網安全
- 移動APT:威脅情報分析與數據防護
- 從實踐中學習Kali Linux滲透測試
- 軟件安全保障體系架構
- 網絡安全與攻防入門很輕松(實戰超值版)
- INSTANT Apple Configurator How-to
- 信息系統安全等級化保護原理與實踐
- 黑客攻防與電腦安全從新手到高手(超值版)
- CCNA Security 210-260 Certification Guide
- AI+網絡安全:智網融合空間體系建設指南