From 53a758a9f71e1e2c5d93097b423441b0fc791ee4 Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Fri, 6 Nov 2015 10:03:38 +0000 Subject: [PATCH] these still referenced protocol.env --- cowrie/commands/base.py | 2 +- cowrie/commands/curl.py | 6 +++--- cowrie/commands/gcc.py | 2 +- cowrie/commands/iptables.py | 6 +++--- cowrie/commands/last.py | 2 +- cowrie/commands/wget.py | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cowrie/commands/base.py b/cowrie/commands/base.py index 45b43ce..8c46541 100644 --- a/cowrie/commands/base.py +++ b/cowrie/commands/base.py @@ -226,7 +226,7 @@ class command_passwd(HoneyPotCommand): self.exit() return - userdb = UserDB(self.protocol.env.cfg) + userdb = UserDB(self.protocol.cfg) userdb.adduser(self.protocol.user.username, self.protocol.user.uid, self.passwd) diff --git a/cowrie/commands/curl.py b/cowrie/commands/curl.py index 61f7a93..f38a150 100644 --- a/cowrie/commands/curl.py +++ b/cowrie/commands/curl.py @@ -92,7 +92,7 @@ class command_curl(HoneyPotCommand): self.url = url self.limit_size = 0 - cfg = self.protocol.env.cfg + cfg = self.protocol.cfg if cfg.has_option('honeypot', 'download_limit_size'): self.limit_size = int(cfg.get('honeypot', 'download_limit_size')) @@ -128,8 +128,8 @@ class command_curl(HoneyPotCommand): factory = HTTPProgressDownloader( self, fakeoutfile, url, outputfile, *args, **kwargs) out_addr = None - if self.protocol.env.cfg.has_option('honeypot', 'out_addr'): - out_addr = (self.protocol.env.cfg.get('honeypot', 'out_addr'), 0) + if self.protocol.cfg.has_option('honeypot', 'out_addr'): + out_addr = (self.protocol.cfg.get('honeypot', 'out_addr'), 0) if scheme == 'https': contextFactory = ssl.ClientContextFactory() diff --git a/cowrie/commands/gcc.py b/cowrie/commands/gcc.py index d90c428..21596fa 100644 --- a/cowrie/commands/gcc.py +++ b/cowrie/commands/gcc.py @@ -165,7 +165,7 @@ gcc version %s (Debian %s-5)""" % (version, version_short, version_short, versio data = "" # TODO: make sure it is written to temp file, not downloads safeoutfile = '%s/%s_%s' % \ - (self.protocol.env.cfg.get('honeypot', 'download_path'), + (self.protocol.cfg.get('honeypot', 'download_path'), time.strftime('%Y%m%d%H%M%S'), re.sub('[^A-Za-z0-9]', '_', outfile)) diff --git a/cowrie/commands/iptables.py b/cowrie/commands/iptables.py index ad106e7..9e8288b 100644 --- a/cowrie/commands/iptables.py +++ b/cowrie/commands/iptables.py @@ -155,8 +155,8 @@ class command_iptables(HoneyPotCommand): """ # Create fresh tables on start - if not hasattr(self.protocol.env, 'iptables'): - setattr(self.protocol.env, 'iptables', { + if not hasattr(self.protocol.user.server, 'iptables'): + setattr(self.protocol.user.server, 'iptables', { "raw": { "PREROUTING": [], "OUTPUT": [] @@ -183,7 +183,7 @@ class command_iptables(HoneyPotCommand): }) # Get the tables - self.tables = getattr(self.protocol.env, 'iptables') + self.tables = getattr(self.protocol.user.server, 'iptables') # Verify selected table if not self.is_valid_table(table): diff --git a/cowrie/commands/last.py b/cowrie/commands/last.py index 893c2b8..3425d8f 100644 --- a/cowrie/commands/last.py +++ b/cowrie/commands/last.py @@ -9,7 +9,7 @@ commands = {} class command_last(HoneyPotCommand): def call(self): - fn = '%s/lastlog.txt' % self.protocol.env.cfg.get('honeypot', 'data_path') + fn = '%s/lastlog.txt' % self.protocol.cfg.get('honeypot', 'data_path') if not os.path.exists(fn): return l = list(self.args) diff --git a/cowrie/commands/wget.py b/cowrie/commands/wget.py index 72958c8..a7b70ae 100644 --- a/cowrie/commands/wget.py +++ b/cowrie/commands/wget.py @@ -95,7 +95,7 @@ class command_wget(HoneyPotCommand): self.url = url self.limit_size = 0 - cfg = self.protocol.env.cfg + cfg = self.protocol.cfg if cfg.has_option('honeypot', 'download_limit_size'): self.limit_size = int(cfg.get('honeypot', 'download_limit_size')) @@ -132,8 +132,8 @@ class command_wget(HoneyPotCommand): factory = HTTPProgressDownloader( self, fakeoutfile, url, outputfile, *args, **kwargs) out_addr = None - if self.protocol.env.cfg.has_option('honeypot', 'out_addr'): - out_addr = (self.protocol.env.cfg.get('honeypot', 'out_addr'), 0) + if self.protocol.cfg.has_option('honeypot', 'out_addr'): + out_addr = (self.protocol.cfg.get('honeypot', 'out_addr'), 0) if scheme == 'https': contextFactory = ssl.ClientContextFactory()