lundi 14 décembre 2020

How to make if statement with os.system() output

I am trying to ping a host using os.system('ping 1.1.1.1 -c 1') and im trying to make an if statement if the ping doesnt work such as if the host disables icmp or the host was not found. So basically im trying to do

if pingcommand == not working:
       print("ICMP Not Working")
else:
   print("Working")

Operating System: Kali Linux (Recent)

Aucun commentaire:

Enregistrer un commentaire