mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Add host key support for SSH1.
This commit is contained in:
parent
5e206ed108
commit
245bd07af7
3 changed files with 36 additions and 5 deletions
|
@ -186,11 +186,24 @@ event connection_state_remove(c: connection) &priority=-5
|
|||
Log::write(SSH::LOG, c$ssh);
|
||||
}
|
||||
|
||||
function generate_fingerprint(c: connection, key: string)
|
||||
{
|
||||
local lx = str_split(md5_hash(key), vector(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30));
|
||||
lx[0] = "";
|
||||
c$ssh$host_key = sub(join_string_vec(lx, ":"), /:/, "");
|
||||
}
|
||||
|
||||
event ssh1_server_host_key(c: connection, p: string, e: string)
|
||||
{
|
||||
if ( !c?$ssh )
|
||||
return;
|
||||
generate_fingerprint(c, e + p);
|
||||
}
|
||||
|
||||
event ssh_server_host_key(c: connection, key: string)
|
||||
{
|
||||
if ( !c?$ssh )
|
||||
return;
|
||||
local lx = str_split(md5_hash(key), vector(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30));
|
||||
lx[0] = "";
|
||||
c$ssh$host_key = sub(join_string_vec(lx, ":"), /:/, "");
|
||||
}
|
||||
generate_fingerprint(c, key);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue