Commit Graph

1004 Commits

Author SHA1 Message Date
Preston Baxter df2b88a28a Update readme 2024-02-06 23:23:37 -06:00
Kaian f7b36df3b7 doc: update ChangeLog for 1.8.0 release 2023-12-20 10:37:08 +01:00
Kaian a64525441d cc: remove parameters from msg_create and capture_launch_thread definition #471 2023-12-20 10:27:56 +01:00
Axel Sommerfeldt a4a2357355 CMake build support revised
- Compiler options '-Wall -pedantic' added
- Definition of _XOPEN_SOURCE_EXTENDED added
- Template configuration header file src/config.h.cmake added
- README updated

See also: https://github.com/irontec/sngrep/pull/462
2023-11-29 16:27:00 +01:00
Axel Sommerfeldt 356f2474ba CMake build adapted to older versions of 'libpcap' which don't provide a pkg-config file
Furthermore CPACK_PACKAGE_NAME and CPACK_PACKAGE_VERSION are set explicitly since this is needed for older CMake versions.

(Tested on Debian Stretch with CMake 3.7.2)
2023-11-29 16:27:00 +01:00
Axel Sommerfeldt 4b96af3389 Support for building sngrep using CMake added 2023-11-29 16:27:00 +01:00
Kaian c8c1b38ea5 main: -F flag should not require extra arguments #461 2023-11-29 16:15:22 +01:00
Christian Schnell ba59a9d18f Redefine usage of POSIX signals.
Use signal SIGUSR1 instead of SIGHUP to detect when to rotate the pcap dump file.
Use signal SIGHUP instead of SIGCONT to detect when the controlling terminal closed.

