Don't send banner if the banner file is not found (thanks mark)

git-svn-id: https://kippo.googlecode.com/svn/trunk@215 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
desaster
2012-03-03 05:15:08 +00:00
parent 8b336fbb96
commit 69b20c2282

View File

@ -534,7 +534,12 @@ class HoneyPotSSHUserAuthServer(userauth.SSHUserAuthServer):
cfg = config()
if not cfg.has_option('honeypot', 'banner_file'):
return
data = file(cfg.get('honeypot', 'banner_file')).read()
try:
data = file(cfg.get('honeypot', 'banner_file')).read()
except IOError:
print 'Banner file %s does not exist!' % \
cfg.get('honeypot', 'banner_file')
return
if not data or not len(data.strip()):
return
data = '\r\n'.join(data.splitlines() + [''])