Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

Create server_ssh.py

Abdul Wahab Junaid44116ebea559
diff --git a/Python Tools/SSH/AsyncSSH/server_ssh.py b/Python Tools/SSH/AsyncSSH/server_ssh.py
new file mode 100644
index 0000000..3469171
--- /dev/null
+++ b/Python Tools/SSH/AsyncSSH/server_ssh.py
@@ -0,0 +1,19 @@
+import asyncio, asyncssh, sys
+
+class MySSHServer(asyncssh.SSHServer):
+ def connection_made(self, conn):
+ print('SSH connection received from %s.' % conn.get_extra_info('peername')[0])
+
+async def start_server():
+ await asyncssh.create_server(MySSHServer, 'localhost', 22,
+ server_host_keys=['/etc/ssh/ssh_host_ecdsa_key'])
+
+loop = asyncio.get_event_loop()
+
+try:
+ print("Starting SSH server on localhost:22")
+ loop.run_until_complete(start_server())
+except (OSError, asyncssh.Error) as exc:
+ sys.exit('Error starting server: ' + str(exc))
+
+loop.run_forever()