(self, mode, ran)
simple port scanner works with range of ports 
        or with common ports (al-swisre idea)
simple port scanner works with range of ports 
        or with common ports (al-swisre idea)
simple port scanner works with range of ports or with common ports ( al - swisre idea )
def portScanner(self, mode, ran) :
        """
        simple port scanner works with range of ports 
        or with common ports (al-swisre idea)
        """
        clearScr()
        print "[~] Scanning Ports"
        def do_it(ip, port):
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            #sock.settimeout(5)
            sock = sock.connect_ex((ip,port))
            if sock == 0:
                print " [*] Port %i is open" % port 
        
        if mode == 1 :
            a = ran.split('-')
            start = int(a[0])
            end = int(a[1])
            for i in range(start, end):
                do_it(self.serverip, i)
        elif mode == 2 :
            for port in [80,21,22,2082,25,53,110,443,143] :
                # didn't use multithreading cos it's few ports
                do_it(self.serverip, port)
def portScanner ( self , mode , ran ) : clearScr ( ) print "[~] Scanning Ports" def do_it ( ip , port ) : sock = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) #sock.settimeout(5) sock = sock . connect_ex ( ( ip , port ) ) if sock == 0 : print " [*] Port %i is open" % port if mode == 1 : a = ran . split ( '-' ) start = int ( a [ 0 ] ) end = int ( a [ 1 ] ) for i in range ( start , end ) : do_it ( self . serverip , i ) elif mode == 2 : for port in [ 80 , 21 , 22 , 2082 , 25 , 53 , 110 , 443 , 143 ] : # didn't use multithreading cos it's few ports do_it ( self . serverip , port )