mirror of
https://github.com/aljazceru/cowrie.git
synced 2025-12-18 14:34:22 +01:00
Updated "shell prompt" (to give a Debian feel)
Looks more like Debian/Ubuntu (which is the default base OS). Check comments for CentOS version.
This commit is contained in:
@@ -137,10 +137,16 @@ class HoneyPotShell(object):
|
|||||||
self.runCommand()
|
self.runCommand()
|
||||||
|
|
||||||
def showPrompt(self):
|
def showPrompt(self):
|
||||||
|
# Example: nas3:~#
|
||||||
|
#prompt = '%s:%%(path)s' % self.honeypot.hostname
|
||||||
|
# Example: root@nas3:~# (More of a "Debianu" feel)
|
||||||
|
prompt = '%s@%s:%%(path)s' % (self.honeypot.user.username, self.honeypot.hostname,)
|
||||||
|
# Example: [root@nas3 ~]# (More of a "CentOS" feel)
|
||||||
|
#prompt = '[%s@%s %%(path)s]' % (self.honeypot.user.username, self.honeypot.hostname,)
|
||||||
if not self.honeypot.user.uid:
|
if not self.honeypot.user.uid:
|
||||||
prompt = '%s:%%(path)s# ' % self.honeypot.hostname
|
prompt += '# ' # "Root" user
|
||||||
else:
|
else:
|
||||||
prompt = '%s:%%(path)s$ ' % self.honeypot.hostname
|
prompt += '$ ' # "Non-Root" user
|
||||||
|
|
||||||
path = self.honeypot.cwd
|
path = self.honeypot.cwd
|
||||||
homelen = len(self.honeypot.user.home)
|
homelen = len(self.honeypot.user.home)
|
||||||
@@ -149,6 +155,11 @@ class HoneyPotShell(object):
|
|||||||
elif len(path) > (homelen+1) and \
|
elif len(path) > (homelen+1) and \
|
||||||
path[:(homelen+1)] == self.honeypot.user.home + '/':
|
path[:(homelen+1)] == self.honeypot.user.home + '/':
|
||||||
path = '~' + path[homelen:]
|
path = '~' + path[homelen:]
|
||||||
|
# Uncomment the three lines below for a 'better' CenOS look.
|
||||||
|
# Rather than '[root@nas3 /var/log]#' is shows '[root@nas3 log]#'.
|
||||||
|
#path = path.rsplit('/', 1)[-1]
|
||||||
|
#if not path:
|
||||||
|
# path = '/'
|
||||||
|
|
||||||
attrs = {'path': path}
|
attrs = {'path': path}
|
||||||
self.honeypot.terminal.write(prompt % attrs)
|
self.honeypot.terminal.write(prompt % attrs)
|
||||||
|
|||||||
Reference in New Issue
Block a user