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

Dictionary

A dictionary is a list of items with key and value pairs. The best way to describe it is by using examples. Let's start:

  • To declare a key–value pair of the host and IP, enter the following (for example):
hosts_dictionary = { 'Srv-001':'10.0.0.100', 'Srv-002':'10.0.0.100'}
  • To add a new item to a dictionary, do the following:
hosts_dictionary = { 'Srv-001':'10.0.0.100', 'Srv-002':'10.0.0.101'}hosts_dictionary['Srv-003'] = '10.0.0.103'print hosts_dictionary
  • To update an existing item in a dictionary, do the following:
hosts_dictionary = { 'Srv-001':'10.0.0.100', 'Srv-002':'10.0.0.101'}hosts_dictionary['Srv-002'] = '10.0.0.122'print hosts_dictionary
  • To delete an existing item in a dictionary, do the following:
hosts_dictionary ...
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