Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Show Off Your Open Source Projects (http://www.programmingforums.org/forum52.html)
-   -   Pypscan (http://www.programmingforums.org/showthread.php?t=1239)

Beegie_B Nov 21st, 2004 6:48 PM

This was written before my IP scanner, and yet again isn't to fancy or good... But I'm still going to throw it on here for Learning Reasons

:

#Python Port Scanner
#Orgiginal Idea by K1
#Code and Changes by Beegie_B

from socket import *
print """
  =========================================================================
  start() is to begin port scan, and man() is for a manual on how to use
  the port scanner.
  =========================================================================
  """
 
def scan(ip, min_port, max_port):
    open_ports = []
    print "Scanning...",
    setdefaulttimeout(.31)
    for port in range(min_port, max_port+1):
      #print "Scanning %d:"%port,
      #print port,
      try:
          s = socket(AF_INET, SOCK_STREAM)
          s.connect((ip, port))
          s.close()
          open_ports.append(port)
          #print "Open"
      except:
          pass
          #print "Closed"
    print
    print "Open Ports:", open_ports
   
def start():
  ip = raw_input("IP/Hostname: ")
  min_port = input("Start Port: ")
  max_port = input("End Port: ")
  scan(ip, min_port, max_port)

def man():
  print """
  To use first enter: start() and input the information.

  IP/Hostname: Is the IP address or DNS of the computer you wish to scan.
  eg. IP/Hostname: 112.32.2.42 or IP/Hostname: www.bastardshandbook.com

  Start Port: Is the port you wish to start the scan on.
  eg. Start Port: 21

  End Port: Is the port you wish to end the scan on.
  eg. End Port: 1203
  """


Again, Nothing Fancy...

Beeg


All times are GMT -5. The time now is 1:57 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC