Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package sngrep for openSUSE:Factory checked in at 2023-04-09 18:41:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sngrep (Old) and /work/SRC/openSUSE:Factory/.sngrep.new.19717 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sngrep" Sun Apr 9 18:41:28 2023 rev:9 rq:1078156 version:1.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/sngrep/sngrep.changes 2022-09-23 14:16:01.538093444 +0200 +++ /work/SRC/openSUSE:Factory/.sngrep.new.19717/sngrep.changes 2023-04-09 18:43:25.994571617 +0200 @@ -1,0 +2,10 @@ +Sun Apr 2 14:45:08 UTC 2023 - Martin Hauke <[email protected]> + +- Update to version 1.7.0 + * save: add option --text to save captured data to plain text + * capture: fix memory overflows while parsing IP headers + * hep: fix hep listener enabled in offline mode + * core: stop sngrep when parent process has ended + * ssl: fix decrypt with AES256 GCM SHA384 cipher + +------------------------------------------------------------------- Old: ---- sngrep-1.6.0.tar.gz New: ---- sngrep-1.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sngrep.spec ++++++ --- /var/tmp/diff_new_pack.vokDZV/_old 2023-04-09 18:43:26.458574242 +0200 +++ /var/tmp/diff_new_pack.vokDZV/_new 2023-04-09 18:43:26.466574287 +0200 @@ -1,8 +1,8 @@ # # spec file for package sngrep # -# Copyright (c) 2022 SUSE LLC -# Copyright (c) 2018-2022, Martin Hauke <[email protected]> +# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2018-2023, Martin Hauke <[email protected]> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ Name: sngrep -Version: 1.6.0 +Version: 1.7.0 Release: 0 Summary: Ncurses SIP Messages flow viewer License: GPL-3.0-or-later ++++++ sngrep-1.6.0.tar.gz -> sngrep-1.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/ChangeLog new/sngrep-1.7.0/ChangeLog --- old/sngrep-1.6.0/ChangeLog 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/ChangeLog 2023-03-31 09:57:36.000000000 +0200 @@ -1,3 +1,12 @@ +2023-03-31 Ivan Alonso <[email protected]> + * sngrep 1.7.0 released + + * save: add option --text to save captured data to plain text + * capture: fix memory overflows while parsing IP headers + * hep: fix hep listener enabled in offline mode + * core: stop sngrep when parent process has ended + * ssl: fix decrypt with AES256 GCM SHA384 cipher + 2022-08-31 Ivan Alonso <[email protected]> * sngrep 1.6.0 released diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/configure.ac new/sngrep-1.7.0/configure.ac --- old/sngrep-1.6.0/configure.ac 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/configure.ac 2023-03-31 09:57:36.000000000 +0200 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([sngrep], [1.6.0], [[email protected]], [sngrep], [http://www.irontec.com/]) +AC_INIT([sngrep], [1.7.0], [[email protected]], [sngrep], [http://www.irontec.com/]) AM_INIT_AUTOMAKE([1.9]) AC_CONFIG_HEADERS([src/config.h]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/doc/sngrep.8 new/sngrep-1.7.0/doc/sngrep.8 --- old/sngrep-1.6.0/doc/sngrep.8 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/doc/sngrep.8 2023-03-31 09:57:36.000000000 +0200 @@ -3,7 +3,7 @@ .\" Copyright (c) 2013-2021 Ivan Alonso <[email protected]> .\" Copyright (c) 2013-2021 Irontec S.L. -.TH SNGREP 8 "May 2021" "sngrep 1.6.0" +.TH SNGREP 8 "Mar 2023" "sngrep 1.7.0" .SH NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/pkg/apk/APKBUILD new/sngrep-1.7.0/pkg/apk/APKBUILD --- old/sngrep-1.6.0/pkg/apk/APKBUILD 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/pkg/apk/APKBUILD 2023-03-31 09:57:36.000000000 +0200 @@ -1,7 +1,7 @@ # Contributor: Francesco Colista <[email protected]> # Maintainer: Francesco Colista <[email protected]> pkgname=sngrep -pkgver=1.6.0 +pkgver=1.7.0 pkgrel=0 pkgdesc="display SIP call message flows from a terminal" url="https://github.com/irontec/sngrep" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/pkg/debian/changelog new/sngrep-1.7.0/pkg/debian/changelog --- old/sngrep-1.6.0/pkg/debian/changelog 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/pkg/debian/changelog 2023-03-31 09:57:36.000000000 +0200 @@ -1,3 +1,9 @@ +sngrep (1.7.0) experimental; urgency=low + + * sngrep 1.7.0 released + + -- Ivan Alonso <[email protected]> Fri, 31 Mar 2023 09:55:37 +0200 + sngrep (1.6.0) experimental; urgency=low * sngrep 1.6.0 released diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/pkg/rpm/SPECS/sngrep.spec new/sngrep-1.7.0/pkg/rpm/SPECS/sngrep.spec --- old/sngrep-1.6.0/pkg/rpm/SPECS/sngrep.spec 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/pkg/rpm/SPECS/sngrep.spec 2023-03-31 09:57:36.000000000 +0200 @@ -2,7 +2,7 @@ Summary: SIP Messages flow viewer Name: sngrep -Version: 1.6.0 +Version: 1.7.0 Release: 0%{?dist} License: GPLv3 Group: Applications/Engineering @@ -59,6 +59,8 @@ %{__rm} -rf %{buildroot} %changelog +* Fri Mar 31 2023 Ivan Alonso <[email protected]> - 1.7.0 + - Version 1.7.0 * Wed Aug 31 2022 Ivan Alonso <[email protected]> - 1.6.0 - Version 1.6.0 * Tue Apr 26 2022 Ivan Alonso <[email protected]> - 1.5.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/src/capture.c new/sngrep-1.7.0/src/capture.c --- old/sngrep-1.6.0/src/capture.c 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/src/capture.c 2023-03-31 09:57:36.000000000 +0200 @@ -616,6 +616,19 @@ } } + // Check maximum capture len + if (*caplen > MAX_CAPTURE_LEN) + return NULL; + + // Check frame has at least IP header length + if (ip_ver == 4 && header->caplen < link_hl + sizeof(struct ip)) + return NULL; + +#ifdef USE_IPV6 + if (ip_ver == 6 && header->caplen < link_hl + sizeof(struct ip6_hdr)) + return NULL; +#endif + // If no fragmentation if (ip_frag == 0) { // Just create a new packet with given network data diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/src/capture_openssl.c new/sngrep-1.7.0/src/capture_openssl.c --- old/sngrep-1.6.0/src/capture_openssl.c 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/src/capture_openssl.c 2023-03-31 09:57:36.000000000 +0200 @@ -518,8 +518,8 @@ if (conn->client_cipher_ctx->cipher && conn->server_cipher_ctx->cipher) conn->encrypted = 1; #else - if (EVP_CIPHER_CTX_get_cipher_data(conn->client_cipher_ctx) && - EVP_CIPHER_CTX_get_cipher_data(conn->server_cipher_ctx)) + if (EVP_CIPHER_CTX_cipher(conn->client_cipher_ctx) && + EVP_CIPHER_CTX_cipher(conn->server_cipher_ctx)) conn->encrypted = 1; #endif break; @@ -738,6 +738,7 @@ EVP_CIPHER_CTX *evp; uint8_t pad; size_t flen = len; + uint8_t nonce[16] = { 0 }; tls_debug_print_hex("Ciphertext", fragment, len); @@ -747,19 +748,38 @@ evp = conn->server_cipher_ctx; } - // TLS 1.1 and later extract explicit IV - if (conn->version >= 2 && len > 16) { + if (conn->cipher_data.mode == MODE_CBC) { + // TLS 1.1 and later extract explicit IV + if (conn->version >= 2 && len > 16) { + if (conn->direction == 0) { + EVP_CipherInit(evp, conn->ciph, + conn->key_material.client_write_key, + fragment, 0); + } else { + EVP_CipherInit(evp, conn->ciph, + conn->key_material.server_write_key, + fragment, 0); + } + flen -= 16; + fragment += 16; + } + } + + if (conn->cipher_data.mode == MODE_GCM) { if (conn->direction == 0) { - EVP_CipherInit(evp, conn->ciph, - conn->key_material.client_write_key, - fragment, 0); + memcpy(nonce, conn->key_material.client_write_IV, conn->cipher_data.ivblock); + memcpy(nonce + conn->cipher_data.ivblock, fragment, 8); + nonce[15] = 2; + EVP_CipherInit(evp, conn->ciph,conn->key_material.client_write_key,nonce, 0); } else { - EVP_CipherInit(evp, conn->ciph, - conn->key_material.server_write_key, - fragment, 0); + memcpy(nonce, conn->key_material.server_write_IV, conn->cipher_data.ivblock); + memcpy(nonce + conn->cipher_data.ivblock, fragment, 8); + nonce[15] = 2; + EVP_CipherInit(evp, conn->ciph,conn->key_material.server_write_key,nonce, 0); } - flen -= 16; - fragment += 16; + + flen -= 8; + fragment += 8; } size_t dlen = len; @@ -767,17 +787,27 @@ EVP_Cipher(evp, decoded, (unsigned char *) fragment, flen); tls_debug_print_hex("Plaintext", decoded, flen); - // Get padding counter and remove from data - pad = decoded[flen - 1]; - dlen = flen - (pad + 1); - tls_debug_print_hex("Mac", decoded + (dlen - 20), 20); - - if ((int32_t)dlen > 0 && dlen <= *outl) { - memcpy(*out, decoded, dlen); - *outl = dlen - 20 /* Trailing MAC */; + if (conn->cipher_data.mode == MODE_CBC) { + // Get padding counter and remove from data + pad = decoded[flen - 1]; + dlen = flen - (pad + 1); + tls_debug_print_hex("Mac", decoded + (dlen - 20), 20); + + if ((int32_t) dlen > 0 && dlen <= *outl) { + memcpy(*out, decoded, dlen); + *outl = dlen - 20 /* Trailing MAC */; + } + } + + // Strip auth tag from decoded data + if (conn->cipher_data.mode == MODE_GCM) { + if ((int32_t)flen > 16) { + memcpy(*out, decoded, dlen); + *outl = flen - 16; + } } - // Clenaup decoded memory + // Cleanup decoded memory sng_free(decoded); return *outl; } @@ -802,7 +832,11 @@ conn->ciph = EVP_get_cipherbyname("AES128"); break; case ENC_AES256: - conn->ciph = EVP_get_cipherbyname("AES256"); + if (conn->cipher_data.mode == MODE_CBC) { + conn->ciph = EVP_get_cipherbyname("AES256"); + } else { + conn->ciph = EVP_get_cipherbyname("AES-256-CTR"); + } break; default: return 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/src/curses/ui_manager.c new/sngrep-1.7.0/src/curses/ui_manager.c --- old/sngrep-1.6.0/src/curses/ui_manager.c 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/src/curses/ui_manager.c 2023-03-31 09:57:36.000000000 +0200 @@ -26,9 +26,12 @@ * @brief Source of functions defined in ui_manager.h * */ +#include "config.h" + #include <ctype.h> #include <stdio.h> #include <string.h> +#include <strings.h> #include <math.h> #include <stdlib.h> #include <locale.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/src/curses/ui_save.c new/sngrep-1.7.0/src/curses/ui_save.c --- old/sngrep-1.6.0/src/curses/ui_save.c 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/src/curses/ui_save.c 2023-03-31 09:57:36.000000000 +0200 @@ -453,7 +453,7 @@ sprintf(fullfile, "%s%s", savepath, savefile); if (access(fullfile, R_OK) == 0) { - if (dialog_confirm("Overwrite confirmation", "Selected file already exits.\n Do you want to overwrite it?", "Yes,No") != 0) + if (dialog_confirm("Overwrite confirmation", "Selected file already exists.\n Do you want to overwrite it?", "Yes,No") != 0) return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/src/main.c new/sngrep-1.7.0/src/main.c --- old/sngrep-1.6.0/src/main.c 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/src/main.c 2023-03-31 09:57:36.000000000 +0200 @@ -36,6 +36,7 @@ #include "vector.h" #include "capture.h" #include "capture_eep.h" +#include "curses/ui_save.h" #ifdef WITH_GNUTLS #include "capture_gnutls.h" #endif @@ -76,6 +77,7 @@ " -D --dump-config\t Print active configuration settings and exit\n" " -f --config\t\t Read configuration from file\n" " -F --no-config\t Do not read configuration from default config file\n" + " -T --text\t Save pcap to text file\n" " -R --rotate\t\t Rotate calls when capture limit have been reached\n" #ifdef USE_EEP " -H --eep-send\t Homer sipcapture url (udp:X.X.X.X:XXXX)\n" @@ -128,7 +130,7 @@ main(int argc, char* argv[]) { int opt, idx, limit, only_calls, no_incomplete, pcap_buffer_size, i; - const char *device, *outfile; + const char *device, *outfile, *text_outfile = NULL; char bpf[512]; #if defined(WITH_GNUTLS) || defined(WITH_OPENSSL) const char *keyfile; @@ -161,6 +163,7 @@ { "rotate", no_argument, 0, 'R' }, { "config", required_argument, 0, 'f' }, { "no-config", no_argument, 0, 'F' }, + { "text", required_argument, 0, 'T' }, #ifdef USE_EEP { "eep-listen", required_argument, 0, 'L' }, { "eep-send", required_argument, 0, 'H' }, @@ -171,7 +174,7 @@ // Parse command line arguments that have high priority opterr = 0; - char *options = "hVd:I:O:B:pqtW:k:crl:ivNqDL:H:ERf:F"; + char *options = "hVd:I:O:B:pqtW:k:crl:ivNqDL:H:ERf:F:T"; while ((opt = getopt_long(argc, argv, options, long_options, &idx)) != -1) { switch (opt) { case 'h': @@ -226,6 +229,11 @@ case 'O': outfile = optarg; break; + case 'T': + text_outfile = optarg; + no_interface = 1; + setting_set_value(SETTING_CAPTURE_STORAGE, "none"); + break; case 'B': if(!(pcap_buffer_size = atoi(optarg))) { fprintf(stderr, "Invalid buffer size.\n"); @@ -353,13 +361,20 @@ capture_init(limit, rtp_capture, rotate, pcap_buffer_size); #ifdef USE_EEP + // Disable HEP listen when input files are specified in command line, otherwise online and offline packets + // will be mixed, and it will be confusing + if (vector_count(infiles) != 0) { + setting_set_value(SETTING_EEP_LISTEN, SETTING_OFF); + } + // Initialize EEP if enabled capture_eep_init(); #endif // If no device or files has been specified in command line, use default - if (capture_sources_count() == 0 && - vector_count(indevices) == 0 && vector_count(infiles) == 0) { + if (capture_sources_count() == 0 + && vector_count(indevices) == 0 + && vector_count(infiles) == 0) { token = strdup(device); token = strtok(token, ","); while (token) { @@ -383,6 +398,9 @@ return 1; } + + + if (outfile) { ino_t dump_inode; @@ -454,6 +472,32 @@ printf("\rDialog count: %d\n", sip_calls_count_unrotated()); } + + if (text_outfile) + { + vector_iter_t calls; + calls = sip_calls_iterator(); + + sip_call_t *call = NULL; + sip_msg_t *msg = NULL; + vector_iter_t msgs; + + FILE *f = NULL; + + if (!(f = fopen(text_outfile, "w"))) { + fprintf(stderr, "Couldn't open sip output file"); + return 0; + } + + while ((call = vector_iterator_next(&calls))) { + msgs = vector_iterator(call->msgs); + // Save SIP message content + while ((msg = vector_iterator_next(&msgs))) { + save_msg_txt(f, msg); + } + } + fclose(f); + } // Capture deinit capture_deinit(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/src/util.c new/sngrep-1.7.0/src/util.c --- old/sngrep-1.6.0/src/util.c 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/src/util.c 2023-03-31 09:57:36.000000000 +0200 @@ -65,6 +65,12 @@ exit(EXIT_FAILURE); if (signal(SIGQUIT, sigterm_handler) == SIG_ERR) exit(EXIT_FAILURE); + + // Handle SIGCONT signal, received when parent process has died and + // kernel requests us to continue running. This prevents running on + // dead ssh connections. + if (signal(SIGCONT, sigterm_handler) == SIG_ERR) + exit(EXIT_FAILURE); } bool was_sigterm_received(void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sngrep-1.6.0/tests/test_input.c new/sngrep-1.7.0/tests/test_input.c --- old/sngrep-1.6.0/tests/test_input.c 2022-08-31 16:02:22.000000000 +0200 +++ new/sngrep-1.7.0/tests/test_input.c 2023-03-31 09:57:36.000000000 +0200 @@ -25,6 +25,7 @@ * * Basic input injector for sngrep testing */ +#include "config.h" #include <unistd.h> #include <stdio.h>
