Library ssh1
Functions for the SSH-1 protocol. This module also contains functions for formatting key fingerprints.
Author:
Copyright © Same as Nmap--See https://nmap.org/book/man-legal.html
Source: https://svn.nmap.org/nmap/nselib/ssh1.lua
Functions
- check_packet_length (buffer)
Retrieve the size of the packet that is being received and checks if it is fully received
- fetch_host_key (host, port)
Fetch an SSH-1 host key.
- fingerprint_base64 (fingerprint, hash, algorithm, bits)
Format a key fingerprint in base64.
- fingerprint_bubblebabble (fingerprint, algorithm, bits)
Format a key fingerprint in Bubble Babble.
- fingerprint_hex (fingerprint, algorithm, bits)
Format a key fingerprint in hexadecimal.
- fingerprint_visual (fingerprint, algorithm, bits)
Format a key fingerprint into a visual ASCII art representation.
- receive_ssh_packet (socket)
Receives a complete SSH packet, even if fragmented
Functions
- check_packet_length (buffer)
-
Retrieve the size of the packet that is being received and checks if it is fully received
This function is very similar to the function generated with match.numbytes(num) function, except that this one will check for the number of bytes on-the-fly, based on the written on the SSH packet.
Parameters
- buffer
- The receive buffer
Return value:
packet_length, packet_length or nil the return is similar to the lua function string:find() - fetch_host_key (host, port)
-
Fetch an SSH-1 host key.
Parameters
- host
- Nmap host table.
- port
- Nmap port table.
Return value:
A table with the following fields:exp
,mod
,bits
,key_type
,fp_input
,full_key
,algorithm
, andfingerprint
. - fingerprint_base64 (fingerprint, hash, algorithm, bits)
-
Format a key fingerprint in base64.
Parameters
- fingerprint
- Key fingerprint.
- hash
- The hashing algorithm used
- algorithm
- Key algorithm.
- bits
- Key size in bits.
- fingerprint_bubblebabble (fingerprint, algorithm, bits)
-
Format a key fingerprint in Bubble Babble.
Parameters
- fingerprint
- Key fingerprint.
- algorithm
- Key algorithm.
- bits
- Key size in bits.
- fingerprint_hex (fingerprint, algorithm, bits)
-
Format a key fingerprint in hexadecimal.
Parameters
- fingerprint
- Key fingerprint.
- algorithm
- Key algorithm.
- bits
- Key size in bits.
- fingerprint_visual (fingerprint, algorithm, bits)
-
Format a key fingerprint into a visual ASCII art representation.
Ported from http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/usr.bin/ssh/key.c.
Parameters
- fingerprint
- Key fingerprint.
- algorithm
- Key algorithm.
- bits
- Key size in bits.
- receive_ssh_packet (socket)
-
Receives a complete SSH packet, even if fragmented
This function is an abstraction layer to deal with checking the packet size to know if there is any more data to receive.
Parameters
- socket
- The socket used to receive the data
Return values:
- status True or false
- packet The packet received