Book Image

Learning Penetration Testing with Python

By : Christopher Duffy
Book Image

Learning Penetration Testing with Python

By: Christopher Duffy

Overview of this book

Table of Contents (19 chapters)
Learning Penetration Testing with Python
Credits
Disclaimer
About the Author
Acknowlegements
About the Reviewers
www.PacktPub.com
Preface
Index

Python formatting


This language's greatest selling feature for me is its formatting. It takes very little work to put a script together, and because of its simplistic formatting requirements, you reduce chances of errors. For experienced programmers, the loathsome ; and {} signs will no longer impact your development time due to syntax errors.

Indentation

The most important thing to remember in Python is indentation. Python uses indents to show where logic blocks are changed. So, if you are writing a simple print script as mentioned earlier, you are not necessarily going to see this, but if you are writing an if statement, you will. See the following example, which prints the statement previously mentioned here:

#!/usr/bin/env python
execute=True
if execute != False:
    print("Do you want to play a game?\n")

More details on how this script operates and executes can be found in the Compound statements section of this chapter. The following example prints the statement to the screen if execute...