Skip to content

Commit

Permalink
Remove the sudo prompt message from the stdout stream when using sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
dhubbard committed Jul 24, 2013
1 parent e58a1d7 commit ba01265
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions sshmap/defaults.py
Expand Up @@ -57,3 +57,11 @@
"port": "6667", "port": "6667",
"use_ssl": False, "use_ssl": False,
} }

sudo_message = [
'We trust you have received the usual lecture from the local System',
'Administrator. It usually boils down to these three things:',
'#1) Respect the privacy of others.',
'#2) Think before you type.',
'#3) With great power comes great responsibility.'
]
3 changes: 2 additions & 1 deletion sshmap/sshmap.py
Expand Up @@ -391,7 +391,8 @@ def run_command(host, command="uname -a", username=None, password=None,
for el in result.err: for el in result.err:
if check_prompt: if check_prompt:
if password in el or 'assword:' in el or \ if password in el or 'assword:' in el or \
'[sudo] password' in el or el.strip() == '': '[sudo] password' in el or el.strip() == '' or \
el.strip() in defaults.sudo_message:
skip = True skip = True
else: else:
check_prompt = False check_prompt = False
Expand Down

0 comments on commit ba01265

Please sign in to comment.