Created
September 29, 2023 23:57
-
-
Save matefs/381051094d6b36db3269bf713db1bd80 to your computer and use it in GitHub Desktop.
porta-aberta-fechada-python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import socket | |
ip = "192.168.0.1" | |
porta = 80 # Se for porta 81 vai constar fechada. | |
meusocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
res = meusocket.connect_ex((ip, porta)) | |
if (res == 0 ): | |
print("Porta Aberta") | |
else: | |
print("Porta Fechada") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment