Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Penetration Testing with Python

You're reading from   Hands-On Penetration Testing with Python Enhance your ethical hacking skills to build automated and intelligent systems

Arrow left icon
Product type Paperback
Published in Jan 2019
Publisher Packt
ISBN-13 9781788990820
Length 502 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Furqan Khan Furqan Khan
Author Profile Icon Furqan Khan
Furqan Khan
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Introduction to Python 2. Building Python Scripts FREE CHAPTER 3. Concept Handling 4. Advanced Python Modules 5. Vulnerability Scanner Python - Part 1 6. Vulnerability Scanner Python - Part 2 7. Machine Learning and Cybersecurity 8. Automating Web Application Scanning - Part 1 9. Automated Web Application Scanning - Part 2 10. Building a Custom Crawler 11. Reverse Engineering Linux Applications 12. Reverse Engineering Windows Applications 13. Exploit Development 14. Cyber Threat Intelligence 15. Other Wonders of Python 16. Assessments 17. Other Books You May Enjoy

Modules and packages

Every Python script is called a module. Python has been designed with reusability and ease of code in mind. For this reason, every Python file we create becomes a Python module and is eligible to be invoked or used within any other file or script. You might have learned in Java how to import classes and reuse them with other classes. The idea is pretty much the same here, except that we are importing the whole file as a module and we can reuse any method, class, or variable of the imported file. Let's take a look at an example. We will create two files, child.py and parent.py, and put the following code in each, as follows:

The first five lines belong to child.py, and the last eight lines belong to parent.py. We will run the parent, as shown in the output. It should be noted that the imported file can be given an alias. In our case, we imported the child...
You have been reading a chapter from
Hands-On Penetration Testing with Python
Published in: Jan 2019
Publisher: Packt
ISBN-13: 9781788990820
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime