Guest User

Untitled

a guest
Jun 14th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. def ping(host):
  2. process = subprocess.Popen(["ping", "-n", "1",host], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  3. streamdata = process.communicate()[0]
  4. #print(str(streamdata))
  5. if not 'Reply from {}'.format(host) in str(streamdata):
  6. return 1
  7. else:
  8. return 0
Advertisement
Add Comment
Please, Sign In to add comment