Skip to Content
Practical Web Penetration Testing
book

Practical Web Penetration Testing

by Gus Khawaja
June 2018
Intermediate to advanced
294 pages
7h 5m
English
Packt Publishing
Content preview from Practical Web Penetration Testing

Miscellaneous

  • To create a function, use the def keyword, followed by the function name, some optional variables, and the : character at the end. For example:
def addition(x,y):     return x + y
  • To create a for loop, do the following:
ips = ['192.1.1.1','192.1.1.254']for ip in ips:    print ip
  • The following is a sample custom class object in Python:
# class nameclass Host:    #class constructor    def __init__(self,name):        self.name = name    def print_host(self):        print self.name#let's call it from somewhere elseh = Host('SRV-001')h.print_host()
  • To manage errors using exceptions in Python, do the following:
try:    [put your code here]except Exception, e:    exception_message = str(e)    print("Error: " + exception_message)
  • To open and read a text file, do ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Web Penetration Testing with Metasploit

Hands-On Web Penetration Testing with Metasploit

Harpreet Singh, Himanshu Sharma
Penetration Testing

Penetration Testing

Georgia Weidman

Publisher Resources

ISBN: 9781788624039Supplemental Content