Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can we run sngrep in solaris server ? #489

Open
sajai20 opened this issue Jun 12, 2024 · 6 comments
Open

can we run sngrep in solaris server ? #489

sajai20 opened this issue Jun 12, 2024 · 6 comments
Labels

Comments

@sajai20
Copy link

sajai20 commented Jun 12, 2024

@Kaian can we run sngrep in solaris server ?

@Kaian Kaian changed the title SNGREP can we run sngrep in solaris server ? Jun 12, 2024
@Kaian
Copy link
Member

Kaian commented Jun 19, 2024

Hi @sajai20

I have never used a Solaris server, so I can not provide any feedback.
Try to compile from the sources and give it a try. If Solaris supports libpcap and libncurses it may work.

Best regards!

@Kaian Kaian added the question label Jun 19, 2024
@Kaian
Copy link
Member

Kaian commented Jun 24, 2024

@sajai20

Did you try compiling from sources? Any success?

Regards

@mj162
Copy link

mj162 commented Jul 5, 2024

Tried...

$ uname -a
SunOS 5.11 11.3 sun4v sparc sun4v

./bootstrap.sh
Generating the configure script ...
/usr/share/aclocal/aalib.m4:12: warning: underquoted definition of AM_PATH_AALIB
/usr/share/aclocal/aalib.m4:12:   run info '(automake)Extending aclocal'
/usr/share/aclocal/aalib.m4:12:   or see http://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal

./configure
checking for a BSD-compatible install... /usr/gnu/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/gnu/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/gnu/bin/grep
checking for egrep... /usr/gnu/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking whether ln -s works... yes
checking for egrep... (cached) /usr/gnu/bin/grep -E
checking whether gcc and cc understand -c and -o together... yes
checking for fopencookie... no
checking for pthread_create in -lpthread... yes
checking for pcap_open_offline in -lpcap... yes
checking pcap.h usability... yes
checking pcap.h presence... yes
checking for pcap.h... yes
checking ncurses.h usability... no
checking ncurses.h presence... no
checking for ncurses.h... no
configure: error:  You need to have ncurses development files installed to compile sngrep.

$ find /usr -name ncurses.h 2> /dev/null
/usr/include/ncurses/ncurses.h

My attempt failed at the first hurdle as configure couldn't find ncurses.h in /usr/include/ncurses/. A bit rusty, so pointers appreciated. Thanks :)

@Kaian
Copy link
Member

Kaian commented Jul 8, 2024

You can pass some include paths to configure using CFLAGS. Try for example:

 CFLAGS="-I /usr/include/ncurses/" ./configure

Best regards!

@mj162
Copy link

mj162 commented Jul 8, 2024

Thank you Kain :) result:

$ CFLAGS="-I /usr/include/ncurses/" ./configure
checking for a BSD-compatible install... /usr/gnu/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/gnu/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/gnu/bin/grep
checking for egrep... /usr/gnu/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking whether ln -s works... yes
checking for egrep... (cached) /usr/gnu/bin/grep -E
checking whether gcc and cc understand -c and -o together... yes
checking for fopencookie... no
checking for pthread_create in -lpthread... yes
checking for pcap_open_offline in -lpcap... yes
checking pcap.h usability... yes
checking pcap.h presence... yes
checking for pcap.h... yes
checking ncurses.h usability... yes
checking ncurses.h presence... no
configure: WARNING: ncurses.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: ncurses.h: proceeding with the compiler's result
checking for ncurses.h... yes
checking for initscr in -lncurses... yes
checking for new_panel in -lpanel... yes
checking for new_form in -lform... yes
checking for new_item in -lmenu... yes
checking for library containing keyname... none required
checking for pkg-config... /usr/ccs/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes

 ██╗██████╗  ██████╗ ███╗   ██╗████████╗███████╗ ██████╗
 ██║██╔══██╗██╔═══██╗████╗  ██║╚══██╔══╝██╔════╝██╔════╝
 ██║██████╔╝██║   ██║██╔██╗ ██║   ██║   █████╗  ██║
 ██║██╔══██╗██║   ██║██║╚██╗██║   ██║   ██╔══╝  ██║
 ██║██║  ██║╚██████╔╝██║ ╚████║   ██║   ███████╗╚██████╗
 ╚═╝╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═══╝   ╚═╝   ╚══════╝ ╚═════╝

configure:
configure: sngrep configure finished
configure: ======================================================
configure: GnuTLS Support               : no
configure: OpenSSL Support              : no
configure: Unicode Support              : no
configure: Perl Expressions Support     : no
configure: Perl Expressions Support (v2): no
configure: IPv6 Support                 : no
configure: EEP Support                  : no
configure: Zlib Support                 : no
configure: ======================================================
configure:
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config/Makefile
config.status: creating doc/Makefile
config.status: creating tests/Makefile
config.status: creating src/config.h
config.status: executing depfiles commands
$

However it failed at compile time:-

# make
Making all in src
make[1]: Entering directory `/tmp/sngrep-1.8.1/src'
make  all-am
make[2]: Entering directory `/tmp/sngrep-1.8.1/src'
  CC     sngrep-capture.o
In file included from capture.h:68:0,
                 from capture.c:39:
/usr/include/netinet/if_ether.h:77:15: error: field 'ac_if' has incomplete type
  struct ifnet ac_if;  /* network-visible interface */
               ^~~~~
In file included from capture.c:39:0:
capture.h:91:5: error: unknown type name 'u_int16_t'
     u_int16_t   tlv_length;
     ^~~~~~~~~
capture.h:92:5: error: unknown type name 'u_int16_t'
     u_int16_t   tlv_type;
     ^~~~~~~~~
capture.c: In function 'capture_packet_reasm_ip':
capture.c:578:45: error: 'IP_OFFMASK' undeclared (first use in this function); did you mean 'IP_MSS'?
                 ip_frag = ip_off & (IP_MF | IP_OFFMASK);
                                             ^~~~~~~~~~
                                             IP_MSS
capture.c:578:45: note: each undeclared identifier is reported only once for each function it appears in
capture.c:612:25: error: 'IPPROTO_IPIP' undeclared (first use in this function); did you mean 'IPPROTO_PIM'?
         if (ip_proto == IPPROTO_IPIP) {
                         ^~~~~~~~~~~~
                         IPPROTO_PIM
make[2]: *** [sngrep-capture.o] Error 1
make[2]: Leaving directory `/tmp/sngrep-1.8.1/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/sngrep-1.8.1/src'
make: *** [all-recursive] Error 1
#

Are you able to suggest a way forward. Thank you. Kind regards.

@Kaian
Copy link
Member

Kaian commented Jul 8, 2024

I don't think these errors are fixable without adding specific code for Solaris, so current code is not compatible.

There are some static compiled binares here downloading the latest one give it execution permission and give it a try.

Otherwise, this will require some time to make it work

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants