From 41922f33b5f2cbc58e504469cdcd14ffa33ee5f3 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 1 Oct 2023 00:43:21 +0200 Subject: [PATCH 1/2] aircrack-ng: bump to release 1.7 Bump aircrack-ng to release 1.7 Changelog from [1] Airdecap-ng: Endianness fixes Airdecap-ng: Output PCAP as little endian Airodump-ng: Fixed blank encryption field when APs have TKIP (and/or CCMP) with WPA2 Airodump-ng: Updated encryption filter (-t/--encrypt) for WPA3 and OWE Airodump-ng: Fixed out-of-order timestamp captures Airodump-ng: Ignore NULL PMKID Airodump-ng: Fixed dropping management frames with zeroed timestamp Airodump-ng: Fixed sorting where sometimes it started with a different field Airodump-ng: Allow setting colors only in AP selection mode Airodump-ng: Fix crash on 4K Linux console Airodump-ng: Fixed issue where existing clients not linked to an AP become hidden when hitting 'o' Airodump-ng: Allow use of WiFi 6E 6GHz frequencies Airodump-ng: Look for oui.txt in /usr/share/hwdata Airgraph-ng: Fixed graphviz package conflict Airgraph-ng: Fixed downloading OUI with python3 Airgraph-ng: Ensure support/ directory is created when installing Aircrack-ng: Fixed static compilation Aircrack-ng: Fix handshake replay counter logic Aircrack-ng: Handle timeout when parsing EAPOL Aircrack-ng: Fixed WEP display Aircrack-ng: Fixed spurious EXIT messages Aircrack-ng: Improved handshake selection by fixing EAPOL timing and clearing state Aircrack-ng: Ignore NULL PMKID Aircrack-ng: Added Apple M1 detection Aireplay-ng: In test mode, detect tampering of sequence number by firmware/driver Aireplay-ng: Fixed incorrectly rewritten loops affecting fragmentation attack, and in some cases, SKA fake auth Aireplay-ng: Fixed a bunch of instances where packets had their duration updated instead of the sequence number Airmon-ng: Fix avahi killing Airmon-ng: rewrite service stopping entirely Airmon-ng: Codestyle fixes and code cleanup Airmon-ng: Added a few Raspberry Pi hardware revisions Airmon-ng: Fixes for 8812au driver Airmon-ng: Fix iwlwifi firmware formatting Airmon-ng: Remove broken KVM detection Airmon-ng: Show regdomain in verbose mode Airmon-ng: Updated Raspberry Pi hardware revisions Airmon-ng: Document frequency usage Airmon-ng: Add a sleep to help predictable names due to udev sometimes renaming interface Airmon-ng: Added warning for broken radiotap headers in kernel 5.15 to 5.15.4 Airmon-ng: shellcheck fixes Airmon-ng: support systemctl as some systems don't support 'service' anymore Airmon-ng: Fixes for pciutils 3.8, backward compatible Airbase-ng: use enum for frame type/subtype Airbase-ng: remove a few IE in association responses Besside-ng: Support and detect all channels in 5GHz in Auto-Channel mode OSdep: Search additional IE for channel information OSdep: Android macro fixes Patches: Add missing patches that were on https://patches.aircrack-ng.org but not in repo Patches: Updated freeradius-wpe patch for v3.2.0 Patches: Updated hostapd-wpe patch for v2.10 Patches: Added docker containers to test WPE patches Autotools: make dist now creates VERSION file Autotools: Added maintainer mode Autotools: Initial support for Link Time Optimization (LTO) builds Integration tests: Added a new test, and improved some existing ones Airgraph-ng: switch airodump-join to Python 3 Manpages: Fixes (typos, tools name, etc.) and improvements README: Updated dependencies and their installation on various distros in README.md and INSTALLING README: Fixed typos and spelling in README.md and INSTALLING Packages: Packages on PackageCloud now support any distro using .deb and .rpm, however, it requires reinstalling repo (BREAKING CHANGE) General: Fix compilation with LibreSSL 3.5 General: Fix issues reported by Infer General: Updated buildbots General: Add Linux uclibc support General: Compilation fixes on macOS with the Apple M1 CPU General: Removed TravisCI and AppVeyor General: Use Github Actions for CI (Linux, Win, macOS, code style, and PVS-Studio) General: Added vscode devcontainer and documentation General: Fix warnings from PVS-Studio and build with pedantic (See PR2174) General: Shell script fixes thanks to shellcheck General: Fixes for GCC 10 and 11 General: Fixed cross-compilation General: Code refactoring, deduplication, cleanup, and misc code improvements General: Coverity Scan fixes, which includes memory leaks, race conditions, division by 0, and other issues General: PVS Studio improvements,fixes and updates General: Code formatting/style fixes General: Various fixes and improvements (code, CI, integration tests, coverity) General: Update bug reporting template and update the process [1] https://aircrack-ng.blogspot.com/2022/05/aircrack-ng-17.html Signed-off-by: Christian Marangi --- net/aircrack-ng/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/aircrack-ng/Makefile b/net/aircrack-ng/Makefile index 1323a0e6b..34ec2055e 100644 --- a/net/aircrack-ng/Makefile +++ b/net/aircrack-ng/Makefile @@ -8,15 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=aircrack-ng -PKG_VERSION:=1.6 -PKG_RELEASE:=3 +PKG_VERSION:=1.7 +PKG_RELEASE:=1 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=LICENSE PKG_CPE_ID:=cpe:/a:aircrack-ng:aircrack-ng PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://download.aircrack-ng.org/ -PKG_HASH:=4f0bfd486efc6ea7229f7fbc54340ff8b2094a0d73e9f617e0a39f878999a247 +PKG_HASH:=05a704e3c8f7792a17315080a21214a4448fd2452c1b0dd5226a3a55f90b58c3 PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 From cb1f7c7ee4e5e0978a3004a94af8016c85791eed Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 1 Oct 2023 00:45:06 +0200 Subject: [PATCH 2/2] aircrack-ng: backport patch and move package to pcre2 Backport patch merged upstream for PCRE2 support and move package to pcre2. Also add an additional patch pending to fix linking both pcre and pcre2 if autotools detect both library. (aircrack-ng prefer pcre2 in presence of both) Signed-off-by: Christian Marangi --- net/aircrack-ng/Makefile | 2 +- ...100-01-autotools-add-PCRE2-detection.patch | 94 ++++++++++ ...100-02-airodump-ng-add-PCRE2-support.patch | 142 +++++++++++++++ .../100-03-besside-ng-add-PCRE2-support.patch | 146 ++++++++++++++++ ...4-makefile-add-PCRE2-to-linker-flags.patch | 29 +++ ...ump_write-remove-unused-PCRE-include.patch | 21 +++ ...pat-pcre-add-compat-type-PCRE-header.patch | 114 ++++++++++++ ...0-08-airodump-ng-utilize-compat-pcre.patch | 146 ++++++++++++++++ ...00-09-besside-ng-utilize-compat-pcre.patch | 165 ++++++++++++++++++ ...-PCRE2_CFLAGS-to-airodump-and-bessid.patch | 29 +++ ...-PCRE2-to-libaccrypto-and-libaircrac.patch | 37 ++++ ...icate-if-PCRE-or-PCRE2-is-being-used.patch | 132 ++++++++++++++ ...PCRE-CFLAGS-LIBS-with-both-PCRE-and-.patch | 39 +++++ 13 files changed, 1095 insertions(+), 1 deletion(-) create mode 100644 net/aircrack-ng/patches/100-01-autotools-add-PCRE2-detection.patch create mode 100644 net/aircrack-ng/patches/100-02-airodump-ng-add-PCRE2-support.patch create mode 100644 net/aircrack-ng/patches/100-03-besside-ng-add-PCRE2-support.patch create mode 100644 net/aircrack-ng/patches/100-04-makefile-add-PCRE2-to-linker-flags.patch create mode 100644 net/aircrack-ng/patches/100-05-airodump-ng-dump_write-remove-unused-PCRE-include.patch create mode 100644 net/aircrack-ng/patches/100-07-compat-pcre-add-compat-type-PCRE-header.patch create mode 100644 net/aircrack-ng/patches/100-08-airodump-ng-utilize-compat-pcre.patch create mode 100644 net/aircrack-ng/patches/100-09-besside-ng-utilize-compat-pcre.patch create mode 100644 net/aircrack-ng/patches/101-02-src-makefile-add-PCRE2_CFLAGS-to-airodump-and-bessid.patch create mode 100644 net/aircrack-ng/patches/101-03-lib-makefile-add-PCRE2-to-libaccrypto-and-libaircrac.patch create mode 100644 net/aircrack-ng/patches/102-autotools-indicate-if-PCRE-or-PCRE2-is-being-used.patch create mode 100644 net/aircrack-ng/patches/103-autotools-reset-PCRE-CFLAGS-LIBS-with-both-PCRE-and-.patch diff --git a/net/aircrack-ng/Makefile b/net/aircrack-ng/Makefile index 34ec2055e..70a13a0d4 100644 --- a/net/aircrack-ng/Makefile +++ b/net/aircrack-ng/Makefile @@ -40,7 +40,7 @@ include $(INCLUDE_DIR)/package.mk define Package/aircrack-ng SECTION:=net CATEGORY:=Network - DEPENDS:=+AIRCRACK_NG_HWLOC:libhwloc +libpcap +libpcre +libpthread +libstdcpp + DEPENDS:=+AIRCRACK_NG_HWLOC:libhwloc +libpcap +libpcre2 +libpthread +libstdcpp DEPENDS += +AIRCRACK_NG_OPENSSL:libopenssl DEPENDS += +AIRCRACK_NG_GCRYPT:libgcrypt DEPENDS += +AIRCRACK_NG_SQLITE3:libsqlite3 diff --git a/net/aircrack-ng/patches/100-01-autotools-add-PCRE2-detection.patch b/net/aircrack-ng/patches/100-01-autotools-add-PCRE2-detection.patch new file mode 100644 index 000000000..95079ef7f --- /dev/null +++ b/net/aircrack-ng/patches/100-01-autotools-add-PCRE2-detection.patch @@ -0,0 +1,94 @@ +From 6b05dc10cdcf45d50bc8f9dd74667a3ff399a059 Mon Sep 17 00:00:00 2001 +From: Andras Gemes +Date: Fri, 20 Jan 2023 14:52:12 +0100 +Subject: [PATCH 1/9] autotools: add PCRE2 detection + +--- + build/m4/aircrack_ng_pcre2.m4 | 61 +++++++++++++++++++++++++++++++++++ + configure.ac | 2 ++ + 2 files changed, 63 insertions(+) + create mode 100644 build/m4/aircrack_ng_pcre2.m4 + +--- /dev/null ++++ b/build/m4/aircrack_ng_pcre2.m4 +@@ -0,0 +1,61 @@ ++dnl Aircrack-ng ++dnl ++dnl Copyright (C) 2023 Andras Gemes ++dnl ++dnl Autotool support was written by: Joseph Benden ++dnl ++dnl This program is free software; you can redistribute it and/or modify ++dnl it under the terms of the GNU General Public License as published by ++dnl the Free Software Foundation; either version 2 of the License, or ++dnl (at your option) any later version. ++dnl ++dnl This program is distributed in the hope that it will be useful, ++dnl but WITHOUT ANY WARRANTY; without even the implied warranty of ++dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++dnl GNU General Public License for more details. ++dnl ++dnl You should have received a copy of the GNU General Public License ++dnl along with this program; if not, write to the Free Software ++dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++dnl ++dnl In addition, as a special exception, the copyright holders give ++dnl permission to link the code of portions of this program with the ++dnl OpenSSL library under certain conditions as described in each ++dnl individual source file, and distribute linked combinations ++dnl including the two. ++dnl ++dnl You must obey the GNU General Public License in all respects ++dnl for all of the code used other than OpenSSL. ++dnl ++dnl If you modify file(s) with this exception, you may extend this ++dnl exception to your dnl version of the file(s), but you are not obligated ++dnl to do so. ++dnl ++dnl If you dnl do not wish to do so, delete this exception statement from your ++dnl version. ++dnl ++dnl If you delete this exception statement from all source files in the ++dnl program, then also delete it here. ++ ++AC_DEFUN([AIRCRACK_NG_PCRE2], [ ++AC_ARG_ENABLE(static-pcre2, ++ AS_HELP_STRING([--enable-static-pcre2], ++ [Enable statically linked PCRE2 libpcre2-8.]), ++ [static_pcre2=$enableval], [static_pcre2=no]) ++ ++if test "x$static_pcre2" != "xno"; then ++ AC_REQUIRE([AX_EXT_HAVE_STATIC_LIB_DETECT]) ++ AX_EXT_HAVE_STATIC_LIB(PCRE2, ${DEFAULT_STATIC_LIB_SEARCH_PATHS}, pcre2 libpcre2-8, pcre2_version) ++ if test "x$PCRE2_FOUND" = xyes; then ++ HAVE_PCRE2=yes ++ else ++ HAVE_PCRE2=no ++ fi ++else ++ PKG_CHECK_MODULES(PCRE2, libpcre2-8, HAVE_PCRE2=yes, HAVE_PCRE2=no) ++fi ++ ++AS_IF([test "x$HAVE_PCRE2" = "xyes"], [ ++ AC_DEFINE([HAVE_PCRE2], [1], [Define this if you have libpcre2-8 on your system]) ++]) ++]) +\ No newline at end of file +--- a/configure.ac ++++ b/configure.ac +@@ -144,6 +144,7 @@ AIRCRACK_NG_EXT_SCRIPTS + AIRCRACK_NG_HWLOC + AIRCRACK_NG_PCAP + AIRCRACK_NG_PCRE ++AIRCRACK_NG_PCRE2 + AIRCRACK_NG_RFKILL + AIRCRACK_NG_SQLITE + AIRCRACK_NG_ZLIB +@@ -320,6 +321,7 @@ ${PACKAGE} ${VERSION} + Jemalloc: ${JEMALLOC} + Pcap: ${PCAP_FOUND} + Pcre: ${HAVE_PCRE} ++ Pcre2: ${HAVE_PCRE2} + Sqlite: ${HAVE_SQLITE3} + Tcmalloc: ${TCMALLOC} + Zlib: ${HAVE_ZLIB} diff --git a/net/aircrack-ng/patches/100-02-airodump-ng-add-PCRE2-support.patch b/net/aircrack-ng/patches/100-02-airodump-ng-add-PCRE2-support.patch new file mode 100644 index 000000000..63210b681 --- /dev/null +++ b/net/aircrack-ng/patches/100-02-airodump-ng-add-PCRE2-support.patch @@ -0,0 +1,142 @@ +From 37bc38a1749f61f3e54dbebca7b33df844b6de82 Mon Sep 17 00:00:00 2001 +From: Andras Gemes +Date: Fri, 20 Jan 2023 14:53:59 +0100 +Subject: [PATCH 2/9] airodump-ng: add PCRE2 support + +--- + src/airodump-ng/airodump-ng.c | 75 +++++++++++++++++++++++++++++++---- + 1 file changed, 67 insertions(+), 8 deletions(-) + +--- a/src/airodump-ng/airodump-ng.c ++++ b/src/airodump-ng/airodump-ng.c +@@ -68,7 +68,10 @@ + + #include + +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++#define PCRE2_CODE_UNIT_WIDTH 8 ++#include ++#elif defined HAVE_PCRE + #include + #endif + +@@ -150,7 +153,10 @@ static struct local_options + unsigned char prev_bssid[6]; + char ** f_essid; + int f_essid_count; +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++ pcre2_code * f_essid_regex; ++ pcre2_match_data * f_essid_match_data; ++#elif defined HAVE_PCRE + pcre * f_essid_regex; + #endif + char * dump_prefix; +@@ -784,7 +790,7 @@ static const char usage[] = + " --netmask : Filter APs by mask\n" + " --bssid : Filter APs by BSSID\n" + " --essid : Filter APs by ESSID\n" +-#ifdef HAVE_PCRE ++#if defined HAVE_PCRE2 || defined HAVE_PCRE + " --essid-regex : Filter APs by ESSID using a regular\n" + " expression\n" + #endif +@@ -857,7 +863,22 @@ int is_filtered_essid(const uint8_t * es + ret = 1; + } + +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++ if (lopt.f_essid_regex) ++ { ++ lopt.f_essid_match_data ++ = pcre2_match_data_create_from_pattern(lopt.f_essid_regex, NULL); ++ ++ return pcre2_match(lopt.f_essid_regex, ++ (PCRE2_SPTR) essid, ++ (int) strnlen((char *) essid, ESSID_LENGTH), ++ 0, ++ 0, ++ lopt.f_essid_match_data, ++ 0) ++ < 0; ++ } ++#elif defined HAVE_PCRE + if (lopt.f_essid_regex) + { + return pcre_exec(lopt.f_essid_regex, +@@ -5782,7 +5803,10 @@ int main(int argc, char * argv[]) + int wi_read_failed = 0; + int n = 0; + int output_format_first_time = 1; +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++ int pcreerror; ++ PCRE2_SIZE pcreerroffset; ++#elif defined HAVE_PCRE + const char * pcreerror; + int pcreerroffset; + #endif +@@ -5938,7 +5962,9 @@ int main(int argc, char * argv[]) + #ifdef CONFIG_LIBNL + lopt.htval = CHANNEL_NO_HT; + #endif +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++ lopt.f_essid_regex = NULL; ++#elif defined HAVE_PCRE + lopt.f_essid_regex = NULL; + #endif + +@@ -6359,7 +6385,34 @@ int main(int argc, char * argv[]) + + case 'R': + +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++ if (lopt.f_essid_regex != NULL) ++ { ++ printf("Error: ESSID regular expression already given. " ++ "Aborting\n"); ++ exit(EXIT_FAILURE); ++ } ++ ++ lopt.f_essid_regex = pcre2_compile((PCRE2_SPTR) optarg, ++ PCRE2_ZERO_TERMINATED, ++ 0, ++ &pcreerror, ++ &pcreerroffset, ++ NULL); ++ ++ if (lopt.f_essid_regex == NULL) ++ { ++ PCRE2_UCHAR pcreerrbuffer[256]; ++ pcre2_get_error_message( ++ pcreerror, pcreerrbuffer, sizeof(pcreerrbuffer)); ++ ++ printf("Error: regular expression compilation failed at " ++ "offset %lu: %s; aborting\n", ++ pcreerroffset, ++ pcreerrbuffer); ++ exit(EXIT_FAILURE); ++ } ++#elif defined HAVE_PCRE + if (lopt.f_essid_regex != NULL) + { + printf("Error: ESSID regular expression already given. " +@@ -7297,7 +7350,13 @@ int main(int argc, char * argv[]) + + if (lopt.keyout) free(lopt.keyout); + +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++ if (lopt.f_essid_regex) ++ { ++ pcre2_match_data_free(lopt.f_essid_match_data); ++ pcre2_code_free(lopt.f_essid_regex); ++ } ++#elif defined HAVE_PCRE + if (lopt.f_essid_regex) pcre_free(lopt.f_essid_regex); + #endif + diff --git a/net/aircrack-ng/patches/100-03-besside-ng-add-PCRE2-support.patch b/net/aircrack-ng/patches/100-03-besside-ng-add-PCRE2-support.patch new file mode 100644 index 000000000..810007eaa --- /dev/null +++ b/net/aircrack-ng/patches/100-03-besside-ng-add-PCRE2-support.patch @@ -0,0 +1,146 @@ +From dbc80d96cfba2dab959ab20bf76f8dd4f517bd29 Mon Sep 17 00:00:00 2001 +From: Andras Gemes +Date: Fri, 20 Jan 2023 14:55:18 +0100 +Subject: [PATCH 3/9] besside-ng: add PCRE2 support + +--- + src/besside-ng/besside-ng.c | 86 ++++++++++++++++++++++++++++++++++--- + 1 file changed, 79 insertions(+), 7 deletions(-) + +--- a/src/besside-ng/besside-ng.c ++++ b/src/besside-ng/besside-ng.c +@@ -57,7 +57,10 @@ + #include + #include + +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++#define PCRE2_CODE_UNIT_WIDTH 8 ++#include ++#elif defined HAVE_PCRE + #include + #endif + +@@ -155,7 +158,10 @@ static struct conf + int cf_do_wep; + int cf_do_wpa; + char * cf_wpa_server; +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++ pcre2_code * cf_essid_regex; ++ pcre2_match_data * cf_essid_match_data; ++#elif defined HAVE_PCRE + pcre * cf_essid_regex; + #endif + } _conf; +@@ -1116,7 +1122,31 @@ static void attack_ping(void * a) + timer_in(100 * 1000, attack_ping, n); + } + +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++static int is_filtered_essid(char * essid) ++{ ++ REQUIRE(essid != NULL); ++ ++ int ret = 0; ++ ++ if (_conf.cf_essid_regex) ++ { ++ _conf.cf_essid_match_data ++ = pcre2_match_data_create_from_pattern(_conf.cf_essid_regex, NULL); ++ ++ return pcre2_match(_conf.cf_essid_regex, ++ (PCRE2_SPTR) essid, ++ (int) strnlen((char *) essid, MAX_IE_ELEMENT_SIZE), ++ 0, ++ 0, ++ _conf.cf_essid_match_data, ++ 0) ++ < 0; ++ } ++ ++ return (ret); ++} ++#elif defined HAVE_PCRE + static int is_filtered_essid(char * essid) + { + REQUIRE(essid != NULL); +@@ -1148,7 +1178,12 @@ static int should_attack(struct network + if (_conf.cf_bssid && memcmp(_conf.cf_bssid, n->n_bssid, 6) != 0) + return (0); + +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++ if (is_filtered_essid(n->n_ssid)) ++ { ++ return (0); ++ } ++#elif defined HAVE_PCRE + if (is_filtered_essid(n->n_ssid)) + { + return (0); +@@ -3007,7 +3042,13 @@ static void cleanup(int UNUSED(x)) + + print_work(); + +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++ if (_conf.cf_essid_regex) ++ { ++ pcre2_match_data_free(_conf.cf_essid_match_data); ++ pcre2_code_free(_conf.cf_essid_regex); ++ } ++#elif defined HAVE_PCRE + if (_conf.cf_essid_regex) pcre_free(_conf.cf_essid_regex); + #endif + +@@ -3295,7 +3336,10 @@ static void usage(char * prog) + int main(int argc, char * argv[]) + { + int ch, temp; +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++ int pcreerror; ++ PCRE2_SIZE pcreerroffset; ++#elif defined HAVE_PCRE + const char * pcreerror; + int pcreerroffset; + #endif +@@ -3349,7 +3393,35 @@ int main(int argc, char * argv[]) + break; + + case 'R': +-#ifdef HAVE_PCRE ++#ifdef HAVE_PCRE2 ++ if (_conf.cf_essid_regex != NULL) ++ { ++ printf("Error: ESSID regular expression already given. " ++ "Aborting\n"); ++ exit(EXIT_FAILURE); ++ } ++ ++ _conf.cf_essid_regex = pcre2_compile((PCRE2_SPTR) optarg, ++ PCRE2_ZERO_TERMINATED, ++ 0, ++ &pcreerror, ++ &pcreerroffset, ++ NULL); ++ ++ if (_conf.cf_essid_regex == NULL) ++ { ++ PCRE2_UCHAR pcreerrbuffer[256]; ++ pcre2_get_error_message( ++ pcreerror, pcreerrbuffer, sizeof(pcreerrbuffer)); ++ ++ printf("Error: regular expression compilation failed at " ++ "offset %lu: %s; aborting\n", ++ pcreerroffset, ++ pcreerrbuffer); ++ exit(EXIT_FAILURE); ++ } ++ break; ++#elif defined HAVE_PCRE + if (_conf.cf_essid_regex != NULL) + { + printf("Error: ESSID regular expression already given. " diff --git a/net/aircrack-ng/patches/100-04-makefile-add-PCRE2-to-linker-flags.patch b/net/aircrack-ng/patches/100-04-makefile-add-PCRE2-to-linker-flags.patch new file mode 100644 index 000000000..be5b886c5 --- /dev/null +++ b/net/aircrack-ng/patches/100-04-makefile-add-PCRE2-to-linker-flags.patch @@ -0,0 +1,29 @@ +From ca05a44c449be3c433ea67c04f11d544ab62395f Mon Sep 17 00:00:00 2001 +From: Andras Gemes +Date: Fri, 20 Jan 2023 14:57:16 +0100 +Subject: [PATCH 4/9] makefile: add PCRE2 to linker flags + +--- + src/Makefile.inc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/src/Makefile.inc ++++ b/src/Makefile.inc +@@ -130,7 +130,7 @@ aireplay_ng_LDADD = $(COMMON_LDADD) $(L + airodump_ng_SOURCES = $(SRC_ADU) $(SRC_DWRITE) + airodump_ng_CFLAGS = $(COMMON_CFLAGS) $(PCRE_CFLAGS) $(LIBNL_CFLAGS) + airodump_ng_CPPFLAGS = $(AM_CPPFLAGS) -I$(abs_srcdir)/src/airodump-ng +-airodump_ng_LDADD = $(COMMON_LDADD) $(PCRE_LIBS) $(LIBAIRCRACK_OSDEP_LIBS) $(LIBACCRYPTO_LIBS) $(LIBAIRCRACK_CE_WEP_LIBS) $(AIRPCAP_LIBS) $(LIBAIRCRACK_LIBS) $(CRYPTO_LIBS) ++airodump_ng_LDADD = $(COMMON_LDADD) $(PCRE_LIBS) $(PCRE2_LIBS) $(LIBAIRCRACK_OSDEP_LIBS) $(LIBACCRYPTO_LIBS) $(LIBAIRCRACK_CE_WEP_LIBS) $(AIRPCAP_LIBS) $(LIBAIRCRACK_LIBS) $(CRYPTO_LIBS) + + airserv_ng_SOURCES = $(SRC_AS) + airserv_ng_CFLAGS = $(COMMON_CFLAGS) $(LIBNL_CFLAGS) +@@ -164,7 +164,7 @@ buddy_ng_LDADD = $(COMMON_LDADD) $(LIBA + + besside_ng_SOURCES = $(SRC_BS) + besside_ng_CFLAGS = $(COMMON_CFLAGS) $(PCRE_CFLAGS) $(LIBNL_CFLAGS) +-besside_ng_LDADD = $(COMMON_LDADD) $(PCRE_LIBS) $(LIBAIRCRACK_OSDEP_LIBS) $(LIBACCRYPTO_LIBS) $(LIBPTW_LIBS) $(AIRPCAP_LIBS) $(LIBAIRCRACK_LIBS) $(CRYPTO_LIBS) ++besside_ng_LDADD = $(COMMON_LDADD) $(PCRE_LIBS) $(PCRE2_LIBS) $(LIBAIRCRACK_OSDEP_LIBS) $(LIBACCRYPTO_LIBS) $(LIBPTW_LIBS) $(AIRPCAP_LIBS) $(LIBAIRCRACK_LIBS) $(CRYPTO_LIBS) + + besside_ng_crawler_SOURCES = $(SRC_BC) + besside_ng_crawler_CFLAGS = $(COMMON_CFLAGS) $(PCAP_CFLAGS) diff --git a/net/aircrack-ng/patches/100-05-airodump-ng-dump_write-remove-unused-PCRE-include.patch b/net/aircrack-ng/patches/100-05-airodump-ng-dump_write-remove-unused-PCRE-include.patch new file mode 100644 index 000000000..6b64fb63e --- /dev/null +++ b/net/aircrack-ng/patches/100-05-airodump-ng-dump_write-remove-unused-PCRE-include.patch @@ -0,0 +1,21 @@ +From fa532b05d48e856c774837b83a3323dafcc8c33e Mon Sep 17 00:00:00 2001 +From: Andras Gemes +Date: Fri, 20 Jan 2023 14:58:35 +0100 +Subject: [PATCH 5/9] airodump-ng/dump_write: remove unused PCRE include + +--- + src/airodump-ng/dump_write.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/src/airodump-ng/dump_write.c ++++ b/src/airodump-ng/dump_write.c +@@ -45,9 +45,6 @@ + #include // ftruncate + #include // ftruncate + #include +-#ifdef HAVE_PCRE +-#include +-#endif + + #include "aircrack-ng/defs.h" + #include "airodump-ng.h" diff --git a/net/aircrack-ng/patches/100-07-compat-pcre-add-compat-type-PCRE-header.patch b/net/aircrack-ng/patches/100-07-compat-pcre-add-compat-type-PCRE-header.patch new file mode 100644 index 000000000..51df8ea2b --- /dev/null +++ b/net/aircrack-ng/patches/100-07-compat-pcre-add-compat-type-PCRE-header.patch @@ -0,0 +1,114 @@ +From bac9b5fed2bb29e13326c90d7c12a6936fe9f04b Mon Sep 17 00:00:00 2001 +From: Andras Gemes +Date: Sat, 21 Jan 2023 19:29:58 +0100 +Subject: [PATCH 7/9] compat-pcre: add compat-type PCRE header + +--- + include/Makefile.inc | 1 + + include/aircrack-ng/pcre/compat-pcre.h | 90 ++++++++++++++++++++++++++ + 2 files changed, 91 insertions(+) + create mode 100644 include/aircrack-ng/pcre/compat-pcre.h + +--- a/include/Makefile.inc ++++ b/include/Makefile.inc +@@ -71,6 +71,7 @@ nobase_aircrack_HEADERS = %D%/aircrack- + %D%/aircrack-ng/osdep/network.h \ + %D%/aircrack-ng/osdep/osdep.h \ + %D%/aircrack-ng/osdep/packed.h \ ++ %D%/aircrack-ng/pcre/compat-pcre.h \ + %D%/aircrack-ng/ptw/aircrack-ptw-lib.h \ + %D%/aircrack-ng/support/common.h \ + %D%/aircrack-ng/support/communications.h \ +--- /dev/null ++++ b/include/aircrack-ng/pcre/compat-pcre.h +@@ -0,0 +1,90 @@ ++/* ++* Copyright (C) 2023 Andras Gemes ++* ++* 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 2 of the License, or ++* (at your option) any later version. ++* ++* 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, write to the Free Software ++* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++* ++* ++* 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. ++*/ ++ ++#ifndef AIRCRACK_NG_COMPAT_PCRE_H ++#define AIRCRACK_NG_COMPAT_PCRE_H ++ ++#ifdef HAVE_PCRE2 ++#define PCRE2_CODE_UNIT_WIDTH 8 ++#include ++#elif defined HAVE_PCRE ++#include ++#endif ++ ++#ifdef HAVE_PCRE2 ++#define COMPAT_PCRE_COMPILE(pattern, pcreerror, pcreerroffset) \ ++ pcre2_compile((PCRE2_SPTR) (pattern), \ ++ PCRE2_ZERO_TERMINATED, \ ++ 0, \ ++ (pcreerror), \ ++ (pcreerroffset), \ ++ NULL) ++#elif defined HAVE_PCRE ++#define COMPAT_PCRE_COMPILE(pattern, pcreerror, pcreerroffset) \ ++ pcre_compile((pattern), 0, (pcreerror), (pcreerroffset), NULL) ++#endif ++ ++#ifdef HAVE_PCRE2 ++#define COMPAT_PCRE_MATCH(regex, essid, length, match_data) \ ++ pcre2_match((regex), \ ++ (PCRE2_SPTR) (essid), \ ++ (int) strnlen((char *) (essid), (length)), \ ++ 0, \ ++ 0, \ ++ (match_data), \ ++ 0) ++#elif defined HAVE_PCRE ++#define COMPAT_PCRE_MATCH(regex, essid, length, match_data) \ ++ pcre_exec((regex), \ ++ NULL, \ ++ (char *) (essid), \ ++ strnlen((char *) (essid), (length)), \ ++ 0, \ ++ 0, \ ++ NULL, \ ++ 0) ++#endif ++ ++#ifdef HAVE_PCRE2 ++#define COMPAT_PCRE_PRINT_ERROR(pcreerroffset, pcreerr) \ ++ printf("Error: regular expression compilation failed at " \ ++ "offset %zu: %s; aborting\n", \ ++ (pcreerroffset), \ ++ (pcreerr)) ++#elif defined HAVE_PCRE ++#define COMPAT_PCRE_PRINT_ERROR(pcreerroffset, pcreerrorbuf) \ ++ printf("Error: regular expression compilation failed at " \ ++ "offset %d: %s; aborting\n", \ ++ (pcreerroffset), \ ++ (pcreerrorbuf)) ++#endif ++#endif //AIRCRACK_NG_COMPAT_PCRE_H diff --git a/net/aircrack-ng/patches/100-08-airodump-ng-utilize-compat-pcre.patch b/net/aircrack-ng/patches/100-08-airodump-ng-utilize-compat-pcre.patch new file mode 100644 index 000000000..732c6a1dc --- /dev/null +++ b/net/aircrack-ng/patches/100-08-airodump-ng-utilize-compat-pcre.patch @@ -0,0 +1,146 @@ +From e7ace80dbcfd2feecbbc6263ce59ce20acdafca0 Mon Sep 17 00:00:00 2001 +From: Andras Gemes +Date: Sat, 21 Jan 2023 19:31:07 +0100 +Subject: [PATCH 8/9] airodump-ng: utilize compat-pcre + +--- + src/airodump-ng/airodump-ng.c | 80 +++++++++-------------------------- + 1 file changed, 19 insertions(+), 61 deletions(-) + +--- a/src/airodump-ng/airodump-ng.c ++++ b/src/airodump-ng/airodump-ng.c +@@ -68,13 +68,7 @@ + + #include + +-#ifdef HAVE_PCRE2 +-#define PCRE2_CODE_UNIT_WIDTH 8 +-#include +-#elif defined HAVE_PCRE +-#include +-#endif +- ++#include "aircrack-ng/pcre/compat-pcre.h" + #include "aircrack-ng/defs.h" + #include "aircrack-ng/version.h" + #include "aircrack-ng/support/pcap_local.h" +@@ -863,33 +857,22 @@ int is_filtered_essid(const uint8_t * es + ret = 1; + } + +-#ifdef HAVE_PCRE2 ++#if defined HAVE_PCRE2 || defined HAVE_PCRE + if (lopt.f_essid_regex) + { ++#ifdef HAVE_PCRE2 + lopt.f_essid_match_data + = pcre2_match_data_create_from_pattern(lopt.f_essid_regex, NULL); + +- return pcre2_match(lopt.f_essid_regex, +- (PCRE2_SPTR) essid, +- (int) strnlen((char *) essid, ESSID_LENGTH), +- 0, +- 0, +- lopt.f_essid_match_data, +- 0) ++ return COMPAT_PCRE_MATCH(lopt.f_essid_regex, ++ essid, ++ ESSID_LENGTH, ++ lopt.f_essid_match_data) + < 0; +- } + #elif defined HAVE_PCRE +- if (lopt.f_essid_regex) +- { +- return pcre_exec(lopt.f_essid_regex, +- NULL, +- (char *) essid, +- (int) strnlen((char *) essid, ESSID_LENGTH), +- 0, +- 0, +- NULL, +- 0) ++ return COMPAT_PCRE_MATCH(lopt.f_essid_regex, essid, ESSID_LENGTH, NULL) + < 0; ++#endif + } + #endif + +@@ -5805,6 +5788,7 @@ int main(int argc, char * argv[]) + int output_format_first_time = 1; + #ifdef HAVE_PCRE2 + int pcreerror; ++ PCRE2_UCHAR pcreerrorbuf[256]; + PCRE2_SIZE pcreerroffset; + #elif defined HAVE_PCRE + const char * pcreerror; +@@ -5962,9 +5946,7 @@ int main(int argc, char * argv[]) + #ifdef CONFIG_LIBNL + lopt.htval = CHANNEL_NO_HT; + #endif +-#ifdef HAVE_PCRE2 +- lopt.f_essid_regex = NULL; +-#elif defined HAVE_PCRE ++#if defined HAVE_PCRE2 || defined HAVE_PCRE + lopt.f_essid_regex = NULL; + #endif + +@@ -6385,7 +6367,7 @@ int main(int argc, char * argv[]) + + case 'R': + +-#ifdef HAVE_PCRE2 ++#if defined HAVE_PCRE2 || defined HAVE_PCRE + if (lopt.f_essid_regex != NULL) + { + printf("Error: ESSID regular expression already given. " +@@ -6393,42 +6375,18 @@ int main(int argc, char * argv[]) + exit(EXIT_FAILURE); + } + +- lopt.f_essid_regex = pcre2_compile((PCRE2_SPTR) optarg, +- PCRE2_ZERO_TERMINATED, +- 0, +- &pcreerror, +- &pcreerroffset, +- NULL); ++ lopt.f_essid_regex ++ = COMPAT_PCRE_COMPILE(optarg, &pcreerror, &pcreerroffset); + + if (lopt.f_essid_regex == NULL) + { +- PCRE2_UCHAR pcreerrbuffer[256]; ++#ifdef HAVE_PCRE2 + pcre2_get_error_message( +- pcreerror, pcreerrbuffer, sizeof(pcreerrbuffer)); +- +- printf("Error: regular expression compilation failed at " +- "offset %lu: %s; aborting\n", +- pcreerroffset, +- pcreerrbuffer); +- exit(EXIT_FAILURE); +- } ++ pcreerror, pcreerrorbuf, sizeof(pcreerrorbuf)); ++ COMPAT_PCRE_PRINT_ERROR(pcreerroffset, pcreerrorbuf); + #elif defined HAVE_PCRE +- if (lopt.f_essid_regex != NULL) +- { +- printf("Error: ESSID regular expression already given. " +- "Aborting\n"); +- exit(EXIT_FAILURE); +- } +- +- lopt.f_essid_regex +- = pcre_compile(optarg, 0, &pcreerror, &pcreerroffset, NULL); +- +- if (lopt.f_essid_regex == NULL) +- { +- printf("Error: regular expression compilation failed at " +- "offset %d: %s; aborting\n", +- pcreerroffset, +- pcreerror); ++ COMPAT_PCRE_PRINT_ERROR(pcreerroffset, pcreerror); ++#endif + exit(EXIT_FAILURE); + } + #else diff --git a/net/aircrack-ng/patches/100-09-besside-ng-utilize-compat-pcre.patch b/net/aircrack-ng/patches/100-09-besside-ng-utilize-compat-pcre.patch new file mode 100644 index 000000000..532521e37 --- /dev/null +++ b/net/aircrack-ng/patches/100-09-besside-ng-utilize-compat-pcre.patch @@ -0,0 +1,165 @@ +From d7eb251f945524b419e8c90dd54c640d9922e5d5 Mon Sep 17 00:00:00 2001 +From: Andras Gemes +Date: Sat, 21 Jan 2023 19:31:31 +0100 +Subject: [PATCH 9/9] besside-ng: utilize compat-pcre + +--- + src/besside-ng/besside-ng.c | 94 ++++++++----------------------------- + 1 file changed, 20 insertions(+), 74 deletions(-) + +--- a/src/besside-ng/besside-ng.c ++++ b/src/besside-ng/besside-ng.c +@@ -57,13 +57,7 @@ + #include + #include + +-#ifdef HAVE_PCRE2 +-#define PCRE2_CODE_UNIT_WIDTH 8 +-#include +-#elif defined HAVE_PCRE +-#include +-#endif +- ++#include "aircrack-ng/pcre/compat-pcre.h" + #include "aircrack-ng/defs.h" + #include "aircrack-ng/aircrack-ng.h" + #include "aircrack-ng/version.h" +@@ -1122,7 +1116,7 @@ static void attack_ping(void * a) + timer_in(100 * 1000, attack_ping, n); + } + +-#ifdef HAVE_PCRE2 ++#if defined HAVE_PCRE2 || defined HAVE_PCRE + static int is_filtered_essid(char * essid) + { + REQUIRE(essid != NULL); +@@ -1131,39 +1125,20 @@ static int is_filtered_essid(char * essi + + if (_conf.cf_essid_regex) + { ++#ifdef HAVE_PCRE2 + _conf.cf_essid_match_data + = pcre2_match_data_create_from_pattern(_conf.cf_essid_regex, NULL); + +- return pcre2_match(_conf.cf_essid_regex, +- (PCRE2_SPTR) essid, +- (int) strnlen((char *) essid, MAX_IE_ELEMENT_SIZE), +- 0, +- 0, +- _conf.cf_essid_match_data, +- 0) ++ return COMPAT_PCRE_MATCH(_conf.cf_essid_regex, ++ essid, ++ MAX_IE_ELEMENT_SIZE, ++ _conf.cf_essid_match_data) + < 0; +- } +- +- return (ret); +-} + #elif defined HAVE_PCRE +-static int is_filtered_essid(char * essid) +-{ +- REQUIRE(essid != NULL); +- +- int ret = 0; +- +- if (_conf.cf_essid_regex) +- { +- return pcre_exec(_conf.cf_essid_regex, +- NULL, +- (char *) essid, +- strnlen((char *) essid, MAX_IE_ELEMENT_SIZE), +- 0, +- 0, +- NULL, +- 0) ++ return COMPAT_PCRE_MATCH( ++ _conf.cf_essid_regex, essid, MAX_IE_ELEMENT_SIZE, NULL) + < 0; ++#endif + } + + return (ret); +@@ -1178,12 +1153,7 @@ static int should_attack(struct network + if (_conf.cf_bssid && memcmp(_conf.cf_bssid, n->n_bssid, 6) != 0) + return (0); + +-#ifdef HAVE_PCRE2 +- if (is_filtered_essid(n->n_ssid)) +- { +- return (0); +- } +-#elif defined HAVE_PCRE ++#if defined HAVE_PCRE2 || defined HAVE_PCRE + if (is_filtered_essid(n->n_ssid)) + { + return (0); +@@ -3338,6 +3308,7 @@ int main(int argc, char * argv[]) + int ch, temp; + #ifdef HAVE_PCRE2 + int pcreerror; ++ PCRE2_UCHAR pcreerrorbuf[256]; + PCRE2_SIZE pcreerroffset; + #elif defined HAVE_PCRE + const char * pcreerror; +@@ -3393,7 +3364,7 @@ int main(int argc, char * argv[]) + break; + + case 'R': +-#ifdef HAVE_PCRE2 ++#if defined HAVE_PCRE2 || defined HAVE_PCRE + if (_conf.cf_essid_regex != NULL) + { + printf("Error: ESSID regular expression already given. " +@@ -3401,43 +3372,18 @@ int main(int argc, char * argv[]) + exit(EXIT_FAILURE); + } + +- _conf.cf_essid_regex = pcre2_compile((PCRE2_SPTR) optarg, +- PCRE2_ZERO_TERMINATED, +- 0, +- &pcreerror, +- &pcreerroffset, +- NULL); ++ _conf.cf_essid_regex ++ = COMPAT_PCRE_COMPILE(optarg, &pcreerror, &pcreerroffset); + + if (_conf.cf_essid_regex == NULL) + { +- PCRE2_UCHAR pcreerrbuffer[256]; ++#ifdef HAVE_PCRE2 + pcre2_get_error_message( +- pcreerror, pcreerrbuffer, sizeof(pcreerrbuffer)); +- +- printf("Error: regular expression compilation failed at " +- "offset %lu: %s; aborting\n", +- pcreerroffset, +- pcreerrbuffer); +- exit(EXIT_FAILURE); +- } +- break; ++ pcreerror, pcreerrorbuf, sizeof(pcreerrorbuf)); ++ COMPAT_PCRE_PRINT_ERROR(pcreerroffset, pcreerrorbuf); + #elif defined HAVE_PCRE +- if (_conf.cf_essid_regex != NULL) +- { +- printf("Error: ESSID regular expression already given. " +- "Aborting\n"); +- exit(EXIT_FAILURE); +- } +- +- _conf.cf_essid_regex +- = pcre_compile(optarg, 0, &pcreerror, &pcreerroffset, NULL); +- +- if (_conf.cf_essid_regex == NULL) +- { +- printf("Error: regular expression compilation failed at " +- "offset %d: %s; aborting\n", +- pcreerroffset, +- pcreerror); ++ COMPAT_PCRE_PRINT_ERROR(pcreerroffset, pcreerror); ++#endif + exit(EXIT_FAILURE); + } + break; diff --git a/net/aircrack-ng/patches/101-02-src-makefile-add-PCRE2_CFLAGS-to-airodump-and-bessid.patch b/net/aircrack-ng/patches/101-02-src-makefile-add-PCRE2_CFLAGS-to-airodump-and-bessid.patch new file mode 100644 index 000000000..c6338f562 --- /dev/null +++ b/net/aircrack-ng/patches/101-02-src-makefile-add-PCRE2_CFLAGS-to-airodump-and-bessid.patch @@ -0,0 +1,29 @@ +From 8c6a4f171b7d97a294590fab9dc2069b149b9b36 Mon Sep 17 00:00:00 2001 +From: Andras Gemes +Date: Mon, 23 Jan 2023 10:42:39 +0100 +Subject: [PATCH 2/6] src/makefile: add PCRE2_CFLAGS to airodump and besside + +--- + src/Makefile.inc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/src/Makefile.inc ++++ b/src/Makefile.inc +@@ -128,7 +128,7 @@ aireplay_ng_CFLAGS = $(COMMON_CFLAGS) $( + aireplay_ng_LDADD = $(COMMON_LDADD) $(LIBAIRCRACK_OSDEP_LIBS) $(LIBACCRYPTO_LIBS) $(AIRPCAP_LIBS) $(LIBAIRCRACK_LIBS) $(CRYPTO_LIBS) + + airodump_ng_SOURCES = $(SRC_ADU) $(SRC_DWRITE) +-airodump_ng_CFLAGS = $(COMMON_CFLAGS) $(PCRE_CFLAGS) $(LIBNL_CFLAGS) ++airodump_ng_CFLAGS = $(COMMON_CFLAGS) $(PCRE_CFLAGS) $(PCRE2_CFLAGS) $(LIBNL_CFLAGS) + airodump_ng_CPPFLAGS = $(AM_CPPFLAGS) -I$(abs_srcdir)/src/airodump-ng + airodump_ng_LDADD = $(COMMON_LDADD) $(PCRE_LIBS) $(PCRE2_LIBS) $(LIBAIRCRACK_OSDEP_LIBS) $(LIBACCRYPTO_LIBS) $(LIBAIRCRACK_CE_WEP_LIBS) $(AIRPCAP_LIBS) $(LIBAIRCRACK_LIBS) $(CRYPTO_LIBS) + +@@ -163,7 +163,7 @@ buddy_ng_CPPFLAGS = $(AM_CPPFLAGS) -I$(a + buddy_ng_LDADD = $(COMMON_LDADD) $(LIBAIRCRACK_LIBS) $(CRYPTO_LIBS) + + besside_ng_SOURCES = $(SRC_BS) +-besside_ng_CFLAGS = $(COMMON_CFLAGS) $(PCRE_CFLAGS) $(LIBNL_CFLAGS) ++besside_ng_CFLAGS = $(COMMON_CFLAGS) $(PCRE_CFLAGS) $(PCRE2_CFLAGS) $(LIBNL_CFLAGS) + besside_ng_LDADD = $(COMMON_LDADD) $(PCRE_LIBS) $(PCRE2_LIBS) $(LIBAIRCRACK_OSDEP_LIBS) $(LIBACCRYPTO_LIBS) $(LIBPTW_LIBS) $(AIRPCAP_LIBS) $(LIBAIRCRACK_LIBS) $(CRYPTO_LIBS) + + besside_ng_crawler_SOURCES = $(SRC_BC) diff --git a/net/aircrack-ng/patches/101-03-lib-makefile-add-PCRE2-to-libaccrypto-and-libaircrac.patch b/net/aircrack-ng/patches/101-03-lib-makefile-add-PCRE2-to-libaccrypto-and-libaircrac.patch new file mode 100644 index 000000000..803b18843 --- /dev/null +++ b/net/aircrack-ng/patches/101-03-lib-makefile-add-PCRE2-to-libaccrypto-and-libaircrac.patch @@ -0,0 +1,37 @@ +From 0be8f0d7d8e4a09ea5687bcec6690876b4161a0e Mon Sep 17 00:00:00 2001 +From: Andras Gemes +Date: Mon, 23 Jan 2023 10:46:26 +0100 +Subject: [PATCH 3/6] lib/makefile: add PCRE2 to libaccrypto and libaircrack + +--- + lib/Makefile.inc | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/lib/Makefile.inc ++++ b/lib/Makefile.inc +@@ -65,8 +65,8 @@ SRC_CRYPTO += %D%/crypto/sha1-git.c + endif + + libaccrypto_la_SOURCES = $(SRC_CRYPTO) +-libaccrypto_la_CFLAGS = $(COMMON_CFLAGS) $(PCRE_CFLAGS) +-libaccrypto_la_LIBADD = $(PCRE_LIBS) $(LIBAIRCRACK_OSDEP_LIBS) $(CRYPTO_LDFLAGS) $(CRYPTO_LIBS) ++libaccrypto_la_CFLAGS = $(COMMON_CFLAGS) $(PCRE_CFLAGS) $(PCRE2_CFLAGS) ++libaccrypto_la_LIBADD = $(PCRE_LIBS) $(PCRE2_LIBS) $(LIBAIRCRACK_OSDEP_LIBS) $(CRYPTO_LDFLAGS) $(CRYPTO_LIBS) + + libcowpatty_la_SOURCES = $(SRC_COW) + libcowpatty_la_CFLAGS = $(COMMON_CFLAGS) $(LIBCOW_CFLAGS) +@@ -121,12 +121,12 @@ SRC_LIBAC += %D%/libac/support/strlcpy.c + endif + + libaircrack_la_SOURCES = $(SRC_LIBAC) $(TRAMPOLINE) $(CPUSET) +-libaircrack_la_CFLAGS = $(COMMON_CFLAGS) $(PCRE_CFLAGS) \ ++libaircrack_la_CFLAGS = $(COMMON_CFLAGS) $(PCRE_CFLAGS) $(PCRE2_CFLAGS) \ + "-DLIBAIRCRACK_CE_WPA_PATH=\"$(LIBAIRCRACK_CE_WPA_PATH)\"" \ + "-DABS_TOP_SRCDIR=\"$(abs_top_srcdir)\"" \ + "-DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"" \ + "-DLIBDIR=\"$(libdir)\"" +-libaircrack_la_LIBADD = $(COMMON_LDADD) $(LIBAIRCRACK_OSDEP_LIBS) $(PCRE_LIBS) $(CRYPTO_LDFLAGS) $(CRYPTO_LIBS) ++libaircrack_la_LIBADD = $(COMMON_LDADD) $(LIBAIRCRACK_OSDEP_LIBS) $(PCRE_LIBS) $(PCRE2_LIBS) $(CRYPTO_LDFLAGS) $(CRYPTO_LIBS) + + if CYGWIN + libaircrack_la_LIBADD += -lshlwapi diff --git a/net/aircrack-ng/patches/102-autotools-indicate-if-PCRE-or-PCRE2-is-being-used.patch b/net/aircrack-ng/patches/102-autotools-indicate-if-PCRE-or-PCRE2-is-being-used.patch new file mode 100644 index 000000000..8dc2ce4d8 --- /dev/null +++ b/net/aircrack-ng/patches/102-autotools-indicate-if-PCRE-or-PCRE2-is-being-used.patch @@ -0,0 +1,132 @@ +From b381ef3f6b6cc83a4aa016f4c0aebb58fcffcf3f Mon Sep 17 00:00:00 2001 +From: Andras Gemes +Date: Mon, 23 Jan 2023 16:58:38 +0100 +Subject: [PATCH] autotools: indicate if PCRE or PCRE2 is being used + +--- + build/m4/aircrack_ng_pcre.m4 | 28 ++++++++++++++-- + build/m4/aircrack_ng_pcre2.m4 | 61 ----------------------------------- + configure.ac | 3 +- + 3 files changed, 26 insertions(+), 66 deletions(-) + delete mode 100644 build/m4/aircrack_ng_pcre2.m4 + +--- a/build/m4/aircrack_ng_pcre.m4 ++++ b/build/m4/aircrack_ng_pcre.m4 +@@ -55,7 +55,29 @@ else + PKG_CHECK_MODULES(PCRE, libpcre, HAVE_PCRE=yes, HAVE_PCRE=no) + fi + +-AS_IF([test "x$HAVE_PCRE" = "xyes"], [ ++AC_ARG_ENABLE(static-pcre2, ++ AS_HELP_STRING([--enable-static-pcre2], ++ [Enable statically linked PCRE2 libpcre2-8.]), ++ [static_pcre2=$enableval], [static_pcre2=no]) ++ ++if test "x$static_pcre2" != "xno"; then ++ AC_REQUIRE([AX_EXT_HAVE_STATIC_LIB_DETECT]) ++ AX_EXT_HAVE_STATIC_LIB(PCRE2, ${DEFAULT_STATIC_LIB_SEARCH_PATHS}, pcre2 libpcre2-8, pcre2_version) ++ if test "x$PCRE2_FOUND" = xyes; then ++ HAVE_PCRE2=yes ++ else ++ HAVE_PCRE2=no ++ fi ++else ++ PKG_CHECK_MODULES(PCRE2, libpcre2-8, HAVE_PCRE2=yes, HAVE_PCRE2=no) ++fi ++ ++if test "x$HAVE_PCRE" = "xyes" && test "x$HAVE_PCRE2" = "xyes"; then ++ AC_DEFINE([HAVE_PCRE2], [1], [Define this if you have libpcre2-8 on your system]) ++ PCRE2_NOTE="(Pcre and Pcre2 found, using Pcre2)" ++elif test "x$HAVE_PCRE" = "xyes"; then + AC_DEFINE([HAVE_PCRE], [1], [Define this if you have libpcre on your system]) +-]) +-]) ++elif test "x$HAVE_PCRE2" = "xyes"; then ++ AC_DEFINE([HAVE_PCRE2], [1], [Define this if you have libpcre2-8 on your system]) ++fi ++]) +\ No newline at end of file +--- a/build/m4/aircrack_ng_pcre2.m4 ++++ /dev/null +@@ -1,61 +0,0 @@ +-dnl Aircrack-ng +-dnl +-dnl Copyright (C) 2023 Andras Gemes +-dnl +-dnl Autotool support was written by: Joseph Benden +-dnl +-dnl This program is free software; you can redistribute it and/or modify +-dnl it under the terms of the GNU General Public License as published by +-dnl the Free Software Foundation; either version 2 of the License, or +-dnl (at your option) any later version. +-dnl +-dnl This program is distributed in the hope that it will be useful, +-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-dnl GNU General Public License for more details. +-dnl +-dnl You should have received a copy of the GNU General Public License +-dnl along with this program; if not, write to the Free Software +-dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +-dnl +-dnl In addition, as a special exception, the copyright holders give +-dnl permission to link the code of portions of this program with the +-dnl OpenSSL library under certain conditions as described in each +-dnl individual source file, and distribute linked combinations +-dnl including the two. +-dnl +-dnl You must obey the GNU General Public License in all respects +-dnl for all of the code used other than OpenSSL. +-dnl +-dnl If you modify file(s) with this exception, you may extend this +-dnl exception to your dnl version of the file(s), but you are not obligated +-dnl to do so. +-dnl +-dnl If you dnl do not wish to do so, delete this exception statement from your +-dnl version. +-dnl +-dnl If you delete this exception statement from all source files in the +-dnl program, then also delete it here. +- +-AC_DEFUN([AIRCRACK_NG_PCRE2], [ +-AC_ARG_ENABLE(static-pcre2, +- AS_HELP_STRING([--enable-static-pcre2], +- [Enable statically linked PCRE2 libpcre2-8.]), +- [static_pcre2=$enableval], [static_pcre2=no]) +- +-if test "x$static_pcre2" != "xno"; then +- AC_REQUIRE([AX_EXT_HAVE_STATIC_LIB_DETECT]) +- AX_EXT_HAVE_STATIC_LIB(PCRE2, ${DEFAULT_STATIC_LIB_SEARCH_PATHS}, pcre2 libpcre2-8, pcre2_version) +- if test "x$PCRE2_FOUND" = xyes; then +- HAVE_PCRE2=yes +- else +- HAVE_PCRE2=no +- fi +-else +- PKG_CHECK_MODULES(PCRE2, libpcre2-8, HAVE_PCRE2=yes, HAVE_PCRE2=no) +-fi +- +-AS_IF([test "x$HAVE_PCRE2" = "xyes"], [ +- AC_DEFINE([HAVE_PCRE2], [1], [Define this if you have libpcre2-8 on your system]) +-]) +-]) +\ No newline at end of file +--- a/configure.ac ++++ b/configure.ac +@@ -144,7 +144,6 @@ AIRCRACK_NG_EXT_SCRIPTS + AIRCRACK_NG_HWLOC + AIRCRACK_NG_PCAP + AIRCRACK_NG_PCRE +-AIRCRACK_NG_PCRE2 + AIRCRACK_NG_RFKILL + AIRCRACK_NG_SQLITE + AIRCRACK_NG_ZLIB +@@ -321,7 +320,7 @@ ${PACKAGE} ${VERSION} + Jemalloc: ${JEMALLOC} + Pcap: ${PCAP_FOUND} + Pcre: ${HAVE_PCRE} +- Pcre2: ${HAVE_PCRE2} ++ Pcre2: ${HAVE_PCRE2} ${PCRE2_NOTE} + Sqlite: ${HAVE_SQLITE3} + Tcmalloc: ${TCMALLOC} + Zlib: ${HAVE_ZLIB} diff --git a/net/aircrack-ng/patches/103-autotools-reset-PCRE-CFLAGS-LIBS-with-both-PCRE-and-.patch b/net/aircrack-ng/patches/103-autotools-reset-PCRE-CFLAGS-LIBS-with-both-PCRE-and-.patch new file mode 100644 index 000000000..677cb321d --- /dev/null +++ b/net/aircrack-ng/patches/103-autotools-reset-PCRE-CFLAGS-LIBS-with-both-PCRE-and-.patch @@ -0,0 +1,39 @@ +From b8d0b8cb6caa6940443b3e6ca32efc78d0c9d00e Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 1 Oct 2023 00:32:16 +0200 +Subject: [PATCH] autotools: reset PCRE CFLAGS/LIBS with both PCRE and PCRE2 + present + +Commit b381ef3f6b6c ("autotools: indicate if PCRE or PCRE2 is being +used") fixed a case where both pcre and pcre2 library are detected and +put a preference on using pcre2. + +Although the commit fix this corner case, there is still a latent +problem with trying to link/include both library. This is caused by the +fact that in the Makefile.inc for src and lib, we include both +PCRE_CFLAGS and PCRE2_CFLAGS and PCRE_LIBS and PCRE2_LIBS for each +tool/lib. + +To handle this and not bloat the Makefile with additional condition, +simply reset the PCRE_CFLAGS and PCRE_LIBS in case where we detect both +library and we prefer to use pcre2. + +Fixes: b381ef3f6b6c ("autotools: indicate if PCRE or PCRE2 is being used") +Signed-off-by: Christian Marangi +--- + build/m4/aircrack_ng_pcre.m4 | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/build/m4/aircrack_ng_pcre.m4 ++++ b/build/m4/aircrack_ng_pcre.m4 +@@ -75,6 +75,10 @@ fi + if test "x$HAVE_PCRE" = "xyes" && test "x$HAVE_PCRE2" = "xyes"; then + AC_DEFINE([HAVE_PCRE2], [1], [Define this if you have libpcre2-8 on your system]) + PCRE2_NOTE="(Pcre and Pcre2 found, using Pcre2)" ++ # Reset PCRE cflags and libs variables as we include both PCRE and PCRE2 in Makefile.inc ++ # and would result in trying to link/include both library. ++ PCRE_CFLAGS="" ++ PCRE_LIBS="" + elif test "x$HAVE_PCRE" = "xyes"; then + AC_DEFINE([HAVE_PCRE], [1], [Define this if you have libpcre on your system]) + elif test "x$HAVE_PCRE2" = "xyes"; then