Jul-23-2023, 04:42 PM
(This post was last modified: Jul-23-2023, 07:25 PM by Gribouillis.)
For the code snippet below , I am unable to trap error (as enumerated as tracebac)
hostF = "keys/id_rsa" HOST_KEY = paramiko.RSAKey(filename=hostF) transport = paramiko.Transport(client) transport.add_server_key(HOST_KEY) transport.local_version = "SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3" # this is the banner that goes out server = libServer.mySSH() try: [b] transport.start_server(server=server) # Trouble here for DOS attack. Error below arent captured[/b][color=#E74C3C][/color] channel = transport.accept(20) channel.send("Got Channel .. will try SSH connection \r\n") except Exception as e: print (e)transport.start_server(server=server) --> this triggers a traceback as enumertaed below when a plain socket connection attempt is made on paramiko SSH server listening port. This can be a raw potential DOS attack.
Error:Exception (server): Error reading SSH protocol banner
Traceback (most recent call last):
File "/home/uzi/.local/lib/python3.8/site-packages/paramiko/transport.py", line 2292, in _check_banner
buf = self.packetizer.readline(timeout)
File "/home/uzi/.local/lib/python3.8/site-packages/paramiko/packet.py", line 374, in readline
buf += self._read_timeout(timeout)
File "/home/uzi/.local/lib/python3.8/site-packages/paramiko/packet.py", line 603, in _read_timeout
raise EOFError()
EOFError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/uzi/.local/lib/python3.8/site-packages/paramiko/transport.py", line 2113, in run
self._check_banner()
File "/home/uzi/.local/lib/python3.8/site-packages/paramiko/transport.py", line 2296, in _check_banner
raise SSHException(
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner
Gribouillis write Jul-23-2023, 07:25 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.