• Bmxer13

    Thanks! Back in action

    posted in Pythonista read more
  • Bmxer13

    Hey guys
    I'm just starting to learn Python and seem to have ran into an error I can't figure out how to fix. I tried setting up a port scanner and seems to throw an error. My error reads range expected 1 got zero. It errors in the range column. I tried looking it up on how to fix it but no dice. Any help would be appreciated

    # coding: utf-8
    import socket
    import subprocess
    import sys
    from datetime import datetime
    # Ask for input
    remoteServer = raw_input("Enter a remote host to scan:")
    remoteServerIP = socket.gethostbyname(remoteServer)
    # Print a nice banner 
    print "-" * 60
    print "Please wait, scanning host",remoteServerIP
    print "-" * 60
    # Check what time scan started
    t1 = datetime.now()
    # Using range function to specify ports
    for port in range(): (range(1,1025))
    sock = socket.socket(socket.AF_INET, SOCK_STREAM)
    result = sock.connect_EX((remoteServerIP,port))
    if result == 0:
        print "port {}: Open".format(port)
    # Checking time again
    t2 = datetime.now()
    # Calculate time difference
    total = t2 - t1
    # printing
    print 'Scanning Completed in', total```

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!