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

Functions and methods in Python

Functions and methods are used to design or make a logical unit of code that can be reused throughout the course of your script or other scripts. Functions actually form the basis of code reuse and bring modularity to the code structure. They keep the code clean and easier to modify.

It is advisable to always try to break our logic into small units of code, each of which is a function. We should try to keep the size of the method small in terms of the lines of code whenever possible.

The following code represents the basic syntax of defining methods in Python:

def print_message(message):
print(message)
statement 2
statement

Python methods do not have a return type in their definition as you might have seen in C, C++, or Java, such as void, in, float, and so on. A Python method may or may not return a value, but we do not explicitly need...

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 €18.99/month. Cancel anytime