2009-11-20 15:48:45 +00:00
|
|
|
# Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
|
|
|
|
# See the COPYRIGHT file for more information
|
|
|
|
|
2009-11-19 15:24:57 +00:00
|
|
|
from twisted.application import internet, service
|
2009-11-21 11:07:26 +00:00
|
|
|
from twisted.cred import portal
|
2009-11-19 15:24:57 +00:00
|
|
|
from twisted.conch.ssh import factory, keys
|
|
|
|
from core import honeypot
|
|
|
|
import config
|
|
|
|
|
|
|
|
factory = honeypot.HoneyPotSSHFactory()
|
|
|
|
factory.portal = portal.Portal(honeypot.HoneyPotRealm())
|
|
|
|
|
|
|
|
pubKeyString, privKeyString = honeypot.getRSAKeys()
|
2009-11-21 11:07:26 +00:00
|
|
|
# Move this somewhere if we decide to use more passwords
|
|
|
|
users = (
|
|
|
|
('root', 'root'),
|
|
|
|
('root', '1234'),
|
|
|
|
)
|
|
|
|
factory.portal.registerChecker(honeypot.HoneypotPasswordChecker(users))
|
2009-11-19 15:24:57 +00:00
|
|
|
factory.publicKeys = {'ssh-rsa': keys.Key.fromString(data=pubKeyString)}
|
|
|
|
factory.privateKeys = {'ssh-rsa': keys.Key.fromString(data=privKeyString)}
|
|
|
|
|
|
|
|
application = service.Application('honeypot')
|
|
|
|
service = internet.TCPServer(config.ssh_port, factory)
|
|
|
|
service.setServiceParent(application)
|
|
|
|
|
|
|
|
# vim: set ft=python sw=4 et:
|