Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Program to check if host pinging or not
  • Loading branch information
saurabh896 authored May 8, 2020
1 parent 1a7e3ed commit 5f7a203
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions saurabh/IP/groupofIPs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
192.168.0.1
192.168.0.2
192.168.0.3
24 changes: 24 additions & 0 deletions saurabh/IP/pingIp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
"""
Created on Fri May 8 10:08:30 2020
@author: saurabh
"""

import subprocess
def PingIP(str):
process=subprocess.Popen(str,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
for line in process.stdout:
print(line)
res.append(line)
errcode = process.returncode
for line in res:
print(line)
res=[]
file1=open("groupofIPs.txt","r+")
grp=file1.read().split('\n')
cmd='ping'

for item in grp:
cmd1=cmd +" "+item
PingIP(cmd1)

0 comments on commit 5f7a203

Please sign in to comment.