Book Image

Python Penetration Testing Essentials

By : Mohit
Book Image

Python Penetration Testing Essentials

By: Mohit

Overview of this book

Table of Contents (14 chapters)
Python Penetration Testing Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

How to check live systems in a network and the concept of a live system


Ping scan involves sending an ICMP ECHO Request to a host. If a host is live, it will return an ICMP ECHO Reply, as shown in the following image:

ICMP request and reply

The operating system's ping command provides the facility to check whether the host is live or not. Consider a situation where you have to test a full list of IP addresses. In this situation, if you test the IP one by one, it will take a lot of time and effort. In order to handle this situation, we use ping sweep.

Ping sweep

Ping sweep is used to identify the live host from a range of IP addresses by sending the ICMP ECHO request and the ICMP ECHO reply. From a subnet and network address, an attacker or pentester can calculate the network range. In this section, I am going to demonstrate how to take advantage of the ping facility of an operating system.

First, I shall write a simple and small piece of code, as follows:

import os
response = os.popen('ping -n...