1 个不稳定版本

0.1.0 2021 年 1 月 5 日

#8 in #fingerprinting

BSD-3-ClauseLGPL-2.1-or-later

34KB
623

hassh - 用 Rust 编写的 SSH 指纹库

License: BSD 3-Clause License crates.io Build Status Documentation

此库允许用户对 SSH 握手的 密钥交换 部分进行指纹识别。它可以对 IPv4 和 IPv6 上的 SSH 握手进行哈希处理。它高度依赖于 Rusticata 的 ssh-parser 项目。

"HASSH" 是一个网络指纹识别标准,可以用来识别特定的客户端和服务器 SSH 实现。指纹可以以 MD5 指纹的形式轻松存储、搜索和共享。

有关更多信息,请参阅原始的 HASSH 项目。

示例

指纹识别数据包捕获文件的示例

use hassh::pcap;

for hassh in pcap::open("test.pcap")? {
    println!("{:x}", hassh.client_hash());
}

指纹识别实时捕获的示例

use hassh::live;

for hassh in live::capture("en0")? {
    println!("{:x}", hassh.server_hash());
}

有关更多信息,请参阅 hassh 示例。

$ cargo run --example hassh -- -i en0

[+] Client SSH_MSG_KEXINIT detected
    [ 192.168.1.8:57278 -> 192.168.1.31:22 ]
        [-] Identification String: SSH-2.0-OpenSSH_8.1
        [-] hassh: ec7378c1a92f5a8dde7e8b7a1ddf33d1
        [-] hassh Algorithms: curve25519-sha256,[email protected],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-sha256,diffie-hellman-group14-sha1,ext-info-c;[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected];[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1;none,[email protected],zlib

[+] Server SSH_MSG_KEXINIT detected
    [ 192.168.1.31:22 -> 192.168.1.8:57278 ]
        [-] Identification String: SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
        [-] hasshServer: 3ccd1778a76049721c71ad7d2bf62bbc
        [-] hasshServer Algorithms: curve25519-sha256,[email protected],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-sha256;[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected];[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1;none,[email protected]

C API 绑定

此库的 C API 绑定,您可以在编译时指定 capi 功能来生成头文件。

cargo build --features capi

参考

致谢

hassh 和 hasshServer 由 Salesforce 的检测云团队中的 Ben Reardon (@benreardon) 提出,并在 Adel Karimi (@0x4d31) 和 JA3 机组 的启发和贡献下开发:John B. AlthouseJeff AtkinsonJosh Atkins

依赖

~2.8–5.5MB
~101K SLoC