This signal usage provides that sngrep closes cleanly when its controlling (SSH) terminal closes.
2023-11-07 17:19:42 +01:00
Kaian 71e454c687 capture: properly check link layer header size before IP reassembly #446 2023-08-22 11:44:49 +02:00
Kaian 85bc4924e0 capture: only validate BPF filters against libpcap sources #452 2023-08-21 13:01:21 +02:00
Kaian b086bf7ac4 doc: add -r option to man page #451 2023-08-18 11:41:36 +02:00
Lixeiden 69758cb85e Fix: typo in comment line 2023-08-04 07:49:43 +02:00
Sebastian Damm 16333bf531 Ensure legacy compatibility with libpcre2 dependency
Co-authored-by: Kaian <Kaian@irontec.com>
2023-07-17 14:53:09 +02:00
Sebastian Damm 684777f3db [fix] debian pkg dependency to libpcre2-8-0 2023-07-17 14:53:09 +02:00
Kaian ad1daf15c8 capture: properly validate WS packet payload size #438 2023-06-09 14:29:59 +02:00
Andreas Heil a7b8436818 fix remove unused variables and uset getmaxx() or getmaxy() for remaining variables 2023-05-23 12:30:32 +02:00
Andreas Heil 6ea5fa4d31 fix compiler warnings about unused variables 2023-05-23 12:30:32 +02:00
Victor Seva ae8e0a4472 fix typo in message, thanks to lintian 2023-05-02 16:27:49 +02:00
Kaian ece9e0df1e doc: update ChangeLog for 1.7.0 release 2023-03-31 09:57:36 +02:00
Gang Zhuo e9f9bcc748 Initialize text_outfile to NULL.
'device' and 'outfile' are initialized from 'settings' in the later code,
but 'text_outfile' is not initialized, which may lead to writing to an unknown file.
2023-03-10 09:05:30 +01:00
Kaian f39fa0b59b capture: validate frame has at least IP header before assembly #431 2023-03-03 12:51:36 +01:00
Kaian 038a658835 capture: properly validate capture length calculated from IP headers #430 2023-03-01 12:55:10 +01:00
Kaian e1d2b322ac core: stop running when ssh connection has lost #424 2023-02-24 11:08:11 +01:00
Kaian 6aa93f242e hep: disable HEP listen during offline capture mode 2023-02-24 10:29:50 +01:00
Sebastian Kupiecki b1cb6467df
Instant convert pcap to txt file (#427)
* add siplify command for saving pcap to txt file

* remove unnecessary printf and commented code

* Refactor siplify into text; minor changes according to pull request review
2023-02-14 10:51:40 +01:00
psykose 69ddc89304 test_input: import config.h
required to expose usleep via GNU_SOURCE
2023-01-09 08:39:44 +01:00
psykose 5977b92d65 ui: import strings.h and config.h
strings.h required for strncasecmp, fixes an implicit function
declaration

config.h needed for the actual configuration, it sets -D_GNU_SOURCE that
is needed for strsep.
2023-01-09 08:39:44 +01:00
Sean Bright b32c2b406d ui_save.c: Fix spelling of 'exists.' 2022-12-12 11:01:36 +01:00
Kaian b537a94d02 openssl: fix decrpyt for TLS_RSA_WITH_AES_256_GCM_SHA384 cipher #418 2022-11-22 11:52:32 +01:00
Kaian 5089514cd8 doc: update ChangeLog for 1.6.0 release 2022-08-31 16:02:22 +02:00
Kaian 8e30b39448 ui: fix raw payload new line print logic #410 2022-08-23 14:07:53 +02:00
Kaian 3d590febcd
Merge pull request #407 from g-v-egidy/pcap-gzip
Implement reading & writing of gzip compressed pcap files
2022-07-18 12:26:54 +02:00
Gerd v. Egidy 58b7601d17 Implement reading & writing of gzip compressed pcap files
libpcap doesn't directly support this, so this is implemented using the
Linux call fopencookie which rereoutes the read,write,seek,close functions.
*BSD seems to have something similar (funopen) which is not implemented in
this patch because I'm not familiar enough with BSD.

gzip detection for read is done by first directly opening the given file
like before. If this fails, we retry with gzip.

gzip detection for write is done by looking at the filename to write to.
If it ends in ".gz" we activate gzip compression.

This currently just works for the commandline option --output because only
there you get to set the filename suffix freely. To make this usable in
the curses gui, the save dialog would have to be extended to allow setting
a .pcap.gz filename extension.

gzip compression must be compiled in to be active. This is done with the
--with-zlib configure option.
2022-07-18 11:11:36 +02:00
Gerd v. Egidy c02f439d73 implement autoconf/automake support for libz and fopencookie usage 2022-07-11 20:40:03 +02:00
Gerd v. Egidy 6004df9dfd Do proper shutdown upon SIGTERM, SIGINT or SIGQUIT
Before this patch the process was just terminated by the default signal
handler. This could lead for example to incompletely written pcap files.
So proper shutdown like in this patch is always a good idea. But it becomes
mandadory when implementing more complex file I/O with buffering, for
example with gzip streaming.

To not conflict with the threading used in sngrep, the signal handler
just sets a atomic flag. This flag is then checked in one of the two
main loops (with/without curses UI).
2022-07-11 20:05:11 +02:00
Gerd v. Egidy 56c5e8eac1 show dialog count without rotation when using --no-interface
When using --no-interface without --quiet, a dialog counter
is shown and continously updated. Without this patch this
counter just shows the number of calls that are stored in RAM.
When rotation is used, it never shows more calls than the
rotation limit.

Since the --no-interface option is usually just used for
capturing, using it with a small number for rotation (down to 1)
is recommended to not waste RAM. This means the shown value
is useless.

This patch introduces the function sip_calls_count_unrotated() that
can be used to get the full number of calls since program start.
This is then used in the shown dialog count.
2022-07-08 08:59:33 +02:00
Gerd v. Egidy f5f379408f replace #elifdef with #elif defined()
The #elifdef preprocessor directive will only become available with the
upcoming C2x standard.

I do not think that using it already is a good idea, since support for
it is very sparse and no long-term-stable distro has support for it.
Also replacing it with "#elif defined()" doesn't really complicate the code.
2022-07-07 12:22:01 +02:00
Kaian 5dcce932cb hash: fix memory leak removing hash table entries #399 2022-07-05 13:40:47 +02:00
Sam James 81a5d087b5 configure.ac: fix bashisms
configure scripts need to be runnable with a POSIX-compliant /bin/sh.

On many (but not all!) systems, /bin/sh is provided by Bash, so errors
like this aren't spotted. Notably Debian defaults to /bin/sh provided
by dash which doesn't tolerate such bashisms as '=='.

This retains compatibility with bash.

Fixes configure warnings/errors like:
```
checking for pcap.h... yes
./configure: 6520: test: xyes: unexpected operator
checking for ncurses.h... yes
checking for initscr in -lncurses... yes
```
2022-07-05 10:12:20 +02:00
Kaian ebd1838a52 pkg: update build depends with libpcre2-dev 2022-06-30 16:22:10 +02:00
Kaian cac42deab5 pcre: add support for libpcre2
Fixes #383
2022-06-30 16:21:28 +02:00
Gerd v. Egidy a2b88f9b33 add SIGHUP signal handler to allow rotation of pcap dump files 2022-05-31 08:59:21 +02:00
Kaian 600511fd0d capture: add support for DLT_LINUX_SLL2 link type #402 2022-05-30 11:34:18 +02:00
Gerd v. Egidy f64df86647 fix recvfrom() call in capture_eep_receive_v*()
- the addrlen parameter must be filled with the size available for src_addr before
  calling recvfrom()
- the size of the src_addr isn't really known before calling recvfrom, it can be
  of different types. So use struct sockaddr_storage for it which is large enough
  to allow different actual address types
2022-05-09 16:40:17 +02:00
Kaian ffe39e7218 hep: free fake frame data after packet creation #399 2022-05-06 11:01:48 +02:00
Jarrod Baumann cc3342b652 [msg_get_attribute] check message element exists before strchr and null terminate value 2022-05-04 11:41:07 +02:00
Kaian 502335cfd0 tests: update headers inclusion in vector and hash tests 2022-05-02 11:50:43 +02:00
Kaian 2f54030f7f doc: update ChangeLog for 1.5.0 release 2022-05-02 11:36:37 +02:00
Kaian 90d70b214d capture: check packet size after assembly #387 2022-05-02 10:29:03 +02:00
Kaian 429b60be48 capture: add capture thread function for offline pcap capture 2022-05-02 09:27:42 +02:00