Closed cybiere closed 1 year ago
payload_gather.py module completes its execution and returns the whole results.
Sometimes, the module fails with a 'FileNotFoundError' exception in case of the .ssh folder does not exist.
$ ls -a
. .asoundrc .bash_logout .cache .dbus .dmrc Downloads .gksu.lock .gnupg .gtkrc-2.0 .lesshst Music .profile .python_history Templates .Xauthority
.. .bash_history .bashrc .config Desktop Documents .face .gnome .gtk-bookmarks .ICEauthority .local Pictures Public .sudo_as_admin_successful Videos .xsession-errors
[default]> endpoint add 192.168.1.169
Endpoint 192.168.1.169:22 added.
[default]> user add testuser
User testuser added.
[default]> creds add password testuser
Credentials #1 added.
[default]> probe
Probing 192.168.1.169:22 > OK: reached directly from local.
[default]> connect
Connecting to testuser:#1@192.168.1.169:22... OK
testuser:#1@192.168.1.169:22 is a new host: lite-lab
1/1 working.
[default]> set payload gather
payload => gather
[default](gather)> run
Connection to testuser:#1@192.168.1.169:22 already open. > OK
Starting gathering...
From SSH user config
From history files
-.python_history
From user keys
Traceback (most recent call last):
File "/home/skander/.local/lib/python3.10/site-packages/cmd2/cmd2.py", line 2399, in onecmd_plus_hooks
stop = self.onecmd(statement, add_to_history=add_to_history)
File "/home/skander/.local/lib/python3.10/site-packages/cmd2/cmd2.py", line 2852, in onecmd
stop = func(statement)
File "/home/skander/.local/lib/python3.10/site-packages/cmd2/decorators.py", line 382, in cmd_wrapper
return func(*args_list, **kwargs) # type: ignore[call-arg]
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/shell.py", line 991, in do_run
self.workspace.run(targets, payload, stmt, verbose=verbose)
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/workspace.py", line 602, in run
connection.run(payload, self.workspace_folder, stmt, verbose=verbose)
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/connection.py", line 466, in run
payload.run(self, current_workspace_directory, stmt)
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/ext_dir/payload_gather.py", line 69, in run
raise e
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/ext_dir/payload_gather.py", line 67, in run
g.gather()
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/ext_dir/payload_gather.py", line 85, in gather
self.gatherKeys()
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/ext_dir/payload_gather.py", line 259, in gatherKeys
filelist = self.sftp.listdir_attr(".ssh")
File "/usr/lib/python3/dist-packages/paramiko/sftp_client.py", line 239, in listdir_attr
t, msg = self._request(CMD_OPENDIR, path)
File "/usr/lib/python3/dist-packages/paramiko/sftp_client.py", line 822, in _request
return self._read_response(num)
File "/usr/lib/python3/dist-packages/paramiko/sftp_client.py", line 874, in _read_response
self._convert_status(msg)
File "/usr/lib/python3/dist-packages/paramiko/sftp_client.py", line 903, in _convert_status
raise IOError(errno.ENOENT, text)
FileNotFoundError: [Errno 2] No such file
EXCEPTION of type 'FileNotFoundError' occurred with message: [Errno 2] No such file
## Failure Logs
```python
File "/home/skander/.local/lib/python3.10/site-packages/cmd2/cmd2.py", line 2399, in onecmd_plus_hooks
stop = self.onecmd(statement, add_to_history=add_to_history)
File "/home/skander/.local/lib/python3.10/site-packages/cmd2/cmd2.py", line 2852, in onecmd
stop = func(statement)
File "/home/skander/.local/lib/python3.10/site-packages/cmd2/decorators.py", line 382, in cmd_wrapper
return func(*args_list, **kwargs) # type: ignore[call-arg]
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/shell.py", line 991, in do_run
self.workspace.run(targets, payload, stmt, verbose=verbose)
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/workspace.py", line 602, in run
connection.run(payload, self.workspace_folder, stmt, verbose=verbose)
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/connection.py", line 466, in run
payload.run(self, current_workspace_directory, stmt)
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/ext_dir/payload_gather.py", line 69, in run
raise e
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/ext_dir/payload_gather.py", line 67, in run
g.gather()
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/ext_dir/payload_gather.py", line 85, in gather
self.gatherKeys()
File "/home/skander/.local/lib/python3.10/site-packages/baboossh/ext_dir/payload_gather.py", line 259, in gatherKeys
filelist = self.sftp.listdir_attr(".ssh")
File "/usr/lib/python3/dist-packages/paramiko/sftp_client.py", line 239, in listdir_attr
t, msg = self._request(CMD_OPENDIR, path)
File "/usr/lib/python3/dist-packages/paramiko/sftp_client.py", line 822, in _request
return self._read_response(num)
File "/usr/lib/python3/dist-packages/paramiko/sftp_client.py", line 874, in _read_response
self._convert_status(msg)
File "/usr/lib/python3/dist-packages/paramiko/sftp_client.py", line 903, in _convert_status
raise IOError(errno.ENOENT, text)
FileNotFoundError: [Errno 2] No such file
EXCEPTION of type 'FileNotFoundError' occurred with message: [Errno 2] No such file
FileNotFoundError exception is raised but not handled