Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise exception for missing hostname #89

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/attackmate/executors/ssh/sshexecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def connect_use_session(self, command: SSHCommand) -> SSHClient:
if self.jmp_hostname is not None:
jmp_sock = self.connect_jmphost(command)

if self.hostname is None:
raise ExecException('No hostname set for SSH-Connection')

kwargs = dict(
hostname=self.hostname,
port=self.port,
Expand Down Expand Up @@ -150,6 +153,8 @@ def _exec_cmd(self, command: SSHCommand) -> Result:
error = stderr.read().decode('utf-8', 'ignore')
except ValueError as e:
raise ExecException(e)
except AttributeError as e:
raise ExecException(e)
except BadHostKeyException as e:
raise ExecException(e)
except AuthenticationException as e:
Expand Down
Loading