add logging for direct-tcpip connections

This commit is contained in:
Michel Oosterhof 2014-08-20 15:24:43 +02:00
parent 70c3d0ac0a
commit 44c6fba349
1 changed files with 9 additions and 1 deletions

View File

@ -4,7 +4,7 @@
import twisted
from twisted.cred import portal
from twisted.conch import avatar, interfaces as conchinterfaces
from twisted.conch.ssh import factory, userauth, connection, keys, session, transport
from twisted.conch.ssh import factory, userauth, connection, keys, session, transport, forwarding
from twisted.python import log
from zope.interface import implements
@ -203,14 +203,17 @@ class HoneyPotSSHSession(session.SSHSession):
def request_env(self, data):
print 'request_env: %s' % (repr(data))
class HoneyPotAvatar(avatar.ConchUser):
implements(conchinterfaces.ISession)
def __init__(self, username, env):
avatar.ConchUser.__init__(self)
self.username = username
self.env = env
self.channelLookup.update({'session': HoneyPotSSHSession})
self.channelLookup['direct-tcpip'] = KippoOpenConnectForwardingClient
userdb = core.auth.UserDB()
self.uid = self.gid = userdb.getUID(self.username)
@ -304,4 +307,9 @@ def getDSAKeys():
privateKeyString = f.read()
return publicKeyString, privateKeyString
def KippoOpenConnectForwardingClient(remoteWindow, remoteMaxPacket, data, avatar):
remoteHP, origHP = twisted.conch.ssh.forwarding.unpackOpen_direct_tcpip(data)
log.msg( "connection attempt to %s:%i" % remoteHP )
return None
# vim: set et sw=4 et: