agent-zero icon indicating copy to clipboard operation
agent-zero copied to clipboard

SSH issue

Open SpankulatorX opened this issue 1 year ago • 4 comments

Hi! First of all, just want to tell you great job! I am trying to use Agent Zero, but errors occur when it attempts to perform a task. Despite restarting the app several times, the error persists. I am running Arch Linux.

The error message indicates issues related to the SSH protocol when trying to install or use the Pygame library. Specifically, the error is: SSHException: Error reading SSH protocol banner. This error occurs repeatedly.

`Exception (client): Error reading SSH protocol banner Traceback (most recent call last): File "/home/darkstar/.local/lib/python3.11/site-packages/paramiko/transport.py", line 2327, in _check_banner buf = self.packetizer.readline(timeout) File "/home/darkstar/.local/lib/python3.11/site-packages/paramiko/packet.py", line 381, in readline buf += self._read_timeout(timeout) File "/home/darkstar/.local/lib/python3.11/site-packages/paramiko/packet.py", line 618, in _read_timeout raise EOFError() EOFError

During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/darkstar/.local/lib/python3.11/site-packages/paramiko/transport.py", line 2143, in run self._check_banner() File "/home/darkstar/.local/lib/python3.11/site-packages/paramiko/transport.py", line 2331, in _check_banner raise SSHException( paramiko.ssh_exception.SSHException: Error reading SSH protocol banner `

SpankulatorX avatar Jul 29 '24 05:07 SpankulatorX

I am getting similar SSH issue-


Initializing docker container agent-zero-exe for safe code execution...
Started container with ID: c13c667a801437155ee58c676ba07cb66d5d7151e613094202e8bca7e9d0ed1f
SSH Connection attempt 1...
SSH Connection attempt 2...

{
    "system_error": "Traceback (most recent call last):
  File "/home/ulap244/Work/GitHub/agent-zero-main/venv/lib/python3.10/site-packages/paramiko/client.py", line 805, in _auth
    self._transport.auth_password(username, password)
  File "/home/ulap244/Work/GitHub/agent-zero-main/venv/lib/python3.10/site-packages/paramiko/transport.py", line 1592, in auth_password
    raise SSHException("No existing session")
paramiko.ssh_exception.SSHException: No existing session
"
}

dipeshpaulsystango avatar Jul 29 '24 05:07 dipeshpaulsystango

I am getting similar SSH issue-


Initializing docker container agent-zero-exe for safe code execution...
Started container with ID: c13c667a801437155ee58c676ba07cb66d5d7151e613094202e8bca7e9d0ed1f
SSH Connection attempt 1...
SSH Connection attempt 2...

{
    "system_error": "Traceback (most recent call last):
  File "/home/ulap244/Work/GitHub/agent-zero-main/venv/lib/python3.10/site-packages/paramiko/client.py", line 805, in _auth
    self._transport.auth_password(username, password)
  File "/home/ulap244/Work/GitHub/agent-zero-main/venv/lib/python3.10/site-packages/paramiko/transport.py", line 1592, in auth_password
    raise SSHException("No existing session")
paramiko.ssh_exception.SSHException: No existing session
"
}

Well, I found the solution-

Open this file-

  1. python/helpers/shell_ssh.py
  2. Change below code-

In this file you need to to search def connect and here in you need to add allow_agent=False and look_for_keys=False

    def connect(self):
        # try 3 times with wait and then except
        errors = 0
        while True:
            try:
                self.client.connect(self.hostname, self.port, self.username, self.password)
                self.shell = self.client.invoke_shell(width=160, height=48)
               

to this-

    def connect(self):
        # try 3 times with wait and then except
        errors = 0
        while True:
            try:
                self.client.connect(self.hostname, self.port, self.username, self.password, allow_agent=False,
                                    look_for_keys=False)
                self.shell = self.client.invoke_shell(width=160, height=48)
               
``

dipeshpaulsystango avatar Jul 29 '24 05:07 dipeshpaulsystango

was this in plain shell or inside a visual studio terminal? I had similar issues where most of them disappear in the terminal windows of VS.

andkoma avatar Jul 29 '24 08:07 andkoma

@frdel this is the solution for the ssh connection. please add documentation or a check if the ~/.ss/id_rsa and connection is available when starting the docker and connecting to it via SSH.

tapestreamer avatar Sep 25 '24 10:09 tapestreamer