#!/usr/bin/python
import socket
import sys

if len(sys.argv) <= 2:
    print ">>>Teste 004<<<"
    print "Modo de uso: Desec-Test004.py [IP] [PORTA]"

else:    
    print ">>>Teste 004<<<"
    
    ip = sys.argv[1]
    porta = int(sys.argv[2])
    
    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"

