def finish(self, line): self.honeypot.password_input = False if line != self.passwd: self.writeln('Sorry, passwords do not match') self.exit() return userdb = UserDB() userdb.adduser(self.honeypot.user.username, self.honeypot.user.uid, self.passwd) self.writeln('passwd: password updated successfully') self.exit()
def finish(self, line): self.honeypot.password_input = False if line != self.passwd: self.writeln('Sorry, passwords do not match') self.exit() return userdb = UserDB() userdb.adduser(self.honeypot.user.username, self.honeypot.user.uid, self.passwd) self.writeln('passwd: password updated successfully') self.exit()
def __init__(self): cfg = config() # protocol^Wwhatever instances are kept here for the interact feature self.sessions = {} # for use by the uptime command self.starttime = time.time() # convert old pass.db root passwords passdb_file = '%s/pass.db' % (cfg.get('honeypot', 'data_path'),) if os.path.exists(passdb_file): userdb = UserDB() print 'pass.db deprecated - copying passwords over to userdb.txt' if os.path.exists('%s.bak' % (passdb_file,)): print 'ERROR: %s.bak already exists, skipping conversion!' % \ (passdb_file,) else: passdb = anydbm.open(passdb_file, 'c') for p in passdb: userdb.adduser('root', 0, p) passdb.close() os.rename(passdb_file, '%s.bak' % (passdb_file,)) print 'pass.db backed up to %s.bak' % (passdb_file,) # load db loggers self.dbloggers = [] for x in cfg.sections(): if not x.startswith('database_'): continue engine = x.split('_')[1] dbengine = 'database_' + engine lcfg = ConfigParser.ConfigParser() lcfg.add_section(dbengine) for i in cfg.options(x): lcfg.set(dbengine, i, cfg.get(x, i)) lcfg.add_section('honeypot') for i in cfg.options('honeypot'): lcfg.set('honeypot', i, cfg.get('honeypot', i)) print 'Loading dblog engine: %s' % (engine,) dblogger = __import__( 'kippo.dblog.%s' % (engine,), globals(), locals(), ['dblog']).DBLogger(lcfg) log.startLoggingWithObserver(dblogger.emit, setStdout=False) self.dbloggers.append(dblogger)
def __init__(self): cfg = config() # protocol^Wwhatever instances are kept here for the interact feature self.sessions = {} # for use by the uptime command self.starttime = time.time() # convert old pass.db root passwords passdb_file = '%s/pass.db' % (cfg.get('honeypot', 'data_path'),) if os.path.exists(passdb_file): userdb = UserDB() print 'pass.db deprecated - copying passwords over to userdb.txt' if os.path.exists('%s.bak' % (passdb_file,)): print 'ERROR: %s.bak already exists, skipping conversion!' % \ (passdb_file,) else: passdb = anydbm.open(passdb_file, 'c') for p in passdb: userdb.adduser('root', 0, p) passdb.close() os.rename(passdb_file, '%s.bak' % (passdb_file,)) print 'pass.db backed up to %s.bak' % (passdb_file,) # load db loggers self.dbloggers = [] for x in cfg.sections(): if not x.startswith('database_'): continue engine = x.split('_')[1] dbengine = 'database_' + engine lcfg = ConfigParser.ConfigParser() lcfg.add_section(dbengine) for i in cfg.options(x): lcfg.set(dbengine, i, cfg.get(x, i)) lcfg.add_section('honeypot') for i in cfg.options('honeypot'): lcfg.set('honeypot', i, cfg.get('honeypot', i)) print 'Loading dblog engine: %s' % (engine,) dblogger = __import__( 'kippo.dblog.%s' % (engine,), globals(), locals(), ['dblog']).DBLogger(lcfg) log.startLoggingWithObserver(dblogger.emit, setStdout=False) self.dbloggers.append(dblogger)