Lua Netzwerk Connect: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Zeile 1: Zeile 1:
<syntaxhighlight lang="lua">
+
* '''vim openssh.lua'''
socket = require("socket")
 
tcp = assert(socket.tcp())
 
host = "127.0.0.1"
 
port = "22"
 
  
tcp:connect(host, port);
+
<syntaxhighlight lang="lua"> socket = require(“socket”) tcp = assert(socket.tcp()) host = “127.0.0.1” port = “22”
s, status, partial = tcp:receive()
 
print(s or partial)
 
status = tcp:send("SSH-2.0-OpenSSH_9.0\n");
 
print(status)
 
--s, status, partial = tcp:receive(1024)
 
--s, status, partial = tcp:receive('*a')
 
s, status, partial = tcp:receive(1036)
 
print(s or partial)
 
  
tcp:close()
+
tcp:connect(host, port); s, status, partial = tcp:receive() print(s or partial) status = tcp:send(“SSH-2.0-OpenSSH_9.0”); print(status) –s, status, partial = tcp:receive(1024) –s, status, partial = tcp:receive(’*a’) s, status, partial = tcp:receive(1036) print(s or partial)
</syntaxhighlight>
+
 
 +
tcp:close() </syntaxhighlight>
 +
 
 +
* holt sich die Version des OpenSSH-Servers auf dem Host
 +
* '''lua openssh.lua'''
 +
 
 +
SSH-2.0-OpenSSH_9.2
 +
20.0
 +
4l�q�:F�\@��o&amp;|\        sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha2569rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519lchacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.comlchacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com�umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1�umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1none,zlib@openssh.com

Version vom 6. März 2023, 13:56 Uhr

  • vim openssh.lua
 socket = require(socket) tcp = assert(socket.tcp()) host = 127.0.0.1 port = 22

tcp:connect(host, port); s, status, partial = tcp:receive() print(s or partial) status = tcp:send(SSH-2.0-OpenSSH_9.0); print(status) s, status, partial = tcp:receive(1024) s, status, partial = tcp:receive(*a) s, status, partial = tcp:receive(1036) print(s or partial)

tcp:close()
  • holt sich die Version des OpenSSH-Servers auf dem Host
  • lua openssh.lua
SSH-2.0-OpenSSH_9.2
20.0
4l�q�:F�\@��o&|\        sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha2569rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519lchacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.comlchacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com�umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1�umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1none,zlib@openssh.com