????

???н?????£?


??????????????????е?????????hydra??????????????

??????????ζ?????telnetlib.Telnet??????????????patator??????????????????????????????????????????Telnet?????????棬?????????????????

Telnet_login?????TCP_Cache?????????£?

class TCP_Cache:
  def __init__(self):
    self.cache = {} # {'10.0.0.1:22': ('root'?? conn1)?? '10.0.0.2:22': ('admin'?? conn2)??
    self.curr = None

  def __del__(self):
    for _?? (_?? c) in self.cache.items():
      c.close()
    self.cache.clear()

  def bind(self?? host?? port?? *args?? **kwargs):

    hp = '%s:%s' % (host?? port)
    key = ':'.join(args)

    if hp in self.cache:
      k?? c = self.cache[hp]

      if key == k:
        self.curr = hp?? k?? c
        return c.fp?? c.banner

      else:
        c.close()
        del self.cache[hp]

    self.curr = None

    conn = self.connect(host?? port?? *args?? **kwargs)

    self.cache[hp] = (key?? conn)
    self.curr = hp?? key?? conn

    return conn.fp?? conn.banner

?????????????????????????Telnet_login???????????host:port???????cache???????ζ???????cache????????????????????????(??????fp??fp.expect?????????????????????)??

????Patator??????黯?????????黯???????????????Э?飬??????Э????????????????????????????????telnet????????????telnetlib????????????????????????telnet?????????????а??pycurl(?http?????????????curl???python???)????????????????????????????????

????????????????????????????????

warnings = []

try:
  import pycurl
except ImportError:
  warnings.append('pycurl')

dependencies = {
  'paramiko': [('ssh_login'??)?? 'http://www.lag.net/paramiko/'?? '1.7.7.1']??
  'pycurl': [('http_fuzz'??)?? 'http://pycurl.sourceforge.net/'?? '7.19.0']??
  'openldap': [('ldap_login'??)?? 'http://www.openldap.org/'?? '2.4.24']??
  'impacket': [('smb_login'??'smb_lookupsid'??'mssql_login')?? 'http://oss.coresecurity.com/projects/impacket.html'?? 'svn#765']??
  'cx_Oracle': [('oracle_login'??)?? 'http://cx-oracle.sourceforge.net/'?? '5.1.1']??
  'mysql-python': [('mysql_login'??)?? 'http://sourceforge.net/projects/mysql-python/'?? '1.2.3']??
  'psycopg': [('pgsql_login'??)?? 'http://initd.org/psycopg/'?? '2.4.5']??
  'pycrypto': [('vnc_login'??)?? 'http://www.dlitz.net/software/pycrypto/'?? '2.3']??
  'dnspython': [('dns_reverse'?? 'dns_forward')?? 'http://www.dnspython.org/'?? '1.10.0']??
  'IPy': [('dns_reverse'?? 'dns_forward')?? 'https://github.com/haypo/python-ipy'?? '0.75']??
  'pysnmp': [('snmp_login'??)?? 'http://pysnmp.sf.net/'?? '4.2.1']??
  'unzip': [('unzip_pass'??)?? 'http://www.info-zip.org/'?? '6.0']??
  'java': [('keystore_pass'??)?? 'http://www.oracle.com/technetwork/java/javase/'?? '6']??
  'python': [('ftp_login'??)?? 'http://www.python.org/'?? '2.7']??
 }
 
 for w in set(warnings):
    mods?? url?? ver = dependencies[w]
    if name in mods:
      print('ERROR: %s %s (%s) is required to run %s.' % (w?? ver?? url?? name))
      abort = True

????????????????????п????????????????????б?warning????ε?????????????????????????????????warning????????????????д????????????????????????pycurl??????????????warnings?к???“pycurl"???????????????????????????????????????????????