Nov 21st, 2004, 5:48 PM
|
#1
|
|
Programmer
Join Date: Nov 2004
Location: Windsor, Ontario, Canada
Posts: 32
Rep Power: 0 
|
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
|
|
|