Server uptime testing tool

The server uptime testing tool is a command like tool developed with Python and Scapy which would send ping packets to the server at required intervals. If the ping packet is not received at a specific time, the tool would display the time along with the text ‘server was down’. If up, the tool would display ‘server was up’ at the specific time. The tool is developed using Python and Scapy framework and would work on Windows and Linux Platforms. The output of the code is shown below.


Source Code

from scapy.all import *
import time
import nmap
import datetime
ip=IP()
ip.src=’192.168.2.3′
ip.dst=’192.168.2.1′
icmp=ICMP()
icmp.type=8
icmp.code=0
TIMEOUT=5
while True:
a=datetime.datetime.now()
p=sr1(ip/icmp,timeout=TIMEOUT)
if(p):
print “Server was up at”, a
else:
print “Server was down at”, a
time.sleep(5)

Learn to make custom network tools and scripts with our video course Click Here