更新时间:2021-07-02 23:09:09
封面
版权信息
Credits
About the Author
About the Reviewers
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do it…
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
Why Python in Penetration Testing?
Introduction
Why Python is a great option for security scripting
How to do it...
Python can be used in both and interpreted and compiled forms
Syntax and indented layout
Simple learning curve
Powerful third-party libraries
Cross-platform (code anywhere)
Python 3 language basics and differences
Python 2
Python 3
Python 2.7
Key differences between Python 2.7 and Python 3
Setting Up a Python Environment
Setting up a Python environment in Linux
Installing Python
Setting up a virtual environment
Setting up the editor or IDE
Setting up a Python environment in macOS
Setting up a Python environment in Windows
Web Scraping with Python
Download web pages with Python scripts
With Python 2
With Python 3
Changing the user agent
Downloading files
Using a regular expression to get the information from the downloaded web pages
Requesting and downloading dynamic website pages
Escaping invalid characters
Dynamic GET requests
Data Parsing with Python
Parsing HTML tables
Extracting data from HTML documents
Parsing XML data
Web Scraping with Scrapy and BeautifulSoup
Web spiders with Scrapy
Scrapy shell
Link extractor with Scrapy
Scraping after logging into websites using Scrapy
Network Scanning with Python
Simple port scanner