Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- from termcolor import colored
- import subprocess
- iplist=["172.16.30.1","8.8.8.8","20.1.20.33"]
- def runTests():
- for ip in iplist:
- address = ip
- res = subprocess.call(['ping', '-c', '3', '-W', '1', address],stdout=subprocess.PIPE)
- if res == 0:
- print colored("✔️ " + address, 'green')
- elif res == 2:
- print colored("❌ " + address + " aucune réponse", 'yellow')
- else:
- print colored("❌ " + address, 'red')
- runTests()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement