@@ -328,10 +328,11 @@ struct ssh_init_packet : public base_protocol {
328328 struct datum comment_string ;
329329 ssh_binary_packet binary_pkt ;
330330 ssh_kex_init kex_pkt ;
331+ data_buffer < MAX_USER_AGENT_LEN > user_agent ;
331332
332333 static constexpr size_t max_data_size = 8192 ;
333334
334- ssh_init_packet (datum & p ) : protocol_string {NULL , NULL }, comment_string {NULL , NULL }, binary_pkt {}, kex_pkt {} {
335+ ssh_init_packet (datum & p ) : protocol_string {NULL , NULL }, comment_string {NULL , NULL }, binary_pkt {}, kex_pkt {}, user_agent {} {
335336 parse (p );
336337 }
337338
@@ -462,6 +463,24 @@ struct ssh_init_packet : public base_protocol {
462463 { 'S' , 'S' , 'H' , '-' , 0x00 , 0x00 , 0x00 , 0x00 }
463464 };
464465
466+ bool do_analysis (const struct key & k_ , struct analysis_context & analysis_ , classifier * c_ ) {
467+ if (!kex_pkt .is_not_empty ()) {
468+ return false;
469+ }
470+
471+ // concatenate protocol and comment strings for analysis
472+ datum tmp_protocol_str = protocol_string ;
473+ datum tmp_comment_str = comment_string ;
474+ user_agent .parse (tmp_protocol_str );
475+ user_agent .parse (tmp_comment_str );
476+
477+ analysis_ .destination .init ({nullptr , nullptr }, user_agent .contents (), {nullptr , nullptr }, k_ );
478+ if (c_ == nullptr ) {
479+ return false;
480+ }
481+ return c_ -> analyze_fingerprint_and_destination_context (analysis_ .fp , analysis_ .destination , analysis_ .result );
482+ }
483+
465484};
466485
467486[[maybe_unused ]] inline int ssh_init_packet_fuzz_test (const uint8_t * data , size_t size ) {
0 commit comments