desaster / kippo

Kippo - SSH Honeypot
1.62k stars 277 forks source link

IPv6 in ./kippo/core/dblog.py #156

Open lieanu opened 10 years ago

lieanu commented 10 years ago

In dblog.py, line11-13:

        self.re_connected = re.compile(
            '^New connection: ([0-9.]+):([0-9]+) \(([0-9.]+):([0-9]+)\) ' + \
            '\[session: ([0-9]+)\]$')

The above re code match ipv4 address, it works when strings like this: New connection: 55.66.77.88:60469 (55.66.77.89:2222) [session: 0]

But how about the IPv6 Environment, Strings like this: New connection: ::ffff:55.66.77.88:60469 (::ffff:55.66.77.89:2222) [session: 0] or New connection: 2001:ddd:222:333:4444:5555::19e2:60028 (2001:dda:222:111::24a:2222) [session: 0]

lieanu commented 10 years ago

I have solve this problem with

        self.re_connected = re.compile(
            '^New connection: ([a-f0-9:.]+):([0-9]+) \(([a-f0-9:.]+):([0-9]+)\) ' + \
            '\[session: ([0-9]+)\]$')