To simplify customization, load kippo/commands/*.py using a directory listing

git-svn-id: https://kippo.googlecode.com/svn/trunk@149 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
desaster 2010-06-29 19:15:32 +00:00
parent aee8bc4d20
commit d8b1b0df63
2 changed files with 3 additions and 16 deletions

View File

@ -1,15 +0,0 @@
# Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
__all__ = [
'base',
'ls',
'ping',
'ssh',
'tar',
'wget',
'apt',
'dice',
'adduser',
'last',
]

View File

@ -375,7 +375,9 @@ class HoneyPotEnvironment(object):
self.cfg = config()
self.commands = {}
import kippo.commands
for c in kippo.commands.__all__:
modules = [x[:-3] for x in os.listdir('kippo/commands') if \
x.endswith('.py') and x[0] not in '._']
for c in modules:
module = __import__('kippo.commands.%s' % c,
globals(), locals(), ['commands'])
self.commands.update(module.commands)