Skip to content

Instantly share code, notes, and snippets.

@iamramahibrah
Created July 17, 2021 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamramahibrah/e3e34f579e4364ae253b862d0bbed326 to your computer and use it in GitHub Desktop.
Save iamramahibrah/e3e34f579e4364ae253b862d0bbed326 to your computer and use it in GitHub Desktop.
import os
hostname = "8.8.8.8"
for ip in hostname:
response = os.system("ping -c1 >/dev/null "+ hostname)
if response == 0:
print("Connected")
else:
print("Disconnected")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment