@@ -412,22 +412,6 @@ void decode_http_version(wmem_strbuf_t **out, const char *val) {
412412 }
413413}
414414
415- char * wmem_list_to_str (wmem_allocator_t * scope , wmem_list_t * l ) {
416- wmem_strbuf_t * temp = wmem_strbuf_new (scope , "" );
417- wmem_list_frame_t * curr_entry = wmem_list_head (l );
418- while (curr_entry && wmem_list_frame_next (curr_entry )) {
419- wmem_strbuf_append_printf (
420- temp , "%04x," , GPOINTER_TO_UINT (wmem_list_frame_data (curr_entry ))
421- );
422- curr_entry = wmem_list_frame_next (curr_entry );
423- }
424-
425- if (curr_entry != NULL ) {
426- wmem_strbuf_append_printf (temp , "%04x" , GPOINTER_TO_UINT (wmem_list_frame_data (curr_entry )));
427- }
428- return (char * )wmem_strbuf_get_str (temp );
429- }
430-
431415void create_sorted_cookies (wmem_strbuf_t * * fields , wmem_strbuf_t * * values , wmem_list_t * l ) {
432416 wmem_list_frame_t * curr_entry = wmem_list_head (l );
433417 http_cookie_t * curr_cookie = NULL ;
@@ -450,73 +434,6 @@ void create_sorted_cookies(wmem_strbuf_t **fields, wmem_strbuf_t **values, wmem_
450434 );
451435}
452436
453- char * ja4 (ja4_info_t * data ) {
454- wmem_strbuf_t * display = wmem_strbuf_new (wmem_file_scope (), "" );
455- gchar * cipher_hash = g_compute_checksum_for_string (
456- G_CHECKSUM_SHA256 , wmem_list_to_str (wmem_file_scope (), data -> sorted_ciphers ), -1
457- );
458-
459- wmem_strbuf_t * temp = wmem_strbuf_new (wmem_file_scope (), "" );
460- wmem_strbuf_append_printf (temp , "%s" , wmem_list_to_str (wmem_file_scope (), data -> sorted_extensions ));
461- if (wmem_strbuf_get_len (data -> signatures ) > 0 ) {
462- wmem_strbuf_append_printf (temp , "_%s" , wmem_strbuf_get_str (data -> signatures ));
463- }
464- gchar * ext_hash =
465- g_compute_checksum_for_string (G_CHECKSUM_SHA256 , wmem_strbuf_get_str (temp ), -1 );
466-
467- wmem_strbuf_append_printf (
468- display , "%c%s%c%02d%02d%c%c_%12.12s_%12.12s" , data -> proto ,
469- val_to_str_const (data -> version , ssl_versions , "00" ), (data -> sni ? 'd' : 'i' ),
470- data -> cipher_len , data -> ext_len ,
471- (wmem_strbuf_get_len (data -> alpn ) > 0 ) ? wmem_strbuf_get_str (data -> alpn )[0 ] : '0' ,
472- (wmem_strbuf_get_len (data -> alpn ) > 0 )
473- ? wmem_strbuf_get_str (data -> alpn )[wmem_strbuf_get_len (data -> alpn ) - 1 ]
474- : '0' ,
475- cipher_hash , wmem_strbuf_get_len (temp ) ? ext_hash : "000000000000"
476- );
477- if (cipher_hash != NULL )
478- g_free (cipher_hash );
479- if (ext_hash != NULL )
480- g_free (ext_hash );
481- return (char * )wmem_strbuf_get_str (display );
482- }
483-
484- char * ja4_r (ja4_info_t * data ) {
485- wmem_strbuf_t * display = wmem_strbuf_new (wmem_file_scope (), "" );
486- wmem_strbuf_append_printf (
487- display , "%c%s%c%02d%02d%c%c_%s_%s" , data -> proto ,
488- val_to_str_const (data -> version , ssl_versions , "00" ), (data -> sni ? 'd' : 'i' ),
489- data -> cipher_len , data -> ext_len ,
490- (wmem_strbuf_get_len (data -> alpn ) > 0 ) ? wmem_strbuf_get_str (data -> alpn )[0 ] : '0' ,
491- (wmem_strbuf_get_len (data -> alpn ) > 0 )
492- ? wmem_strbuf_get_str (data -> alpn )[wmem_strbuf_get_len (data -> alpn ) - 1 ]
493- : '0' ,
494- wmem_list_to_str (wmem_file_scope (), data -> sorted_ciphers ), wmem_list_to_str (wmem_file_scope (), data -> sorted_extensions )
495- );
496- if (wmem_strbuf_get_len (data -> signatures ) > 0 ) {
497- wmem_strbuf_append_printf (display , "_%s" , wmem_strbuf_get_str (data -> signatures ));
498- }
499- return (char * )wmem_strbuf_get_str (display );
500- }
501-
502- char * ja4_ro (ja4_info_t * data ) {
503- wmem_strbuf_t * display = wmem_strbuf_new (wmem_file_scope (), "" );
504- wmem_strbuf_append_printf (
505- display , "%c%s%c%02d%02d%c%c_%s_%s" , data -> proto ,
506- val_to_str_const (data -> version , ssl_versions , "00" ), (data -> sni ? 'd' : 'i' ),
507- data -> cipher_len , data -> ext_len ,
508- (wmem_strbuf_get_len (data -> alpn ) > 0 ) ? wmem_strbuf_get_str (data -> alpn )[0 ] : '0' ,
509- (wmem_strbuf_get_len (data -> alpn ) > 0 )
510- ? wmem_strbuf_get_str (data -> alpn )[wmem_strbuf_get_len (data -> alpn ) - 1 ]
511- : '0' ,
512- wmem_strbuf_get_str (data -> ciphers ), wmem_strbuf_get_str (data -> extensions )
513- );
514- if (wmem_strbuf_get_len (data -> signatures ) > 0 ) {
515- wmem_strbuf_append_printf (display , "_%s" , wmem_strbuf_get_str (data -> signatures ));
516- }
517- return (char * )wmem_strbuf_get_str (display );
518- }
519-
520437char * ja4s_r (ja4_info_t * data ) {
521438 wmem_strbuf_t * display = wmem_strbuf_new (wmem_file_scope (), "" );
522439 wmem_strbuf_append_printf (
0 commit comments