FoxIO-LLC / ja4tscan

JA4TScan is an active TCP server fingerprinting tool.
Other
55 stars 3 forks source link

build failed in Archlinux #5

Closed IanSmith123 closed 5 months ago

IanSmith123 commented 5 months ago

Follow the instruction on: https://github.com/zmap/zmap/blob/main/INSTALL.md , I can build zmap source code without ja4tscan success. But when I run bash build.sh to add ja4tscan feature to zmap, I get Error:

[ 12%] Built target zmaplib
[ 12%] Built target git_versioning
[ 13%] Generating zopt.h
[ 14%] Building C object src/CMakeFiles/zmap.dir/zmap.c.o
[ 15%] Building C object src/CMakeFiles/zmap.dir/zopt_compat.c.o
[ 16%] Building C object src/CMakeFiles/zmap.dir/probe_modules/module_ja4tscan.c.o
/segate/code/TCPServerFingerprint/ja4tscan/zmap/src/probe_modules/module_ja4tscan.c: In function ‘num_of_digits’:
/segate/code/TCPServerFingerprint/ja4tscan/zmap/src/probe_modules/module_ja4tscan.c:72:31: warning: cast from function call of type ‘double’ to non-matching type ‘int’ [-Wbad-function-cast]
   72 |         return ( n==0 ) ? 1 : (int) log10(n)+1;
      |                               ^
/segate/code/TCPServerFingerprint/ja4tscan/zmap/src/probe_modules/module_ja4tscan.c: At top level:
/segate/code/TCPServerFingerprint/ja4tscan/zmap/src/probe_modules/module_ja4tscan.c:495:23: error: initialization of ‘int (*)(void *, macaddr_t *, macaddr_t *, void *)’ {aka ‘int (*)(void *, unsigned char *, unsigned char *, void *)’} from incompatible pointer type ‘int (*)(void *, macaddr_t *, macaddr_t *, void **)’ {aka ‘int (*)(void *, unsigned char *, unsigned char *, void **)’} [-Wincompatible-pointer-types]
  495 |     .prepare_packet = &ja4tscan_prepare_packet,
      |                       ^
/segate/code/TCPServerFingerprint/ja4tscan/zmap/src/probe_modules/module_ja4tscan.c:495:23: note: (near initialization for ‘module_ja4tscan.prepare_packet’)
/segate/code/TCPServerFingerprint/ja4tscan/zmap/src/probe_modules/module_ja4tscan.c:496:20: error: initialization of ‘int (*)(void *, size_t *, ipaddr_n_t,  ipaddr_n_t,  port_n_t,  uint8_t,  uint32_t *, int,  uint16_t,  void *)’ {aka ‘int (*)(void *, long unsigned int *, unsigned int,  unsigned int,  short unsigned int,  unsigned char,  unsigned int *, int,  short unsigned int,  void *)’} from incompatible pointer type ‘int (*)(void *, size_t *, ipaddr_n_t,  ipaddr_n_t,  port_n_t,  uint8_t,  uint32_t *, int,  void *)’ {aka ‘int (*)(void *, long unsigned int *, unsigned int,  unsigned int,  short unsigned int,  unsigned char,  unsigned int *, int,  void *)’} [-Wincompatible-pointer-types]
  496 |     .make_packet = &ja4tscan_make_packet,
      |                    ^
/segate/code/TCPServerFingerprint/ja4tscan/zmap/src/probe_modules/module_ja4tscan.c:496:20: note: (near initialization for ‘module_ja4tscan.make_packet’)
make[2]: *** [src/CMakeFiles/zmap.dir/build.make:382: src/CMakeFiles/zmap.dir/probe_modules/module_ja4tscan.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:205: src/CMakeFiles/zmap.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
You can now run python3 ja4tscan.py

It's seem that gcc 14 not support this kind of pointer or other cause? I'm not sure because I'm not particularly proficient in writing C code, I would greatly appreciate your generous assistance :)

system info:

[user@arch zmap]$ cat /etc/issue
Arch Linux \r (\l)
[user@arch zmap]$ cmake -version
cmake version 3.29.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
[user@arch zmap]$ gcc --version
gcc (GCC) 14.1.1 20240507
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
IanSmith123 commented 5 months ago

For guys who might meet the same problem. I build success by change gcc14 to gcc13, with follow step:

  1. install gcc13 pacman -S gcc13
  2. set CC before run cmake in file build.sh
    export CC=gcc-13
    export CXX=g++-13
    cmake -DEXTRA_PROBE_MODULES=probe_modules/module_ja4tscan.c && make

Of course, another method is set CMAKE_C_COMPILER flag.

cmake -DEXTRA_PROBE_MODULES=probe_modules/module_ja4tscan.c -D CMAKE_C_COMPILER=gcc-13  && make