From ac765acac75f89c28de0ecf1ae39a04891c91aec Mon Sep 17 00:00:00 2001 From: gitmopp Date: Wed, 13 May 2020 15:22:16 +0200 Subject: [PATCH] Fixed comment for shares with a new line character Fix compatibility with shares which have a \r\n in the comment --- smbmap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smbmap.py b/smbmap.py index 06186bb..0d9b1cf 100755 --- a/smbmap.py +++ b/smbmap.py @@ -863,12 +863,12 @@ def to_string(self, share_tree, host): if heads_up == False: print(header) heads_up = True - print('\t{}\t{}\t{}'.format(item.ljust(50), share_tree[item]['privs'], share_tree[item]['comment'] ) ) + print('\t{}\t{}\t{}'.format(item.ljust(50), share_tree[item]['privs'], share_tree[item]['comment'].replace('\r','').replace('\n', '') ) ) elif self.verbose and self.grepable == False and self.csv == False and not self.pattern: if heads_up == False: print(header) heads_up = True - print('\t{}\t{}\t{}'.format(item.ljust(50), share_tree[item]['privs'], share_tree[item]['comment'] ) ) + print('\t{}\t{}\t{}'.format(item.ljust(50), share_tree[item]['privs'], share_tree[item]['comment'].replace('\r','').replace('\n', '') ) ) for path in share_tree[item]['contents'].keys(): if self.grepable == False and self.csv == False and self.verbose: print('\t.\{}{}'.format(item, self.pathify(path)))