Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions kippo/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from kippo.core.config import config
from kippo.core.userdb import UserDB
from kippo.core import utils
import re, socket

commands = {}

Expand Down Expand Up @@ -60,6 +61,11 @@ def call(self):
self.honeypot.terminal.reset()
self.writeln('Connection to server closed.')
self.honeypot.hostname = 'localhost'
name, alias, addresslist = socket.gethostbyaddr(self.honeypot.clientIP)
name = name.split('.')[0]
r = re.compile('^[-a-zA-Z0-9]+$')
if r.match(name):
self.honeypot.hostname = name
self.honeypot.cwd = '/root'
if not self.fs.exists(self.honeypot.cwd):
self.honeypot.cwd = '/'
Expand Down Expand Up @@ -234,6 +240,11 @@ def start(self):
def finish(self):
self.writeln('Connection to server closed.')
self.honeypot.hostname = 'localhost'
name, alias, addresslist = socket.gethostbyaddr(self.honeypot.clientIP)
name = name.split('.')[0]
r = re.compile('^[-a-zA-Z0-9]+$')
if r.match(name):
self.honeypot.hostname = name
self.honeypot.cwd = '/root'
if not self.fs.exists(self.honeypot.cwd):
self.honeypot.cwd = '/'
Expand All @@ -253,6 +264,11 @@ def start(self):
def finish(self):
self.writeln('Connection to server closed.')
self.honeypot.hostname = 'localhost'
name, alias, addresslist = socket.gethostbyaddr(self.honeypot.clientIP)
name = name.split('.')[0]
r = re.compile('^[-a-zA-Z0-9]+$')
if r.match(name):
self.honeypot.hostname = name
self.honeypot.cwd = '/root'
if not self.fs.exists(self.honeypot.cwd):
self.honeypot.cwd = '/'
Expand Down