pass config file as parameter everywhere

This commit is contained in:
Michel Oosterhof
2015-06-11 13:33:29 +00:00
parent 8e06a886da
commit b234efa489
10 changed files with 60 additions and 83 deletions

View File

@@ -9,7 +9,7 @@ from twisted.application.service import IServiceMaker
from twisted.application import internet, service
from twisted.cred import portal
from cowrie.core.config import config
from cowrie.core.config import readConfigFile
from cowrie import core
import cowrie.core.ssh
@@ -34,7 +34,7 @@ class CowrieServiceMaker(object):
print 'ERROR: You must not run cowrie as root!'
sys.exit(1)
cfg = readCfgFile(options["config"]))
cfg = readConfigFile(options["config"])
if cfg.has_option('honeypot', 'listen_addr'):
listen_addr = cfg.get('honeypot', 'listen_addr')
@@ -49,10 +49,10 @@ class CowrieServiceMaker(object):
else:
listen_port = 2222
factory = core.ssh.HoneyPotSSHFactory(cfg))
factory.portal = portal.Portal(core.ssh.HoneyPotRealm())
factory.portal.registerChecker(core.auth.HoneypotPublicKeyChecker())
factory.portal.registerChecker(core.auth.HoneypotPasswordChecker())
factory = core.ssh.HoneyPotSSHFactory(cfg)
factory.portal = portal.Portal(core.ssh.HoneyPotRealm(cfg))
factory.portal.registerChecker(core.auth.HoneypotPublicKeyChecker(cfg))
factory.portal.registerChecker(core.auth.HoneypotPasswordChecker(cfg))
top_service = top_service = service.MultiService()