Penetration Testing mailing list archives
Re: Medium Scale Scanning Best Practices
From: Gerardo Richarte <core.lists.pentest () core-sdi com>
Date: Wed, 16 Jan 2002 21:13:41 -0300
"Erlend J. Leiknes" wrote:
You could program it in python using the telnet library.
On this same line... and from the top of my head:
import time
import telnetlib # this is not really needed if you are not going to connect to port 21
---- BannerGrabber.py
import time
import telnetlib # this is not really needed if you are not going to connect to port 21
class BannerGrabber:
def __init__(self,host,port = None):
self.host = host
self.port = port
def connect(self, port = None, host = None):
if host: self.host = host
if port: self.port = port
self.telnet = telnetlib.Telnet()
try:
self.telnet.open(self.host, self.port)
except: # exception catching can be narrower here...
return 0
return 1
def getBanner(self, timeout = 5):
banner = ''
while (timeout):
time.sleep(1)
timeout -= 1
banner += self.telnet.read_very_eager()
return banner
def close(self):
self.telnet.close()
---- banner.py
#!/usr/bin/python2
import BannerGrabber
import sys
if not sys.argv[2:]:
print "use: banner.py host ports"
sys.exit(1)
b = BannerGrabber.BannerGrabber(sys.argv[1])
for i in sys.argv[2:]:
if b.connect(int(i)):
try:
print "Port %s: %s" % (i,b.getBanner())
b.close()
except Exception,e:
print e
else:
print "Port %s: (closed)" % i
---------
in python indentation is what defines what in C would be delimited by { and }
this is simple, you can improve it i'm sure... ley me know if you have any problems with it.
gera
--- for a personal reply use: Gerardo Richarte <gera () corest com>
----------------------------------------------------------------------------
This list is provided by the SecurityFocus Security Intelligence Alert (SIA)
Service. For more information on SecurityFocus' SIA service which
automatically alerts you to the latest security vulnerabilities please see:
https://alerts.securityfocus.com/
Current thread:
- Medium Scale Scanning Best Practices swlodin (Jan 15)
- Re: Medium Scale Scanning Best Practices Erlend J. Leiknes (Jan 16)
- Re: Medium Scale Scanning Best Practices Gerardo Richarte (Jan 17)
- Re: Medium Scale Scanning Best Practices Renaud Deraison (Jan 17)
- <Possible follow-ups>
- Re: Medium Scale Scanning Best Practices miguel . dilaj (Jan 15)
- RE: Medium Scale Scanning Best Practices Aleksander P. Czarnowski (Jan 16)
- Re: Medium Scale Scanning Best Practices John Malconian (Jan 18)
- Re: Medium Scale Scanning Best Practices Troy Davis (Jan 19)
- testing for IP address space leakage in NAT systems R P G (Jan 21)
- Re: testing for IP address space leakage in NAT systems R. DuFresne (Jan 21)
- Re: testing for IP address space leakage in NAT systems Frank (Jan 21)
- Re: testing for IP address space leakage in NAT systems Thomas Reinke (Jan 21)
- Re: testing for IP address space leakage in NAT systems Gamble (Jan 22)
(Thread continues...)
- Re: Medium Scale Scanning Best Practices Erlend J. Leiknes (Jan 16)
