From 8babc75ad071421a0c72d912daca2df5e1824bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Gon=C3=A7alves=20Costa?= <20251144030032@ifrn.local> Date: Fri, 27 Mar 2026 20:47:16 -0300 Subject: [PATCH] ommit os library --- .../__pycache__/utilities.cpython-311.pyc | Bin 0 -> 666 bytes modulo_os/ping.py | 18 ++++++++++++++++++ modulo_os/testes.py | 8 ++++++++ modulo_os/utilities.py | 8 ++++++++ 4 files changed, 34 insertions(+) create mode 100644 modulo_os/__pycache__/utilities.cpython-311.pyc create mode 100644 modulo_os/ping.py create mode 100644 modulo_os/testes.py create mode 100644 modulo_os/utilities.py diff --git a/modulo_os/__pycache__/utilities.cpython-311.pyc b/modulo_os/__pycache__/utilities.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..16dd7f59ab5e16feca142a32596a4ba996880012 GIT binary patch literal 666 zcmZ3^%ge<81Z~{MGv5K}#~=<2us|7~#ej_I3@Hq$3@MDMjA<+>Of4)?OexI444N#r zm@*4)u@$A3losVBGs3h2X^?JaApX1!NK9v_VORj9F+mFBGN7*2aGkY`B_Lf;P=h9$ z!juh`EdtwK!|1{gt6j@f!U|K*z)-`4YF-LUHdwM)7_TbUY_M;Om>C&B{_4?5VFUV( z-R~Ep-b;{-+e?rsFaHCH5KZP=ti=U6nI*TFb5iqeF=ytLXfhWu0i|xS=O>q>mgE=T zVuLb3u2oP__+{s86%$&VT2vfkWME`!XlP<$U~FJuY!u^?TAW>yUl5a$S{9#|S`w3+ zpHiBWAD>?wQ(BSE^&cf;s(D+N9heA$qx)ntPrAu?JhUp1h!6_9-A40 zUG^RJbCVaS&CH&Yy~6pDoc;wl{Tsp(6HF(Veqd&hH+aC!-(m6@XcL1U(BsU-B}KPb zlJfI&z|L67P$U49DdGbXzc_5bj!(5K5&?3-E;Ix(J}@&fGJarUXB3za{DA>T%?JTg II0>+k0Qw@9&j0`b literal 0 HcmV?d00001 diff --git a/modulo_os/ping.py b/modulo_os/ping.py new file mode 100644 index 0000000..bf6af29 --- /dev/null +++ b/modulo_os/ping.py @@ -0,0 +1,18 @@ +import os +import utilities +import sys + +endereco = input("Digite um endereço IP: ") + +if not utilities.validar_ip(endereco): + print ("O endereço IP é inválido.") + 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") \ No newline at end of file diff --git a/modulo_os/testes.py b/modulo_os/testes.py new file mode 100644 index 0000000..39810e7 --- /dev/null +++ b/modulo_os/testes.py @@ -0,0 +1,8 @@ +import os +print (os.name) + +print (os. getcwd()) + +print(os.environ) + +print(os.path) \ No newline at end of file diff --git a/modulo_os/utilities.py b/modulo_os/utilities.py new file mode 100644 index 0000000..e975ab1 --- /dev/null +++ b/modulo_os/utilities.py @@ -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