#!/usr/bin/env  python
import socket

remoteserver = "xxx.xxx.xxx.xxx"

for port in range(1,65535):
    print(port)
    sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    result = sock.connect_ex((remoteserver,port))
    if result == 0:
        print("Porta{}: Aberta  ".format(port))
    sock.close()

            
