Primeiro commit
This commit is contained in:
commit
9d22ae4060
Binary file not shown.
|
|
@ -0,0 +1,16 @@
|
|||
#import os
|
||||
|
||||
#print (os.name)
|
||||
#Apresentar o nome do SO
|
||||
|
||||
#nt = win = posix = linux
|
||||
#-n para windowns -c para linux#
|
||||
|
||||
#print (os.getcwd())
|
||||
#retorna a pasta onde voce esta
|
||||
|
||||
#print (os.environ)
|
||||
#exibe as environ variavel de ambiente
|
||||
|
||||
#0 = falso, diferente de 0 = verdadeiro
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import os
|
||||
import utilidades
|
||||
import sys
|
||||
|
||||
endereco = input("Digite um endereço IP: ")
|
||||
|
||||
if not utilidades.validar_ip(endereco):
|
||||
print("O endereço IP é invalido.")
|
||||
sys.exit(0)
|
||||
|
||||
comando = f"ping {endereco}"
|
||||
|
||||
resultado = os.system(comando)
|
||||
|
||||
if not resultado:
|
||||
print ("O endereço existe")
|
||||
else:
|
||||
print("O endereço não existe")
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
def validar_ip(ip : str) ->bool:
|
||||
octetos = ip.split(".")
|
||||
if len(octetos) != 4:
|
||||
return False
|
||||
for octeto in octetos:
|
||||
if int(octeto) < 0 or int (octeto) > 255:
|
||||
return False
|
||||
return True
|
||||
Loading…
Reference in New Issue