tnich/honssh

exceptions.IOError: [Errno 2] No such file or directory: 'sessions/1.2.3.4/20140603_121316.log'

Closed this issue · 7 comments

What steps will reproduce the problem?

1. When.
During a failed bruteforce attack

2. How to reproduce.
Attempt to login with wrong credentials

What is the expected output?
A honssh.log without any error messages.

What do you see instead?
After the attacker has failed to authenticate and disconnects, you will see 
this error in the honssh.log:

"""
2014-06-03 12:13:35+0200 [HonsshServerTransport,1,1.2.3.4] [OUTPUT] Lost 
connection with the attacker: 1.2.3.4
2014-06-03 12:13:35+0200 [HonsshServerTransport,1,1.2.3.4] Unhandled Error
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 323, in runReactorWithLogging
        reactor.run()
      File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1169, in run
        self.mainLoop()
      File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1181, in mainLoop
        self.doIteration(t)
      File "/usr/lib/python2.7/dist-packages/twisted/internet/pollreactor.py", line 167, in doPoll
        log.callWithLogger(selectable, _drdw, selectable, fd, event)
    --- <exception caught here> ---
      File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithLogger
        return callWithContext({"system": lp}, func, *args, **kw)
      File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 69, in callWithContext
        return context.call({ILogContext: newCtx}, func, *args, **kw)
      File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
        return self.currentContext().callWithContext(ctx, func, *args, **kw)
      File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
        return func(*args,**kw)
      File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 599, in _doReadOrWrite
        self._disconnectSelectable(selectable, why, inRead)
      File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 260, in _disconnectSelectable
        selectable.readConnectionLost(f)
      File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 257, in readConnectionLost
        self.connectionLost(reason)
      File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 277, in connectionLost
        protocol.connectionLost(reason)
      File "/opt/honssh/honssh/server.py", line 82, in connectionLost
        self.out.connectionLost()
      File "/opt/honssh/honssh/output.py", line 82, in connectionLost
        self.email('HonSSH - Attack logged', self.txtlog_file)
      File "/opt/honssh/honssh/output.py", line 241, in email
        fp = open(self.txtlog_file, 'rb')
    exceptions.IOError: [Errno 2] No such file or directory: 'sessions/1.2.3.4/20140603_121316.log'

2014-06-03 12:13:35+0200 [HonsshClientTransport,client] connection lost
"""

What version of the product are you using?
26d635886db9

On what operating system?
Ubuntu 12.04 LTS

Please provide any additional information below.
I remember we spoke about changing the logs that were generated, could it be 
that 'sessions/1.2.3.4/20140603_121316.log' is a non-existing log file name?



Original issue reported on code.google.com by are.hans...@gmail.com on 3 Jun 2014 at 10:23

Original comment by tnn...@googlemail.com on 8 Jun 2014 at 8:43

  • Changed state: Started
This issue was closed by revision 46d8a98155cc.

Original comment by tnn...@googlemail.com on 8 Jun 2014 at 10:58

  • Changed state: Fixed
Sorry man, still seeing this issue after upgrading to the latest rev.

"""
        Traceback (most recent call last):
          File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 323, in runReactorWithLogging
            reactor.run()
          File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1169, in run
            self.mainLoop()
          File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1181, in mainLoop
            self.doIteration(t)
          File "/usr/lib/python2.7/dist-packages/twisted/internet/pollreactor.py", line 167, in doPoll
            log.callWithLogger(selectable, _drdw, selectable, fd, event)
        --- <exception caught here> ---
          File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithLogger
            return callWithContext({"system": lp}, func, *args, **kw)
          File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 69, in callWithContext
            return context.call({ILogContext: newCtx}, func, *args, **kw)
          File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
            return func(*args,**kw)
          File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 599, in _doReadOrWrite
            self._disconnectSelectable(selectable, why, inRead)
          File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 263, in _disconnectSelectable
            selectable.connectionLost(f)
          File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 277, in connectionLost
            protocol.connectionLost(reason)
          File "/opt/honssh/honssh/server.py", line 82, in connectionLost
            self.out.connectionLost()
          File "/opt/honssh/honssh/output.py", line 82, in connectionLost
            self.email('HonSSH - Attack logged', self.txtlog_file)
          File "/opt/honssh/honssh/output.py", line 241, in email
            fp = open(self.txtlog_file, 'rb')
        exceptions.IOError: [Errno 2] No such file or directory: 'sessions/1.2.3.4/20140611_074514.log'
"""

Original comment by are.hans...@gmail.com on 11 Jun 2014 at 7:37

Uh oh, hoped my untested quick fix would work!

Original comment by tnn...@googlemail.com on 11 Jun 2014 at 4:25

  • Changed state: Accepted
No worries, still works as expected and all the directories are still intact :)

Sent from my Nokia 3310.

Original comment by are.hans...@gmail.com on 11 Jun 2014 at 8:24

Don't suppose you have the adv log from this connection? Or any logs? Email me? 
:D

Original comment by tnn...@googlemail.com on 11 Jun 2014 at 8:30

Original comment by tnn...@googlemail.com on 15 Jun 2014 at 5:24

  • Changed state: Fixed