Upgrading to GitLab 12.0.2.

Commit 3742b9db authored by Victor Seva's avatar Victor Seva

Imported Upstream version 0.3.0

parents
# Ignore eclipse files
.*project
.settings
# Build files
src/sngrep
src/*.o
src/.deps
src/config.h*
src/stamp-h1
.autotools
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.log
config.status
config.sub
config.guess
configure
missing
install-sh
depcomp
# Ignore Doxygen generated files
doc/html
language: c
compiler:
- clang
- gcc
notifications:
recipients:
- kaian@irontec.com
before_script:
- sudo apt-get update
install:
- sudo apt-get install -y libncurses5-dev libpcap-dev libssl-dev
script:
- ./bootstrap.sh
- ./configure
- make
branches:
only:
- master
Ivan Alonso (aka Kaian) First version of all files
This diff is collapsed.
2015-03-02 Ivan Alonso <kaian@irontec.com>
* sngrep 0.3.0 released
* Added command line option -c to only display calls
* Added command line option -l to change capture limit
* Added command line match expression for packet payload
* Converted all filters to regular expressions (POSIX or PCRE)
* Added optional PCRE support (Perl Compatible Regular Expressions)
* Added optional UTF-8 / Unicode compatible terminals support
* Added current displayed and total dialogs counters in Call list
* Added an option to save displayed dialogs (after filtering)
* Added an option to save current columns layout
* Added new attributes:
- sipfromuser: User in From: Header
- siptouser: User in To: header
- convdur: Total conversation duration (from 200 to BYE)
- totaldur: Total call duration (from first to last message)
* Interface will now be displayed while pcaps are loading
* Reworked Interface refresh process
* Reworked Filtering process
* Fixed general performance issues
* Disable OpenSSL support by default
* Removed command line option to read pcap without flags
* Added long versions of command line flags
2015-02-09 Ivan Alonso <kaian@irontec.com>
* sngrep 0.2.2 released
* Added a new panel to configure Call List columns during runtime
(static configuration can still be done using sngreprc file)
* Added a configuration option to change selected message
highlight in Call Flow (bold is not properly displayed in some terminals)
* Fixed message retransmission detection (-->>>)
* Fixed some drawing issues on small screens
* Fixed a crash when capturing while saving pcap dialog was being displayed
* Fixed a bug that considered ACK as a response instead of a request
* Fixed Call state for REJECTED calls
* Fixed Colors for monochrome terminals
* Changed default column width for SIP To/From to 30 characters
* Other minor fixes
2015-01-22 Ivan Alonso <kaian@irontec.com>
* sngrep 0.2.1 released
* Added SIP message color syntax options
* Improved Call Flow refreshing logic
* Fixed multiple locking problems with UI
* Respect terminals colors (can be overridden with background dark option)
* Improve offline pcap file reading to respect capture limit option
* Swapped some keybindings
* Multiple minor fixes and code refactoring
2014-12-04 Ivan Alonso <kaian@irontec.com>
* sngrep 0.2.0 released
* Added Initial TLS Support (No compression, AES)
* Added an option to resolve IP addresses
* Added a new panel to compare two SIP messages
* Fixed multiples memory leaks
2014-10-21 Ivan Alonso <kaian@irontec.com>
* sngrep 0.1.0 released
* Remove ngrep compatibility. Force libpcap during compilation
* Added TCP support
* Allow saving selected dialogs into pcap
* New UI design to maximize screen usage
* Added a serach box in Call List window
* Added Funtion Keys keybindings
* Added command line arguments
* Fixed some memory bugs
2013-04-22 Ivan Alonso <kaian@irontec.com>
* sngrep 0.0-alpha released.
* Initial version, code is just a mere stub with global variables, without
sanity checks... expect the worst.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* ====================================================================
* Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
SUBDIRS=src config doc
EXTRA_DIST=bootstrap.sh
README.md
\ No newline at end of file
# sngrep [![Build Status](https://travis-ci.org/irontec/sngrep.svg)](https://travis-ci.org/irontec/sngrep)
sngrep is a tool for displaying SIP calls message flows from terminal.
It supports live capture to display realtime SIP packets and can also be used
as PCAP viewer.
[Some screenshots of sngrep](https://github.com/irontec/sngrep/wiki/Screenshots)
## Installing
# Building from sources
Prerequisites
- libncurse5 - for UI, windows, panels.
- libpcap - for capturing packets.
- libssl - (optional) for TLS transport decrypt
- libncursesw5 - (optional) for UI, windows, panels (wide-character support)
- libpcre - (optional) for Perl Compatible regular expressions
On most systems the commands to build will be the standard autotools procedure:
./bootstrap.sh
./configure
make
make install (as root)
You can pass following flags to ./configure to enable some features
- --with-openssl : Adds OpenSSL support, allows sngrep to parse TLS captured messages (requires libssl)
- --with-pcre: Adds Perl Compatible regular expressions support in regexp fields
- --enable-unicode : Adds Ncurses wide-character support, for UTF-8 terminals (requires libncursesw5)
You can find [detailed instructions for some distributions] (https://github.com/irontec/sngrep/wiki/Building) on wiki.
# Binaries
OSX users can install sngrep using [homebrew](https://github.com/Homebrew/homebrew)
brew install sngrep
## Usage
See `--help` for a list of available flags and their syntax
For example, sngrep can be used to view SIP packets from a pcap file, also applying filters
sngrep -I file.pcap host 192.168.1.1 and port 5060
or live capturing, saving packets to a new file
sngrep -d eth0 -O save.pcap port 5060 and udp
You can configure some options using `sngreprc` file
## Frequent Asked Questions
See FAQ on [Github Wiki](https://github.com/irontec/sngrep/wiki#frequent-asked-questions)
## License
sngrep - SIP Messages flow viewer
Copyright (C) 2013,2014 Irontec S.L.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
In addition, as a special exception, the copyright holders give
permission to link the code of portions of this program with the
OpenSSL library under certain conditions as described in each
individual source file, and distribute linked combinations
including the two.
You must obey the GNU General Public License in all respects
for all of the code used other than OpenSSL. If you modify
file(s) with this exception, you may extend this exception to your
version of the file(s), but you are not obligated to do so. If you
do not wish to do so, delete this exception statement from your
version. If you delete this exception statement from all source
files in the program, then also delete it here.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
ToDo List
=========
sip:
* Change parsing functions for something more efficient (osip2?)
Parsing with sscanf is not the best way, but the simplest. If
we require to parse more headers in the future, it will start
to be worse and worse
* Improve the way payload is stored
Payload is included two times. One in the msg->payload pointer
and also in msg->pcap_packet content. This doubles the required
memory.
ui:
* Change panels initialization
Right now, all panels are initializated at the same, because
each panel can only be invoked once (it is not possible to have
two call details panel right now)
* Show call duration
It would be great to show this two columns on main screean.
First one can be calculated from the difference between first
and last messages timestamps.
* Change List columns in runtime
Sometimes its useful to filter the list for some column that is
not being displayed (like time, transport, ...), so it would be
nice to allow choosing the columns during runtime
#!/bin/sh
check_for_app() {
$1 --version 2>&1 >/dev/null
if [ $? != 0 ]
then
echo "Please install $1 and run bootstrap.sh again!"
exit 1
fi
}
# On FreeBSD and OpenBSD, multiple autoconf/automake versions have different names.
# On Linux, environment variables tell which one to use.
case `uname -sr` in
'FreeBSD 4'*) # FreeBSD 4.x has a different naming
MY_AC_VER=259
MY_AM_VER=19
;;
OpenBSD*)
export AUTOCONF_VERSION=2.63
export AUTOMAKE_VERSION=1.9
;;
*'BSD'*)
MY_AC_VER=-2.62
MY_AM_VER=-1.9
;;
*'SunOS '*)
MY_AC_VER=
MY_AM_VER=-1.9
;;
*)
MY_AC_VER=
MY_AM_VER=
AUTOCONF_VERSION=2.60
AUTOMAKE_VERSION=1.9
export AUTOCONF_VERSION
export AUTOMAKE_VERSION
;;
esac
check_for_app autoconf${MY_AC_VER}
check_for_app autoheader${MY_AC_VER}
check_for_app automake${MY_AM_VER}
check_for_app aclocal${MY_AM_VER}
echo "Generating the configure script ..."
aclocal${MY_AM_VER}
autoconf${MY_AC_VER}
autoheader${MY_AC_VER}
automake${MY_AM_VER} --add-missing --copy 2>/dev/null
exit 0
sysconfdir=@sysconfdir@
sysconf_DATA=sngreprc
##-----------------------------------------------------------------------------
## sngreprc - sngrep configuration file
##-----------------------------------------------------------------------------
## This file stores sngrep configuration and it's totally optional
##
##-----------------------------------------------------------------------------
## Enable color on or off
# set color on
## Use white/black as foreground/background instead of terminal defaults
# set background dark
## Disable syntax highlighting
# set syntax off
## Or enable branch/tag highlighting
# set syntax.tag on
# set syntax.branch on
##-----------------------------------------------------------------------------
## Uncomment to configure packet count capture limit (can't be disabled)
# set capture.limit 50000
## Default capture keyfile for TLS transport
# set capture.keyfile /etc/ssl/key.pem
## Uncommnet to lookup hostnames from packets ips
# set capture.lookup on
## Set default capture device
# set capture.device any
## Set default dump file
# set capture.outfile /tmp/last_capture.pcap
##-----------------------------------------------------------------------------
## Default path in save dialog
# set sngrep.savepath /tmp/sngrep-captures
##-----------------------------------------------------------------------------
## Change default scrolling in call list
# set cl.scrollstep 20
## Disable exit prompt
# set cl.noexitprompt off
## Or set its default button
# set cl.defexitbutton 0/1
# Set default filter on startup
# set cl.filter INVITE
##-----------------------------------------------------------------------------
## You can change the default number of columns in call list
##
## Set displayed columns in call list screen
## set cl.column{num} {field}
##
## You can optionally configure the column width using
## set cl.column{num}.width {num}
##
## Available columns fields are:
## - sipfrom
## - sipfromuser
## - sipto
## - siptouser
## - src
## - srchost
## - dst
## - dsthost
## - callid
## - xcallid
## - date
## - time
## - msgcnt
## - transport
## - state
## - convdur
## - totaldur
##
## Examples:
# set cl.column0 sipfrom
# set cl.column0.width 30
# set cl.column1 sipto
# set cl.column2 msgcnt
# set cl.column3 src
# set cl.column4 dst
# set cl.column4.width 22
# set cl.column5 starting
# set cl.column5.width 15
# set cl.column6 state
##-----------------------------------------------------------------------------
## Default minimun size from Message payload in Call Flow panel
# set cf.rawminwidth 40
## Fixed raw preview size
# set cf.rawfixedwidth 40
## Set selected highlight mode in call flow (bold, reverse or reversebold)
# set cf.highlight reverse
##-----------------------------------------------------------------------------
## Uncomment to display dialogs that does not start with a request method
# set sip.ignoreincomplete off
##-----------------------------------------------------------------------------
## You can ignore some calls with any of the previous attributes with a given
## value with ignore directive.
##
## ignore {field} {value}
##
## Examples:
# ignore method OPTIONS
# ignore method REGISTER
# ignore method BYE
# ignore srchost 192.168.1.1
# ignore transport TCP
AC_PREREQ([2.59])
AC_INIT([sngrep], [0.3.0], [kaian@irontec.com], [sngrep], [http://www.irontec.com/])
AM_INIT_AUTOMAKE([1.9])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_HEADERS([src/config.h])
AC_COPYRIGHT("Irontec S.L.")
# Define _GNU_SOURCE etc.
m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [AC_USE_SYSTEM_EXTENSIONS])
# debug compilation
AC_ARG_ENABLE(debug,
AC_HELP_STRING(--enable-debug, [Debug compilation (Default = no)]),
enable_debug=$enableval, enable_debug=no)
if test "$enable_debug" = "yes" ; then
CFLAGS="$CFLAGS -g -O0 -Wall -Werror -Wno-unused-but-set-variable -pg"
CXXFLAGS="$CXXFLAGS $CFLAGS"
fi
# Minimum checks for a C program :)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_EGREP
AC_LANG(C)
#######################################################################
# Check for other REQUIRED libraries
AC_CHECK_HEADER([ncurses.h], [], [
AC_MSG_ERROR([ You need to have ncurses development files installed to compile sngrep.])
])
AC_CHECK_LIB([pthread], [pthread_create], [], [
AC_MSG_ERROR([ You need to have libpthread installed to compile sngrep.])
])
AC_CHECK_LIB([pcap], [pcap_open_offline], [], [
AC_MSG_ERROR([ You need to have libpcap installed to compile sngrep.])
])
AC_CHECK_HEADER([pcap.h], [], [
AC_MSG_ERROR([ You need to have libpcap development files installed to compile sngrep.])
])
####
#### Ncurses Wide character support
####
AC_ARG_ENABLE([unicode],
AC_HELP_STRING([--enable-unicode], [Enable Ncurses Unicode support]),
[AC_SUBST(UNICODE, $enableval)],
[AC_SUBST(UNICODE, no)]
)
AS_IF([test "x$enable_unicode" == "xyes"], [
# Ncurses with wide-character support
AC_DEFINE([WITH_UNICODE], [], [Compile With Unicode compatibility])
AC_CHECK_LIB([ncursesw], [initscr], [], [
AC_MSG_ERROR([ You need to have libncursesw installed to compile sngrep.])
])
AC_CHECK_LIB([panelw], [new_panel], [], [
AC_MSG_ERROR([ You need to have ncurses panelw library installed to compile sngrep.])
])
AC_CHECK_LIB([formw], [new_form], [], [
AC_MSG_ERROR([ You need to have ncurses formsw library installed to compile sngrep.])
])
AC_CHECK_LIB([menuw], [new_item], [], [
AC_MSG_ERROR([ You need to have ncurses menuw library installed to compile sngrep.])
])
], [
# Ncurses without wide-character support
AC_CHECK_LIB([ncurses], [initscr], [], [
AC_MSG_ERROR([ You need to have libncurses installed to compile sngrep.])
])
AC_CHECK_LIB([panel], [new_panel], [], [
AC_MSG_ERROR([ You need to have ncurses panel library installed to compile sngrep.])
])
AC_CHECK_LIB([form], [new_form], [], [
AC_MSG_ERROR([ You need to have ncurses forms library installed to compile sngrep.])
])
AC_CHECK_LIB([menu], [new_item], [], [
AC_MSG_ERROR([ You need to have ncurses menu library installed to compile sngrep.])
])
])
####
#### OpenSSL Support
####
AC_ARG_WITH([openssl],
AS_HELP_STRING([--with-openssl], [Enable SSL Support (TLS SIP Transport)]),
[AC_SUBST(WITH_OPENSSL, $withval)],
[AC_SUBST(WITH_OPENSSL, no)]
)
# Check for SSL dependencies
AS_IF([test "x$WITH_OPENSSL" == "xno"], [
AC_ARG_ENABLE([openssl],
AC_HELP_STRING([--enable-openssl], [Enable SSL Support (TLS SIP Transport)]),
[AC_SUBST(WITH_OPENSSL, $enableval)],
[AC_SUBST(WITH_OPENSSL, no)]
)
], [])
AS_IF([test "x$WITH_OPENSSL" == "xyes"], [
AC_CHECK_LIB([ssl], [SSL_new], [], [
AC_MSG_ERROR([ You need to have libssl installed to compile sngrep])
])
AC_CHECK_LIB([crypto], [EVP_get_cipherbyname], [], [
AC_MSG_ERROR([ You need to have libcrypto installed to compile sngrep])
])
AC_DEFINE([WITH_OPENSSL],[],[Compile With Openssl compatibility])
], [])
####
#### PCRE Support
####
AC_ARG_WITH([pcre],
AS_HELP_STRING([--with-pcre], [Enable Perl compatible regular expressions]),
[AC_SUBST(WITH_PCRE, $withval)],
[AC_SUBST(WITH_PCRE, no)]
)
AS_IF([test "x$WITH_PCRE" == "xyes"], [
AC_CHECK_HEADER([pcre.h], [], [
AC_MSG_ERROR([ You need libpcre development files installed to compile with pcre support.])
])
AC_CHECK_LIB([pcre], [pcre_exec], [], [
AC_MSG_ERROR([ You need libpcre library installed to compile with pcre support.])
])
AC_DEFINE([WITH_PCRE],[],[Compile With Perl Compatible regular expressions support])
], [])
# Conditional Source inclusion
AM_CONDITIONAL([WITH_OPENSSL], [test "x$WITH_OPENSSL" == "xyes"])
######################################################################
if test "x${silent}" != "xyes" ; then
echo
echo ' OZZZO '
echo ' OZZZO '
echo ' .: OZZZO :. '
echo ' :DDD. OZZZO DDD~ '
echo ' :DDDDD. OZZZO DDDDD: '
echo ' DDDDDDD. OZZZO DDDDDDD. '
echo ' .DDDDDD OZZZO .DDDDDD. '
echo ' ODDDD?. OZZZO .~DDDDZ. '
echo ' DDDDD. OZZZO 8DDDD '
echo ' ,DDDD. ..... DDDD, '
echo ' ~DDDD DDDD+ '
echo ' :DDDD. DDDD, '
echo ' DDDDD 8DDDD. '
echo ' ODDDD? ~DDDDZ '
echo ' .DDDDDD. .DDDDDD. '
echo ' .DDDDDD8. .8DDDDDD '
echo ' .:DDDDDDDDDDDDDDDDDDD:. '
echo ' .~DDDDDDDDDDDDDDD~. '
echo ' .:DDDDDDDDD,. '
echo
fi
AC_MSG_NOTICE
AC_MSG_NOTICE( sngrep configure finished )
AC_MSG_NOTICE( ====================================================== )
AC_MSG_NOTICE( OpenSSL Support : ${WITH_OPENSSL} )
AC_MSG_NOTICE( Unicode Support : ${UNICODE} )
AC_MSG_NOTICE( Perl Expressions Support : ${WITH_PCRE} )
AC_MSG_NOTICE( ====================================================== )
AC_MSG_NOTICE
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([config/Makefile])
AC_CONFIG_FILES([doc/Makefile])
AC_OUTPUT
man_MANS = sngrep.8
<hr size="1"><address style="text-align: right;"><small>
Generated on $datetime for $projectname &nbsp;<a href="http://www.irontec.com"><img src="../ironlogo.png" alt="irontec" border="0"></a> </small></address>
</body>
</html>
\ No newline at end of file
.\" Man page for the sngrep
.\"
.\" Copyright (c) 2013-2015 Ivan Alonso <kaian@irontec.com>
.\" Copyright (c) 2013-2015 Irontec S.L.
.TH SNGREP 8 "March 2015" "sngrep 0.3.0"
.SH NAME
sngrep \- SIP Messages flow viewer
.SH SYNOPSIS
.B sngrep [-hVciv] [ -IO
.I pcap_dump
.B ] [ -d
.I dev
.B ] [ -l
.I limit
.B ] [ -k
.I keyfile
.B ] [
.I <match expression>
.B ] [
.I <bpf filter>
.B ]
.SH DESCRIPTION
sngrep is a terminal tool that groups SIP (Session Initiation Protocol)
Messages by Call-Id, and displays them in arrow flows similar to the used in
SIP RFCs. The aim of this tool is to make easier the process of learnig or
debugging SIP. It recognizes UDP, TCP and partially TLS SIP packets and
understands bpf filter logic in the same way
.B ngrep (8)
and
.B tcpdump (1)
does.
.SH OPTIONS
.TP
.I \-h
Display help and usage information.
.TP
.I \-V
Display version information.
.TP
.I \-c
Only capture dialogs starting with an INVITE request.
.TP
.I \-i
Make match expression case insensitive.
.TP
.I \-v
Invert match expression.
.TP
.I \-I pcap_dump
Read packets from pcap file instead of network devices. This option can be used
with bpf filters.
.TP
.I \-O pcap_dump
Save all captured packets to a pcap file. This option can be used
with bpf filters.
.TP
.I \-d dev
Use this capture device instead of default (\fIany\fP).
.TP
.I -k keyfile
Use private keyfile to decrypt TLS packets.
.TP
.I -l limit
Change default capture limit (10000 dialogs)
.TP
.I match expression