├── README.md ├── libs ├── libnet-1.0.x │ ├── Makefile │ └── patches │ │ ├── 100-debian_subset.patch.gz │ │ ├── 150-portability.patch │ │ └── 200-no_cflags_ovveride.patch └── libnet-1.1.x │ ├── Makefile │ └── patches │ ├── 100-debian-subset.patch │ ├── 150-portability.patch │ └── 160-endian_cache.patch ├── network ├── Makefile ├── aircrack-ng-hak5-old │ ├── Makefile │ └── patches │ │ └── 001-fix_lspci_errors_pineapple.patch ├── aircrack-ng-hak5 │ ├── Config.in │ ├── Makefile │ └── patches │ │ └── 001-fix_lspci_errors_pineapple.patch ├── autossh │ ├── Makefile │ └── files │ │ ├── autossh.config │ │ ├── autossh.hotplug │ │ └── autossh.init ├── backdoorfactory │ └── Makefile ├── bettercap │ └── Makefile ├── bully │ ├── Makefile │ ├── README.md │ ├── src │ │ ├── 80211.c │ │ ├── 80211.h │ │ ├── Makefile │ │ ├── bswap.h │ │ ├── bully.c │ │ ├── bully.h │ │ ├── common │ │ │ ├── Makefile │ │ │ ├── defs.h │ │ │ ├── eapol_common.h │ │ │ ├── ieee802_11_common.c │ │ │ ├── ieee802_11_common.h │ │ │ ├── ieee802_11_defs.h │ │ │ ├── privsep_commands.h │ │ │ ├── version.h │ │ │ ├── wpa_common.c │ │ │ ├── wpa_common.h │ │ │ ├── wpa_ctrl.c │ │ │ └── wpa_ctrl.h │ │ ├── crc32.c │ │ ├── crypto │ │ │ ├── .gitignore │ │ │ ├── Makefile │ │ │ ├── aes-cbc.c │ │ │ ├── aes-ctr.c │ │ │ ├── aes-eax.c │ │ │ ├── aes-encblock.c │ │ │ ├── aes-internal-dec.c │ │ │ ├── aes-internal-enc.c │ │ │ ├── aes-internal.c │ │ │ ├── aes-omac1.c │ │ │ ├── aes-unwrap.c │ │ │ ├── aes-wrap.c │ │ │ ├── aes.h │ │ │ ├── aes_i.h │ │ │ ├── aes_wrap.h │ │ │ ├── crypto.h │ │ │ ├── crypto_cryptoapi.c │ │ │ ├── crypto_gnutls.c │ │ │ ├── crypto_internal-cipher.c │ │ │ ├── crypto_internal-modexp.c │ │ │ ├── crypto_internal-rsa.c │ │ │ ├── crypto_internal.c │ │ │ ├── crypto_libtomcrypt.c │ │ │ ├── crypto_none.c │ │ │ ├── crypto_nss.c │ │ │ ├── crypto_openssl.c │ │ │ ├── des-internal.c │ │ │ ├── des_i.h │ │ │ ├── dh_group5.c │ │ │ ├── dh_group5.h │ │ │ ├── dh_groups.c │ │ │ ├── dh_groups.h │ │ │ ├── fips_prf_cryptoapi.c │ │ │ ├── fips_prf_gnutls.c │ │ │ ├── fips_prf_internal.c │ │ │ ├── fips_prf_nss.c │ │ │ ├── fips_prf_openssl.c │ │ │ ├── md4-internal.c │ │ │ ├── md5-internal.c │ │ │ ├── md5-non-fips.c │ │ │ ├── md5.c │ │ │ ├── md5.h │ │ │ ├── md5_i.h │ │ │ ├── milenage.c │ │ │ ├── milenage.h │ │ │ ├── ms_funcs.c │ │ │ ├── ms_funcs.h │ │ │ ├── rc4.c │ │ │ ├── sha1-internal.c │ │ │ ├── sha1-pbkdf2.c │ │ │ ├── sha1-tlsprf.c │ │ │ ├── sha1-tprf.c │ │ │ ├── sha1.c │ │ │ ├── sha1.h │ │ │ ├── sha1_i.h │ │ │ ├── sha256-internal.c │ │ │ ├── sha256.c │ │ │ ├── sha256.h │ │ │ ├── tls.h │ │ │ ├── tls_gnutls.c │ │ │ ├── tls_internal.c │ │ │ ├── tls_none.c │ │ │ ├── tls_nss.c │ │ │ ├── tls_openssl.c │ │ │ └── tls_schannel.c │ │ ├── frame.c │ │ ├── frame.h │ │ ├── iface.c │ │ ├── iface.h │ │ ├── lua │ │ │ ├── pure_algorithm.lua │ │ │ ├── pure_wps.lua │ │ │ └── template.lua │ │ ├── luaclib.c │ │ ├── luaclib.h │ │ ├── pdust.c │ │ ├── pdust.h │ │ ├── pingen.c │ │ ├── pingen.h │ │ ├── timer.c │ │ ├── tls │ │ │ ├── .gitignore │ │ │ ├── Makefile │ │ │ ├── asn1.c │ │ │ ├── asn1.h │ │ │ ├── bignum.c │ │ │ ├── bignum.h │ │ │ ├── libtommath.c │ │ │ ├── pkcs1.c │ │ │ ├── pkcs1.h │ │ │ ├── pkcs5.c │ │ │ ├── pkcs5.h │ │ │ ├── pkcs8.c │ │ │ ├── pkcs8.h │ │ │ ├── rsa.c │ │ │ ├── rsa.h │ │ │ ├── tlsv1_client.c │ │ │ ├── tlsv1_client.h │ │ │ ├── tlsv1_client_i.h │ │ │ ├── tlsv1_client_read.c │ │ │ ├── tlsv1_client_write.c │ │ │ ├── tlsv1_common.c │ │ │ ├── tlsv1_common.h │ │ │ ├── tlsv1_cred.c │ │ │ ├── tlsv1_cred.h │ │ │ ├── tlsv1_record.c │ │ │ ├── tlsv1_record.h │ │ │ ├── tlsv1_server.c │ │ │ ├── tlsv1_server.h │ │ │ ├── tlsv1_server_i.h │ │ │ ├── tlsv1_server_read.c │ │ │ ├── tlsv1_server_write.c │ │ │ ├── x509v3.c │ │ │ └── x509v3.h │ │ ├── utils.c │ │ ├── utils │ │ │ ├── .gitignore │ │ │ ├── Makefile │ │ │ ├── base64.c │ │ │ ├── base64.h │ │ │ ├── build_config.h │ │ │ ├── common.c │ │ │ ├── common.h │ │ │ ├── eloop.c │ │ │ ├── eloop.h │ │ │ ├── eloop_none.c │ │ │ ├── eloop_win.c │ │ │ ├── includes.h │ │ │ ├── ip_addr.c │ │ │ ├── ip_addr.h │ │ │ ├── list.h │ │ │ ├── os.h │ │ │ ├── os_internal.c │ │ │ ├── os_none.c │ │ │ ├── os_unix.c │ │ │ ├── os_win32.c │ │ │ ├── pcsc_funcs.c │ │ │ ├── pcsc_funcs.h │ │ │ ├── radiotap.c │ │ │ ├── radiotap.h │ │ │ ├── radiotap_iter.h │ │ │ ├── state_machine.h │ │ │ ├── trace.c │ │ │ ├── trace.h │ │ │ ├── uuid.c │ │ │ ├── uuid.h │ │ │ ├── wpa_debug.c │ │ │ ├── wpa_debug.h │ │ │ ├── wpabuf.c │ │ │ └── wpabuf.h │ │ ├── version.h │ │ └── wps │ │ │ ├── Makefile │ │ │ ├── http.h │ │ │ ├── http_client.c │ │ │ ├── http_client.h │ │ │ ├── http_server.c │ │ │ ├── http_server.h │ │ │ ├── httpread.c │ │ │ ├── httpread.h │ │ │ ├── ndef.c │ │ │ ├── upnp_xml.c │ │ │ ├── upnp_xml.h │ │ │ ├── wps.c │ │ │ ├── wps.h │ │ │ ├── wps_attr_build.c │ │ │ ├── wps_attr_parse.c │ │ │ ├── wps_attr_process.c │ │ │ ├── wps_common.c │ │ │ ├── wps_defs.h │ │ │ ├── wps_dev_attr.c │ │ │ ├── wps_dev_attr.h │ │ │ ├── wps_enrollee.c │ │ │ ├── wps_er.c │ │ │ ├── wps_er.h │ │ │ ├── wps_er_ssdp.c │ │ │ ├── wps_i.h │ │ │ ├── wps_nfc.c │ │ │ ├── wps_nfc_pn531.c │ │ │ ├── wps_registrar.c │ │ │ ├── wps_ufd.c │ │ │ ├── wps_upnp.c │ │ │ ├── wps_upnp.h │ │ │ ├── wps_upnp_ap.c │ │ │ ├── wps_upnp_event.c │ │ │ ├── wps_upnp_i.h │ │ │ ├── wps_upnp_ssdp.c │ │ │ └── wps_upnp_web.c │ └── version.mk ├── dsniff │ ├── Makefile │ └── patches │ │ ├── 001-arpspoof_fix.patch │ │ ├── 001-decode_pop.patch │ │ ├── 001-dns.patch │ │ ├── 003-gdbm.patch │ │ ├── 004-no_yp.patch │ │ ├── 005-openssl_fix.patch │ │ ├── 006-pcap_header.patch │ │ ├── 007-time_h.patch │ │ ├── 008-md5_include.patch │ │ └── 010-clk-tck-fix.patch ├── ettercap │ ├── Makefile │ └── patches │ │ ├── 001-cmake_in_source_build.patch │ │ ├── 001-cross_compiling.patch │ │ ├── 002-cmake_iconv_names.patch │ │ ├── 002-libnet_check_honor_ldflags.patch │ │ └── 003-automake-compat.patch ├── files │ └── kismet_package.conf ├── hcxtools │ ├── Makefile │ └── patches │ │ └── 010-openssl.patch ├── kismet-hak5 │ ├── Makefile │ └── files │ │ └── kismet_package.conf ├── kismet-master │ ├── Makefile │ └── files │ │ └── kismet_package.conf ├── kismet-remotecap-hak5 │ └── Makefile ├── mdk3 │ ├── Makefile │ └── patches │ │ ├── 001-radiotap_needs_types_h.patch │ │ ├── 010-fix-dependencies.patch │ │ └── 020-Makefile_honour_CFLAGS_for_VFP.patch ├── ngrep │ ├── Makefile │ └── patches │ │ ├── 001-makefile_in.patch │ │ └── 001-ngrep.patch ├── p0f │ ├── Makefile │ └── patches │ │ └── 001-build.sh.patch ├── reaver │ └── Makefile ├── sslsplit │ ├── Makefile │ └── patches │ │ └── GNUmakefile.patch └── sslstrip │ └── Makefile └── utils └── at ├── Makefile ├── files └── atd.init └── patches ├── 100-remove-glibc-assumption.patch └── 110-getloadavg.patch /README.md: -------------------------------------------------------------------------------- 1 | # WiFi Pineapple Community Packages 2 | 3 | This repository contains the OpenWrt packages for the WiFi Pineapple community repository. Packages found inside this repository will be available to download to a WiFi Pineapple via opkg. 4 | 5 | To contribute, please submit a pull request. 6 | -------------------------------------------------------------------------------- /libs/libnet-1.0.x/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2006-2014 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=libnet0 11 | PKG_VERSION:=1.0.2a 12 | PKG_RELEASE:=9 13 | 14 | PKG_SOURCE:=libnet-$(PKG_VERSION).tar.gz 15 | PKG_SOURCE_URL:=http://www.packetfactory.net/libnet/dist/deprecated/ 16 | PKG_MD5SUM:=ddf53f0f484184390e8c2a1bd0853667 17 | 18 | PKG_BUILD_DIR:=$(BUILD_DIR)/Libnet-$(PKG_VERSION) 19 | PKG_FIXUP:=autoreconf 20 | PKG_INSTALL:=1 21 | 22 | include $(INCLUDE_DIR)/package.mk 23 | 24 | define Package/libnet0 25 | SECTION:=libs 26 | CATEGORY:=Libraries 27 | DEPENDS:=+libpcap 28 | TITLE:=Low-level packet creation library (v1.0.x) 29 | URL:=http://www.packetfactory.net/libnet/ 30 | endef 31 | 32 | ENDIANESS:=lil 33 | ifeq ($(CONFIG_BIG_ENDIAN),y) 34 | ENDIANESS:=big 35 | endif 36 | 37 | TARGET_CFLAGS += $(FPIC) 38 | 39 | CONFIGURE_ARGS += \ 40 | --enable-shared \ 41 | --enable-static \ 42 | --with-pf_packet=yes 43 | 44 | CONFIGURE_VARS += \ 45 | ac_cv_libnet_endianess=$(ENDIANESS) \ 46 | ac_libnet_have_pf_packet=yes \ 47 | LL_INT_TYPE=sockpacket 48 | 49 | define Build/Configure 50 | (cd $(PKG_BUILD_DIR); touch \ 51 | configure.in \ 52 | include.m4 \ 53 | aclocal.m4 \ 54 | Makefile.in \ 55 | configure \ 56 | ); 57 | $(call Build/Configure/Default) 58 | endef 59 | 60 | define Build/InstallDev 61 | $(INSTALL_DIR) $(1)/usr/lib/libnet-1.0.x/bin/ 62 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/libnet-config $(1)/usr/lib/libnet-1.0.x/bin/ 63 | $(INSTALL_DIR) $(1)/usr/lib/libnet-1.0.x/include 64 | $(CP) $(PKG_INSTALL_DIR)/usr/include/libnet* $(1)/usr/lib/libnet-1.0.x/include/ 65 | $(INSTALL_DIR) $(1)/usr/lib/libnet-1.0.x/lib 66 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.{a,so*} $(1)/usr/lib/libnet-1.0.x/lib/ 67 | endef 68 | 69 | define Package/libnet0/install 70 | $(INSTALL_DIR) $(1)/usr/lib 71 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.so.* $(1)/usr/lib/ 72 | endef 73 | 74 | $(eval $(call BuildPackage,libnet0)) 75 | -------------------------------------------------------------------------------- /libs/libnet-1.0.x/patches/100-debian_subset.patch.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak5/nano-tetra-packages-community/44b6ae0bbd18ddc445fcb7779e059d1bea2cd86d/libs/libnet-1.0.x/patches/100-debian_subset.patch.gz -------------------------------------------------------------------------------- /libs/libnet-1.0.x/patches/150-portability.patch: -------------------------------------------------------------------------------- 1 | diff -ur libnet.old/configure libnet.dev/configure 2 | --- libnet.old/configure 2007-04-01 17:36:55.000000000 +0200 3 | +++ libnet.dev/configure 2007-04-01 17:40:06.000000000 +0200 4 | @@ -8613,7 +8613,9 @@ 5 | echo "$as_me:$LINENO: checking low-level packet interface type" >&5 6 | echo $ECHO_N "checking low-level packet interface type... $ECHO_C" >&6 7 | 8 | -if test -r /dev/bpf0 ; then 9 | +if [ -n "$LL_INT_TYPE" ]; then 10 | + echo "$as_me:$LINENO: result: found $LL_INT_TYPE (cached)" >&5 11 | +elif test -r /dev/bpf0 ; then 12 | LL_INT_TYPE=bpf 13 | echo "$as_me:$LINENO: result: found bpf" >&5 14 | echo "${ECHO_T}found bpf" >&6 15 | diff -ur libnet.old/configure.in libnet.dev/configure.in 16 | --- libnet.old/configure.in 2007-04-01 17:36:55.000000000 +0200 17 | +++ libnet.dev/configure.in 2007-04-01 17:41:08.000000000 +0200 18 | @@ -97,7 +97,9 @@ 19 | dnl 20 | AC_MSG_CHECKING(low-level packet interface type) 21 | 22 | -if test -r /dev/bpf0 ; then 23 | +if [ -n "$LL_INT_TYPE" ]; then 24 | + AC_MSG_RESULT(found $LL_INT_TYPE (cached)) 25 | +elif test -r /dev/bpf0 ; then 26 | LL_INT_TYPE=bpf 27 | AC_MSG_RESULT(found bpf) 28 | elif test -r /usr/include/net/pfilt.h ; then 29 | -------------------------------------------------------------------------------- /libs/libnet-1.0.x/patches/200-no_cflags_ovveride.patch: -------------------------------------------------------------------------------- 1 | --- a/configure.in 2014-03-06 14:55:36.627221831 -0800 2 | +++ b/configure.in 2014-03-06 14:56:48.709112089 -0800 3 | @@ -53,16 +53,6 @@ 4 | 5 | 6 | dnl 7 | -dnl Use these compiler flags if we have gcc. 8 | -dnl 9 | -if test $ac_cv_prog_gcc = yes; then 10 | -dnl if test -z $CFLAGS; then 11 | - CCOPTS='-O2 -funroll-loops -fomit-frame-pointer -Wall' 12 | - CFLAGS="$CCOPTS" 13 | -dnl fi 14 | -fi 15 | - 16 | -dnl 17 | dnl Check for package inclusion/exclusion 18 | dnl 19 | AC_ARG_WITH(pf_packet, [ --with-pf_packet=[yes,no] override defaults], \ 20 | -------------------------------------------------------------------------------- /libs/libnet-1.1.x/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2006-2013 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=libnet 11 | PKG_VERSION:=1.1.6 12 | PKG_RELEASE:=1 13 | 14 | PKG_SOURCE:=$(PKG_NAME).tar.gz 15 | PKG_SOURCE_URL:=@SF/$(PKG_NAME) 16 | PKG_MD5SUM:=be845c41170d72c7db524f3411b50256 17 | 18 | PKG_BUILD_DIR:=$(BUILD_DIR)/libnet 19 | 20 | PKG_FIXUP:=autoreconf 21 | PKG_INSTALL:=1 22 | 23 | include $(INCLUDE_DIR)/package.mk 24 | 25 | define Package/libnet1 26 | SECTION:=libs 27 | CATEGORY:=Libraries 28 | DEPENDS:=+libpcap 29 | TITLE:=Low-level packet creation library (v1.1.x) 30 | URL:=http://www.packetfactory.net/libnet/ 31 | endef 32 | 33 | ENDIANESS:=lil 34 | ifeq ($(CONFIG_BIG_ENDIAN),y) 35 | ENDIANESS:=big 36 | endif 37 | 38 | TARGET_CFLAGS += $(FPIC) 39 | 40 | CONFIGURE_ARGS += \ 41 | --enable-shared \ 42 | --enable-static \ 43 | --with-pf_packet=yes 44 | 45 | CONFIGURE_VARS += \ 46 | ac_cv_libnet_endianess=$(ENDIANESS) \ 47 | ac_libnet_have_pf_packet=yes \ 48 | LL_INT_TYPE=libnet_link_linux 49 | 50 | define Build/Configure 51 | (cd $(PKG_BUILD_DIR); touch \ 52 | configure.in \ 53 | include.m4 \ 54 | aclocal.m4 \ 55 | Makefile.in \ 56 | configure \ 57 | ); 58 | $(call Build/Configure/Default) 59 | endef 60 | 61 | define Build/InstallDev 62 | $(INSTALL_DIR) $(1)/usr/lib/libnet-1.1.x/bin 63 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/libnet-config $(1)/usr/lib/libnet-1.1.x/bin/ 64 | $(INSTALL_DIR) $(1)/usr/lib/libnet-1.1.x/include 65 | $(CP) $(PKG_INSTALL_DIR)/usr/include/libnet* $(1)/usr/lib/libnet-1.1.x/include/ 66 | $(INSTALL_DIR) $(1)/usr/lib/libnet-1.1.x/lib 67 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.{a,so*} $(1)/usr/lib/libnet-1.1.x/lib/ 68 | endef 69 | 70 | define Package/libnet1/install 71 | $(INSTALL_DIR) $(1)/usr/lib 72 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.so.* $(1)/usr/lib/ 73 | endef 74 | 75 | $(eval $(call BuildPackage,libnet1)) 76 | -------------------------------------------------------------------------------- /libs/libnet-1.1.x/patches/100-debian-subset.patch: -------------------------------------------------------------------------------- 1 | --- a/configure.in 2 | +++ b/configure.in 3 | @@ -21,7 +21,7 @@ dnl Check for the usual programs 4 | dnl 5 | AC_PROG_CC 6 | AC_PROG_INSTALL 7 | -AC_PROG_RANLIB 8 | +AC_PROG_LIBTOOL 9 | 10 | AC_CHECK_HEADERS(sys/sockio.h) 11 | 12 | --- a/include/libnet/libnet-functions.h 13 | +++ b/include/libnet/libnet-functions.h 14 | @@ -1429,7 +1429,7 @@ libnet_t *l, libnet_ptag_t ptag); 15 | * @param ptag protocol tag to modify an existing header, 0 to build a new one 16 | * @return protocol tag value on success, -1 on error 17 | */ 18 | -inline u_int32_t 19 | +u_int32_t 20 | libnet_getgre_length(u_int16_t fv); 21 | 22 | /** 23 | --- a/Makefile.am 24 | +++ b/Makefile.am 25 | @@ -12,4 +12,4 @@ SUBDIRS = include src sample 26 | 27 | EXTRA_DIST = Makefile.am.common 28 | 29 | -bin_scripts = libnet-config 30 | +bin_SCRIPTS = libnet-config 31 | --- a/sample/Makefile.am 32 | +++ b/sample/Makefile.am 33 | @@ -60,4 +60,4 @@ ip_raw_SOURCES = ip_raw.c 34 | ip_link_SOURCES = ip_link.c 35 | sebek_SOURCES = sebek.c 36 | 37 | -LDADD = $(top_srcdir)/src/libnet.a 38 | +LDADD = $(top_srcdir)/src/libnet.la 39 | --- a/src/libnet_checksum.c 40 | +++ b/src/libnet_checksum.c 41 | @@ -42,8 +42,10 @@ int 42 | libnet_in_cksum(u_int16_t *addr, int len) 43 | { 44 | int sum; 45 | + u_int16_t last_byte; 46 | 47 | sum = 0; 48 | + last_byte = 0; 49 | 50 | while (len > 1) 51 | { 52 | @@ -52,7 +54,8 @@ libnet_in_cksum(u_int16_t *addr, int len 53 | } 54 | if (len == 1) 55 | { 56 | - sum += *(u_int16_t *)addr; 57 | + *(u_int8_t*)&last_byte = *(u_int8_t*)addr; 58 | + sum += last_byte; 59 | } 60 | 61 | return (sum); 62 | --- a/src/Makefile.am 63 | +++ b/src/Makefile.am 64 | @@ -8,9 +8,9 @@ 65 | 66 | include $(top_srcdir)/Makefile.am.common 67 | 68 | -lib_LIBRARIES = libnet.a 69 | +lib_LTLIBRARIES = libnet.la 70 | 71 | -libnet_a_SOURCES = libnet_asn1.c \ 72 | +libnet_la_SOURCES = libnet_asn1.c \ 73 | libnet_build_802.1q.c \ 74 | libnet_build_802.1x.c \ 75 | libnet_build_802.2.c \ 76 | @@ -57,15 +57,20 @@ libnet_a_SOURCES = libnet_asn1.c \ 77 | libnet_version.c \ 78 | libnet_write.c 79 | 80 | -EXTRA_libnet_a_SOURCES = libnet_link_bpf.c \ 81 | - libnet_link_dlpi.c \ 82 | - libnet_link_linux.c \ 83 | - libnet_link_nit.c \ 84 | - libnet_link_none.c \ 85 | - libnet_link_pf.c \ 86 | - libnet_link_snit.c \ 87 | - libnet_link_snoop.c \ 88 | - libnet_link_win32.c 89 | - 90 | -libnet_a_LIBADD = @LIBOBJS@ 91 | +libnet_la_LIBADD = @LTLIBOBJS@ 92 | 93 | +# Here are a set of rules to help you update your library version 94 | +# information: 95 | +# 96 | +# 1. If the library source code has changed at all since the last 97 | +# update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). 98 | +# 99 | +# 2. If any interfaces have been added, removed, or changed since the 100 | +# last update, increment CURRENT, and set REVISION to 0. 101 | +# 102 | +# 3. If any interfaces have been added since the last public release, 103 | +# then increment AGE. 104 | +# 105 | +# 4. If any interfaces have been removed since the last public release, 106 | +# then set AGE to 0. 107 | +libnet_la_LDFLAGS = -version-info 4:0:3 # CURRENT[:REVISION[:AGE]] 108 | -------------------------------------------------------------------------------- /libs/libnet-1.1.x/patches/150-portability.patch: -------------------------------------------------------------------------------- 1 | --- a/configure.in 2 | +++ b/configure.in 3 | @@ -67,7 +67,10 @@ dnl Get link-layer interface type 4 | dnl 5 | AC_MSG_CHECKING(link-layer packet interface type) 6 | 7 | -if test -r /dev/bpf0 ; then 8 | +if test -n "$LL_INT_TYPE"; then 9 | + AC_LIBOBJ($LL_INT_TYPE) 10 | + AC_MSG_RESULT(found $LL_INT_TYPE (cached)) 11 | +elif test -r /dev/bpf0 ; then 12 | AC_LIBOBJ([libnet_link_bpf]) 13 | AC_MSG_RESULT(found bpf) 14 | elif test -r /usr/include/net/pfilt.h ; then 15 | -------------------------------------------------------------------------------- /libs/libnet-1.1.x/patches/160-endian_cache.patch: -------------------------------------------------------------------------------- 1 | --- a/acinclude.m4 2 | +++ b/acinclude.m4 3 | @@ -281,6 +281,7 @@ dnl 4 | AC_DEFUN(AC_LIBNET_ENDIAN_CHECK, 5 | [AC_MSG_CHECKING(machine endianess) 6 | 7 | + if \! test x${ac_cv_libnet_endianess+set} = xset ; then 8 | cat > conftest.c << EOF 9 | # include 10 | # include 11 | @@ -332,6 +333,7 @@ dnl failed to compile for some reason 12 | fi 13 | fi 14 | rm -f conftest* core core.conftest 15 | + fi 16 | 17 | AC_MSG_RESULT($ac_cv_libnet_endianess) 18 | 19 | -------------------------------------------------------------------------------- /network/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=kismet-hak5 4 | PKG_VERSION:=2020-03-R1 5 | PKG_RELEASE:=1 6 | 7 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 8 | PKG_SOURCE_PROTO:=git 9 | PKG_SOURCE_URL:=https://github.com/kismetwireless/kismet.git 10 | PKG_SOURCE_VERSION:=925cf90e0112a0bfc926e21e0fae4503ae3b7a78 11 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz 12 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 13 | 14 | include $(INCLUDE_DIR)/package.mk 15 | 16 | PKG_USE_MIPS16:=0 17 | 18 | HOST_BUILD_DEPENDS:=protobuf/host 19 | 20 | define Package/kismet-hak5 21 | SECTION:=net 22 | CATEGORY:=Network 23 | TITLE:=Kismet (Hak5) 24 | URL:=https://www.kismetwireless.net/ 25 | DEPENDS:=+libpthread +libpcap +libpcre +libmicrohttpd +libnl +libcap +libstdcpp +libncurses +libsqlite3 +zlib +protobuf-lite +libprotobuf-c +libdw 26 | SUBMENU:=wireless 27 | endef 28 | 29 | define Package/kismet-hak5/description 30 | Kismet wireless capture and IDS 31 | Latest web UI based Kismet 32 | Linux Wi-Fi and Bluetooth capture tools 33 | endef 34 | 35 | define Build/Configure 36 | $(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR)) 37 | endef 38 | 39 | CONFIGURE_ARGS += \ 40 | --sysconfdir=/etc/kismet \ 41 | --bindir=/usr/bin \ 42 | --disable-python-tools \ 43 | --with-protoc=$(STAGING_DIR_HOSTPKG)/bin/protoc \ 44 | --enable-protobuflite 45 | 46 | # Override libs to force lpthread because we don't detect it properly on openwrt 47 | CONFIGURE_VARS += \ 48 | CXXFLAGS="$$$$CXXFLAGS" \ 49 | LIBS="-lm -lpthread" 50 | 51 | define Build/Compile 52 | $(MAKE) -C $(PKG_BUILD_DIR) \ 53 | LD="$(TARGET_CXX)" \ 54 | all 55 | endef 56 | 57 | define Package/kismet-hak5/install 58 | $(INSTALL_DIR) $(1)/usr/bin 59 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/kismet $(1)/usr/bin/ 60 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/kismet_cap_pcapfile $(1)/usr/bin/ 61 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/capture_linux_wifi/kismet_cap_linux_wifi $(1)/usr/bin/ 62 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/capture_linux_bluetooth/kismet_cap_linux_bluetooth $(1)/usr/bin/ 63 | 64 | $(INSTALL_DIR) $(1)/etc/kismet/ 65 | $(INSTALL_CONF) ./files/kismet_package.conf $(1)/etc/kismet 66 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet.conf $(1)/etc/kismet 67 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_80211.conf $(1)/etc/kismet 68 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_alerts.conf $(1)/etc/kismet 69 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_filter.conf $(1)/etc/kismet 70 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_httpd.conf $(1)/etc/kismet 71 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_logging.conf $(1)/etc/kismet 72 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_memory.conf $(1)/etc/kismet 73 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_storage.conf $(1)/etc/kismet 74 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_uav.conf $(1)/etc/kismet 75 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_manuf.txt $(1)/etc/kismet 76 | cp -Rv $(PKG_BUILD_DIR)/http_data $(1)/etc/kismet/ 77 | endef 78 | 79 | $(eval $(call BuildPackage,kismet-hak5)) 80 | -------------------------------------------------------------------------------- /network/aircrack-ng-hak5-old/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2006-2015 OpenWrt.org 3 | # Copyright (C) 2018 seb@hak5.org 4 | # Copyright (C) 2018 adde88@gmail.com 5 | # Copyright (C) 2019 marc@hak5.org 6 | # 7 | # This is free software, licensed under the GNU General Public License v2. 8 | # See /LICENSE for more information. 9 | # 10 | 11 | include $(TOPDIR)/rules.mk 12 | 13 | PKG_NAME:=aircrack-ng-hak5-old 14 | PKG_VERSION:=1.5.2 15 | PKG_RELEASE:=1 16 | PKG_LICENSE:=GPLv2 17 | 18 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 19 | PKG_SOURCE_PROTO:=git 20 | PKG_SOURCE_URL:=https://github.com/aircrack-ng/aircrack-ng.git 21 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 22 | PKG_SOURCE_VERSION:=5b5e3d0600b07bdf0735f25a71b02ab3ba822bd9 23 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz 24 | 25 | PKG_FIXUP:=autoreconf 26 | 27 | PKG_BUILD_PARALLEL:=1 28 | PKG_INSTALL:=1 29 | 30 | include $(INCLUDE_DIR)/package.mk 31 | 32 | define Package/aircrack-ng-hak5-old 33 | SECTION:=net 34 | CATEGORY:=Network 35 | DEPENDS:=+libpcap +libpthread +libopenssl +libnl +wireless-tools +ethtool +libstdcpp +libpcre +libsqlite3 36 | TITLE:=WLAN tools for breaking 802.11 WEP/WPA keys 37 | URL:=https://www.aircrack-ng.org/ 38 | MAINTAINER:=Andreas Nilsen 39 | SUBMENU:=wireless 40 | endef 41 | 42 | define Package/aircrack-ng-hak5-old/description 43 | WLAN tools for breaking 802.11 WEP/WPA keys 44 | endef 45 | 46 | MAKE_FLAGS+= pkglibexecdir=/usr/bin \ 47 | prefix=/usr \ 48 | OSNAME=Linux 49 | 50 | CFLAGS="$(TARGET_CFLAGS) -Wall -Iinclude/ $(TARGET_CPPFLAGS) -D_REVISION=0" -msse -msse2 -msse3 \ 51 | 52 | define Package/aircrack-ng-hak5-old/install 53 | $(INSTALL_DIR) $(1)/usr/bin 54 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ 55 | $(INSTALL_DIR) $(1)/usr/sbin 56 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ 57 | endef 58 | 59 | $(eval $(call BuildPackage,aircrack-ng-hak5-old)) 60 | -------------------------------------------------------------------------------- /network/aircrack-ng-hak5-old/patches/001-fix_lspci_errors_pineapple.patch: -------------------------------------------------------------------------------- 1 | --- a/scripts/airmon-ng.linux 2 | +++ b/scripts/airmon-ng.linux 3 | @@ -105,27 +105,28 @@ 4 | LSUSB=0 5 | fi 6 | 7 | -if [ -d /sys/bus/pci ] || [ -d /sys/bus/pci_express ] || [ -d /proc/bus/pci ]; then 8 | - PCI_DEVICES=0 9 | - if [ -d /sys/bus/pci/devices ] && [ "$(ls -1 /sys/bus/pci/devices 2>/dev/null | wc -l)" != '0' ]; then 10 | - PCI_DEVICES=1 11 | - elif [ -r /proc/bus/pci/devices ] && [ -n "$(cat /proc/bus/pci/devices 2>/dev/null)" ]; then 12 | - PCI_DEVICES=1 13 | - elif [ -d /sys/bus/pci_express/devices ] && [ -n "$(ls -1 /sys/bus/pci_express/devices 2>/dev/null | wc -l)" != '0' ]; then 14 | - PCI_DEVICES=1 15 | - fi 16 | +LSPCI=0 17 | +# if [ -d /sys/bus/pci ] || [ -d /sys/bus/pci_express ] || [ -d /proc/bus/pci ]; then 18 | +# PCI_DEVICES=0 19 | +# if [ -d /sys/bus/pci/devices ] && [ "$(ls -1 /sys/bus/pci/devices 2>/dev/null | wc -l)" != '0' ]; then 20 | +# PCI_DEVICES=1 21 | +# elif [ -r /proc/bus/pci/devices ] && [ -n "$(cat /proc/bus/pci/devices 2>/dev/null)" ]; then 22 | +# PCI_DEVICES=1 23 | +# elif [ -d /sys/bus/pci_express/devices ] && [ -n "$(ls -1 /sys/bus/pci_express/devices 2>/dev/null | wc -l)" != '0' ]; then 24 | +# PCI_DEVICES=1 25 | +# fi 26 | 27 | - if [ ${PCI_DEVICES} -eq 0 ]; then 28 | - LSPCI=0 29 | - elif [ ! -x "$(command -v lspci 2>&1)" ]; then 30 | - printf "Please install lspci from your distro's package manager.\n" 31 | - exit 1 32 | - else 33 | - LSPCI=1 34 | - fi 35 | -else 36 | - LSPCI=0 37 | -fi 38 | +# if [ ${PCI_DEVICES} -eq 0 ]; then 39 | +# LSPCI=0 40 | +# elif [ ! -x "$(command -v lspci 2>&1)" ]; then 41 | +# printf "Please install lspci from your distro's package manager.\n" 42 | +# exit 1 43 | +# else 44 | +# LSPCI=1 45 | +# fi 46 | +# else 47 | +# LSPCI=0 48 | +# fi 49 | 50 | if [ -f /proc/modules ] || [ -d /sys/module ]; then 51 | if [ ! -x "$(command -v modprobe 2>&1)" ]; then 52 | -------------------------------------------------------------------------------- /network/aircrack-ng-hak5/Config.in: -------------------------------------------------------------------------------- 1 | if PACKAGE_aircrack-ng-hak5 2 | 3 | comment "SSL support" 4 | 5 | choice 6 | prompt "Select SSL library" 7 | default AIRCRACK_NG_HAK5_OPENSSL 8 | 9 | config AIRCRACK_NG_HAK5_OPENSSL 10 | bool "openssl" 11 | 12 | config AIRCRACK_NG_HAK5_GCRYPT 13 | bool "gcrypt" 14 | endchoice 15 | 16 | config AIRCRACK_NG_HAK5_OPTIMIZE_SPEED 17 | bool "Optimize for speed" 18 | default n 19 | help 20 | This enables additional optimization and 21 | increases performance considerably at the 22 | expense of binary size. 23 | 24 | comment "Miscellaneous" 25 | 26 | config AIRCRACK_NG_HAK5_HWLOC 27 | bool "Hwloc support" 28 | default n 29 | 30 | config AIRCRACK_NG_HAK5_SQLITE3 31 | bool "Sqlite3 support" 32 | default n 33 | 34 | endif 35 | -------------------------------------------------------------------------------- /network/aircrack-ng-hak5/patches/001-fix_lspci_errors_pineapple.patch: -------------------------------------------------------------------------------- 1 | --- a/scripts/airmon-ng.linux 2 | +++ b/scripts/airmon-ng.linux 3 | @@ -105,27 +105,28 @@ 4 | LSUSB=0 5 | fi 6 | 7 | -if [ -d /sys/bus/pci ] || [ -d /sys/bus/pci_express ] || [ -d /proc/bus/pci ]; then 8 | - PCI_DEVICES=0 9 | - if [ -d /sys/bus/pci/devices ] && [ "$(ls -1 /sys/bus/pci/devices 2>/dev/null | wc -l)" != '0' ]; then 10 | - PCI_DEVICES=1 11 | - elif [ -r /proc/bus/pci/devices ] && [ -n "$(cat /proc/bus/pci/devices 2>/dev/null)" ]; then 12 | - PCI_DEVICES=1 13 | - elif [ -d /sys/bus/pci_express/devices ] && [ -n "$(ls -1 /sys/bus/pci_express/devices 2>/dev/null | wc -l)" != '0' ]; then 14 | - PCI_DEVICES=1 15 | - fi 16 | +LSPCI=0 17 | +# if [ -d /sys/bus/pci ] || [ -d /sys/bus/pci_express ] || [ -d /proc/bus/pci ]; then 18 | +# PCI_DEVICES=0 19 | +# if [ -d /sys/bus/pci/devices ] && [ "$(ls -1 /sys/bus/pci/devices 2>/dev/null | wc -l)" != '0' ]; then 20 | +# PCI_DEVICES=1 21 | +# elif [ -r /proc/bus/pci/devices ] && [ -n "$(cat /proc/bus/pci/devices 2>/dev/null)" ]; then 22 | +# PCI_DEVICES=1 23 | +# elif [ -d /sys/bus/pci_express/devices ] && [ -n "$(ls -1 /sys/bus/pci_express/devices 2>/dev/null | wc -l)" != '0' ]; then 24 | +# PCI_DEVICES=1 25 | +# fi 26 | 27 | - if [ ${PCI_DEVICES} -eq 0 ]; then 28 | - LSPCI=0 29 | - elif [ ! -x "$(command -v lspci 2>&1)" ]; then 30 | - printf "Please install lspci from your distro's package manager.\n" 31 | - exit 1 32 | - else 33 | - LSPCI=1 34 | - fi 35 | -else 36 | - LSPCI=0 37 | -fi 38 | +# if [ ${PCI_DEVICES} -eq 0 ]; then 39 | +# LSPCI=0 40 | +# elif [ ! -x "$(command -v lspci 2>&1)" ]; then 41 | +# printf "Please install lspci from your distro's package manager.\n" 42 | +# exit 1 43 | +# else 44 | +# LSPCI=1 45 | +# fi 46 | +# else 47 | +# LSPCI=0 48 | +# fi 49 | 50 | if [ -f /proc/modules ] || [ -d /sys/module ]; then 51 | if [ ! -x "$(command -v modprobe 2>&1)" ]; then 52 | -------------------------------------------------------------------------------- /network/autossh/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2006-2012 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=autossh 11 | PKG_VERSION:=1.4b 12 | PKG_RELEASE:=6 13 | 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz 15 | PKG_SOURCE_URL:=http://www.harding.motd.ca/autossh/ 16 | PKG_MD5SUM:=8f9aa006f6f69e912d3c2f504622d6f7 17 | 18 | include $(INCLUDE_DIR)/package.mk 19 | 20 | define Package/autossh 21 | SECTION:=net 22 | CATEGORY:=Network 23 | TITLE:=Autossh client 24 | URL:=http://www.harding.motd.ca/autossh/ 25 | SUBMENU:=SSH 26 | endef 27 | 28 | define Build/Compile 29 | $(call Build/Compile/Default, -f Makefile \ 30 | CFLAGS="$(TARGET_CFLAGS) -Wall -D\"SSH_PATH=\\\"\$$$$(SSH)\\\"\" -D\"VER=\\\"\$$$$(VER)\\\"\"" \ 31 | all \ 32 | ) 33 | endef 34 | 35 | define Package/autossh/install 36 | $(INSTALL_DIR) $(1)/usr/sbin 37 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/autossh $(1)/usr/sbin/ 38 | $(INSTALL_DIR) $(1)/etc/init.d 39 | $(INSTALL_BIN) ./files/autossh.init $(1)/etc/init.d/autossh 40 | $(INSTALL_DIR) $(1)/etc/config 41 | $(INSTALL_DATA) ./files/autossh.config $(1)/etc/config/autossh 42 | $(INSTALL_DIR) $(1)/etc/hotplug.d/iface 43 | $(INSTALL_DATA) ./files/autossh.hotplug $(1)/etc/hotplug.d/iface/20-autossh 44 | endef 45 | 46 | define Package/autossh/conffiles 47 | /etc/config/autossh 48 | endef 49 | 50 | $(eval $(call BuildPackage,autossh)) 51 | -------------------------------------------------------------------------------- /network/autossh/files/autossh.config: -------------------------------------------------------------------------------- 1 | config autossh 2 | option ssh '-i /etc/dropbear/id_rsa -N -T -R 2222:localhost:22 user@host' 3 | option gatetime '0' 4 | option monitorport '20000' 5 | option poll '600' 6 | -------------------------------------------------------------------------------- /network/autossh/files/autossh.hotplug: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2007 OpenWrt.org 3 | 4 | /etc/init.d/autossh enabled && { 5 | 6 | [ "$ACTION" = "ifup" ] && { 7 | /etc/init.d/autossh start 8 | } 9 | 10 | [ "$ACTION" = "ifdown" ] && { 11 | /etc/init.d/autossh stop 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /network/autossh/files/autossh.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2007-2011 OpenWrt.org 3 | 4 | START=80 5 | 6 | start_instance() { 7 | local section="$1" 8 | 9 | config_get ssh "$section" 'ssh' 10 | config_get gatetime "$section" 'gatetime' 11 | config_get monitorport "$section" 'monitorport' 12 | config_get poll "$section" 'poll' 13 | 14 | AUTOSSH_GATETIME="${gatetime:-30}" \ 15 | AUTOSSH_POLL="${poll:-600}" \ 16 | service_start /usr/sbin/autossh -M ${monitorport:-20000} -f ${ssh} 17 | } 18 | 19 | boot() { 20 | return 21 | } 22 | 23 | start() { 24 | config_load 'autossh' 25 | config_foreach start_instance 'autossh' 26 | } 27 | 28 | stop() { 29 | service_stop /usr/sbin/autossh 30 | } 31 | -------------------------------------------------------------------------------- /network/backdoorfactory/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=backdoorfactory 4 | PKG_VERSION:=0.2 5 | PKG_RELEASE:=1 6 | 7 | GO_PKG:=github.com/Binject/backdoorfactory 8 | 9 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 10 | PKG_SOURCE_URL:=https://codeload.github.com/Binject/backdoorfactory/tar.gz/v${PKG_VERSION}? 11 | PKG_HASH:=47bd0ea9bc390843e29e44873a298785a75ad08cc75d5c730b5007386b188c54 12 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 13 | 14 | PKG_LICENSE:=GPL-3.0 15 | PKG_LICENSE_FILES:=LICENSE 16 | PKG_MAINTAINER:=Benjamin Kurtz 17 | 18 | PKG_BUILD_DEPENDS:=golang/host 19 | PKG_BUILD_PARALLEL:=1 20 | PKG_USE_MIPS16:=0 21 | 22 | include $(INCLUDE_DIR)/package.mk 23 | include ../../lang/golang/golang-package.mk 24 | 25 | define Package/backdoorfactory/Default 26 | TITLE:=A MitM tool for inserting shellcode into all types of binaries on the wire. 27 | URL:=https://binject.github.io/backdoorfactory 28 | DEPENDS:=$(GO_ARCH_DEPENDS) bettercap 29 | endef 30 | 31 | define Package/backdoorfactory 32 | $(call Package/backdoorfactory/Default) 33 | SECTION:=net 34 | CATEGORY:=Network 35 | endef 36 | 37 | define Package/backdoorfactory/description 38 | backdoorfactory is an extension to bettercap that allows the insertion of shellcode into intercepted file downloads. 39 | 40 | It lets you man-in-the-middle web file downloads and inject them with platform-appropriate shellcode. It works on downloaded archives as well. 41 | 42 | Features 43 | * Works on PE, Mach-O, and ELF format binaries using the Binject Debug library 44 | * Integrates with bettercap's DNS and ARP based man-in-the-middling capabilites 45 | * Unpacks and repacks Zip, Tar, and Tar.gz archives, injecting any binaries inside 46 | * Supports configurable methods of shellcode injection via the Binjection library 47 | * Shellcode repository allows different shellcodes per architecture and per binary format 48 | endef 49 | 50 | define Package/backdoorfactory/install 51 | $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR)) 52 | $(INSTALL_DIR) $(1)/usr/bin 53 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/backdoorfactory $(1)/usr/bin/backdoorfactory 54 | endef 55 | 56 | $(eval $(call GoBinPackage,backdoorfactory)) 57 | $(eval $(call BuildPackage,backdoorfactory)) 58 | 59 | 60 | -------------------------------------------------------------------------------- /network/bettercap/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=bettercap 4 | PKG_VERSION:=2.27.1 5 | PKG_RELEASE:=1 6 | 7 | GO_PKG:=github.com/bettercap/bettercap 8 | 9 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 10 | PKG_SOURCE_URL:=https://codeload.github.com/bettercap/bettercap/tar.gz/v${PKG_VERSION}? 11 | PKG_HASH:=dd4349a43486ec300a0f777f7c53b2fff608fb82dbba720c144b85538811405c 12 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 13 | 14 | PKG_LICENSE:=GPL-3.0 15 | PKG_LICENSE_FILES:=LICENSE.md 16 | PKG_MAINTAINER:=Benjamin Kurtz 17 | 18 | PKG_BUILD_DEPENDS:=golang/host 19 | PKG_BUILD_PARALLEL:=1 20 | PKG_USE_MIPS16:=0 21 | 22 | include $(INCLUDE_DIR)/package.mk 23 | include ../../lang/golang/golang-package.mk 24 | 25 | define Package/bettercap/Default 26 | TITLE:=The Swiss Army knife for 802.11, BLE and Ethernet networks reconnaissance and MITM attacks. 27 | URL:=https://www.bettercap.org/ 28 | DEPENDS:=$(GO_ARCH_DEPENDS) libpcap libusb-1.0 29 | endef 30 | 31 | define Package/bettercap 32 | $(call Package/bettercap/Default) 33 | SECTION:=net 34 | CATEGORY:=Network 35 | endef 36 | 37 | define Package/bettercap/description 38 | bettercap is a powerful, easily extensible and portable framework written 39 | in Go which aims to offer to security researchers, red teamers and reverse 40 | engineers an easy to use, all-in-one solution with all the features they 41 | might possibly need for performing reconnaissance and attacking WiFi 42 | networks, Bluetooth Low Energy devices, wireless HID devices and Ethernet networks. 43 | endef 44 | 45 | define Package/bettercap/install 46 | $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR)) 47 | $(INSTALL_DIR) $(1)/usr/bin 48 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/bettercap $(1)/usr/bin/bettercap 49 | endef 50 | 51 | $(eval $(call GoBinPackage,bettercap)) 52 | $(eval $(call BuildPackage,bettercap)) 53 | 54 | 55 | -------------------------------------------------------------------------------- /network/bully/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | include version.mk 4 | 5 | include $(INCLUDE_DIR)/package.mk 6 | 7 | define Package/bully 8 | SECTION:=net 9 | CATEGORY:=Network 10 | SUBMENU:=wireless 11 | TITLE:=Brute force attack against WPS, that actually works 12 | DEPENDS:=+libpcap 13 | endef 14 | 15 | define Package/bully/description 16 | Brute force attack against WPS, that actually works 17 | endef 18 | 19 | define Build/Prepare 20 | mkdir -p $(PKG_BUILD_DIR) 21 | $(CP) -rf ./src $(PKG_BUILD_DIR)/ 22 | endef 23 | 24 | CONFIGURE_PATH:=src 25 | 26 | MAKE_PATH:=src 27 | 28 | TARGET_CFLAGS+=$(TARGET_CPPFLAGS) 29 | 30 | define Package/bully/install 31 | $(INSTALL_DIR) $(1)/usr/bin 32 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bully $(1)/usr/bin/ 33 | endef 34 | 35 | $(eval $(call BuildPackage,bully)) 36 | -------------------------------------------------------------------------------- /network/bully/src/Makefile: -------------------------------------------------------------------------------- 1 | prefix = /usr/local 2 | exec_prefix = $(prefix) 3 | bindir = $(exec_prefix)/bin 4 | 5 | W_NAME = bully 6 | W_ROOT = `pwd` 7 | 8 | CFLAGS += -I$(W_ROOT) -I$(W_ROOT)/utils/ -I$(W_ROOT)/tls/ 9 | CFLAGS += -I$(W_ROOT)/wps/ -I$(W_ROOT)/crypto/ -I$(W_ROOT)/common/ 10 | CFLAGS += -DUSE_INTERNAL_CRYPTO -O2 11 | 12 | LDFLAGS += -lpcap 13 | 14 | HDRS = $(W_NAME).h 80211.h frame.h iface.h bswap.h version.h 15 | SRCS = $(W_NAME).c 80211.c frame.c iface.c crc32.c timer.c utils.c 16 | 17 | all: $(W_NAME) 18 | 19 | $(W_NAME): $(HDRS) $(SRCS) 20 | $(CC) $(CFLAGS) -o $(@) $(W_NAME).c pdust.c $(LDFLAGS) 21 | 22 | strip: $(W_NAME) 23 | strip $(W_NAME) 24 | 25 | clean: 26 | -rm -f $(W_NAME) $(W_NAME).o 27 | 28 | distclean: clean 29 | 30 | install: all 31 | install -d $(DESTDIR)$(bindir) 32 | install -m 755 $(W_NAME) $(DESTDIR)$(bindir) 33 | 34 | uninstall: 35 | -rm -f $(DESTDIR)$(bindir)/$(W_NAME) 36 | -------------------------------------------------------------------------------- /network/bully/src/bswap.h: -------------------------------------------------------------------------------- 1 | /* 2 | bully - retrieve WPA/WPA2 passphrase from a WPS-enabled AP 3 | 4 | Copyright (C) 2012 Brian Purcell 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | #ifndef _BSWAP_H 20 | #define _BSWAP_H 1 21 | 22 | #ifndef htobe16 23 | # if __BYTE_ORDER == __LITTLE_ENDIAN 24 | # define htobe16(x) __bswap_16 (x) 25 | # define htole16(x) (x) 26 | # define be16toh(x) __bswap_16 (x) 27 | # define le16toh(x) (x) 28 | 29 | # define htobe32(x) __bswap_32 (x) 30 | # define htole32(x) (x) 31 | # define be32toh(x) __bswap_32 (x) 32 | # define le32toh(x) (x) 33 | 34 | # define htobe64(x) __bswap_64 (x) 35 | # define htole64(x) (x) 36 | # define be64toh(x) __bswap_64 (x) 37 | # define le64toh(x) (x) 38 | # else 39 | # define htobe16(x) (x) 40 | # define htole16(x) __bswap_16 (x) 41 | # define be16toh(x) (x) 42 | # define le16toh(x) __bswap_16 (x) 43 | 44 | # define htobe32(x) (x) 45 | # define htole32(x) __bswap_32 (x) 46 | # define be32toh(x) (x) 47 | # define le32toh(x) __bswap_32 (x) 48 | 49 | # define htobe64(x) (x) 50 | # define htole64(x) __bswap_64 (x) 51 | # define be64toh(x) (x) 52 | # define le64toh(x) __bswap_64 (x) 53 | # endif 54 | #endif 55 | 56 | #endif /* _BSWAP_H */ 57 | -------------------------------------------------------------------------------- /network/bully/src/common/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /network/bully/src/common/eapol_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EAPOL definitions shared between hostapd and wpa_supplicant 3 | * Copyright (c) 2002-2007, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef EAPOL_COMMON_H 16 | #define EAPOL_COMMON_H 17 | 18 | /* IEEE Std 802.1X-2004 */ 19 | 20 | #ifdef _MSC_VER 21 | #pragma pack(push, 1) 22 | #endif /* _MSC_VER */ 23 | 24 | struct ieee802_1x_hdr { 25 | u8 version; 26 | u8 type; 27 | be16 length; 28 | /* followed by length octets of data */ 29 | } STRUCT_PACKED; 30 | 31 | #ifdef _MSC_VER 32 | #pragma pack(pop) 33 | #endif /* _MSC_VER */ 34 | 35 | #define EAPOL_VERSION 2 36 | 37 | enum { IEEE802_1X_TYPE_EAP_PACKET = 0, 38 | IEEE802_1X_TYPE_EAPOL_START = 1, 39 | IEEE802_1X_TYPE_EAPOL_LOGOFF = 2, 40 | IEEE802_1X_TYPE_EAPOL_KEY = 3, 41 | IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4 42 | }; 43 | 44 | enum { EAPOL_KEY_TYPE_RC4 = 1, EAPOL_KEY_TYPE_RSN = 2, 45 | EAPOL_KEY_TYPE_WPA = 254 }; 46 | 47 | #endif /* EAPOL_COMMON_H */ 48 | -------------------------------------------------------------------------------- /network/bully/src/common/ieee802_11_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IEEE 802.11 Common routines 3 | * Copyright (c) 2002-2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef IEEE802_11_COMMON_H 16 | #define IEEE802_11_COMMON_H 17 | 18 | /* Parsed Information Elements */ 19 | struct ieee802_11_elems { 20 | const u8 *ssid; 21 | const u8 *supp_rates; 22 | const u8 *fh_params; 23 | const u8 *ds_params; 24 | const u8 *cf_params; 25 | const u8 *tim; 26 | const u8 *ibss_params; 27 | const u8 *challenge; 28 | const u8 *erp_info; 29 | const u8 *ext_supp_rates; 30 | const u8 *wpa_ie; 31 | const u8 *rsn_ie; 32 | const u8 *wmm; /* WMM Information or Parameter Element */ 33 | const u8 *wmm_tspec; 34 | const u8 *wps_ie; 35 | const u8 *power_cap; 36 | const u8 *supp_channels; 37 | const u8 *mdie; 38 | const u8 *ftie; 39 | const u8 *timeout_int; 40 | const u8 *ht_capabilities; 41 | const u8 *ht_operation; 42 | const u8 *vendor_ht_cap; 43 | 44 | u8 ssid_len; 45 | u8 supp_rates_len; 46 | u8 fh_params_len; 47 | u8 ds_params_len; 48 | u8 cf_params_len; 49 | u8 tim_len; 50 | u8 ibss_params_len; 51 | u8 challenge_len; 52 | u8 erp_info_len; 53 | u8 ext_supp_rates_len; 54 | u8 wpa_ie_len; 55 | u8 rsn_ie_len; 56 | u8 wmm_len; /* 7 = WMM Information; 24 = WMM Parameter */ 57 | u8 wmm_tspec_len; 58 | u8 wps_ie_len; 59 | u8 power_cap_len; 60 | u8 supp_channels_len; 61 | u8 mdie_len; 62 | u8 ftie_len; 63 | u8 timeout_int_len; 64 | u8 ht_capabilities_len; 65 | u8 ht_operation_len; 66 | u8 vendor_ht_cap_len; 67 | }; 68 | 69 | typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes; 70 | 71 | ParseRes ieee802_11_parse_elems(const u8 *start, size_t len, 72 | struct ieee802_11_elems *elems, 73 | int show_errors); 74 | int ieee802_11_ie_count(const u8 *ies, size_t ies_len); 75 | struct wpabuf * ieee802_11_vendor_ie_concat(const u8 *ies, size_t ies_len, 76 | u32 oui_type); 77 | 78 | #endif /* IEEE802_11_COMMON_H */ 79 | -------------------------------------------------------------------------------- /network/bully/src/common/privsep_commands.h: -------------------------------------------------------------------------------- 1 | /* 2 | * WPA Supplicant - privilege separation commands 3 | * Copyright (c) 2007-2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef PRIVSEP_COMMANDS_H 16 | #define PRIVSEP_COMMANDS_H 17 | 18 | enum privsep_cmd { 19 | PRIVSEP_CMD_REGISTER, 20 | PRIVSEP_CMD_UNREGISTER, 21 | PRIVSEP_CMD_SCAN, 22 | PRIVSEP_CMD_GET_SCAN_RESULTS, 23 | PRIVSEP_CMD_ASSOCIATE, 24 | PRIVSEP_CMD_GET_BSSID, 25 | PRIVSEP_CMD_GET_SSID, 26 | PRIVSEP_CMD_SET_KEY, 27 | PRIVSEP_CMD_GET_CAPA, 28 | PRIVSEP_CMD_L2_REGISTER, 29 | PRIVSEP_CMD_L2_UNREGISTER, 30 | PRIVSEP_CMD_L2_NOTIFY_AUTH_START, 31 | PRIVSEP_CMD_L2_SEND, 32 | PRIVSEP_CMD_SET_COUNTRY, 33 | }; 34 | 35 | struct privsep_cmd_associate 36 | { 37 | u8 bssid[ETH_ALEN]; 38 | u8 ssid[32]; 39 | size_t ssid_len; 40 | int freq; 41 | int pairwise_suite; 42 | int group_suite; 43 | int key_mgmt_suite; 44 | int auth_alg; 45 | int mode; 46 | size_t wpa_ie_len; 47 | /* followed by wpa_ie_len bytes of wpa_ie */ 48 | }; 49 | 50 | struct privsep_cmd_set_key 51 | { 52 | int alg; 53 | u8 addr[ETH_ALEN]; 54 | int key_idx; 55 | int set_tx; 56 | u8 seq[8]; 57 | size_t seq_len; 58 | u8 key[32]; 59 | size_t key_len; 60 | }; 61 | 62 | enum privsep_event { 63 | PRIVSEP_EVENT_SCAN_RESULTS, 64 | PRIVSEP_EVENT_ASSOC, 65 | PRIVSEP_EVENT_DISASSOC, 66 | PRIVSEP_EVENT_ASSOCINFO, 67 | PRIVSEP_EVENT_MICHAEL_MIC_FAILURE, 68 | PRIVSEP_EVENT_INTERFACE_STATUS, 69 | PRIVSEP_EVENT_PMKID_CANDIDATE, 70 | PRIVSEP_EVENT_STKSTART, 71 | PRIVSEP_EVENT_FT_RESPONSE, 72 | PRIVSEP_EVENT_RX_EAPOL, 73 | }; 74 | 75 | #endif /* PRIVSEP_COMMANDS_H */ 76 | -------------------------------------------------------------------------------- /network/bully/src/common/version.h: -------------------------------------------------------------------------------- 1 | #ifndef VERSION_H 2 | #define VERSION_H 3 | 4 | #define VERSION_STR "0.7.3" 5 | 6 | #endif /* VERSION_H */ 7 | -------------------------------------------------------------------------------- /network/bully/src/crypto/.gitignore: -------------------------------------------------------------------------------- 1 | libcrypto.a 2 | -------------------------------------------------------------------------------- /network/bully/src/crypto/Makefile: -------------------------------------------------------------------------------- 1 | all: libcrypto.a 2 | 3 | clean: 4 | rm -f *~ *.o *.d libcrypto.a 5 | 6 | install: 7 | @echo Nothing to be made. 8 | 9 | 10 | include ../lib.rules 11 | 12 | CFLAGS += -DCONFIG_TLS_INTERNAL_CLIENT 13 | CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER 14 | #CFLAGS += -DALL_DH_GROUPS 15 | 16 | LIB_OBJS= \ 17 | aes-cbc.o \ 18 | aes-ctr.o \ 19 | aes-eax.o \ 20 | aes-encblock.o \ 21 | aes-internal.o \ 22 | aes-internal-dec.o \ 23 | aes-internal-enc.o \ 24 | aes-omac1.o \ 25 | aes-unwrap.o \ 26 | aes-wrap.o \ 27 | des-internal.o \ 28 | dh_group5.o \ 29 | dh_groups.o \ 30 | md4-internal.o \ 31 | md5.o \ 32 | md5-internal.o \ 33 | md5-non-fips.o \ 34 | milenage.o \ 35 | ms_funcs.o \ 36 | rc4.o \ 37 | sha1.o \ 38 | sha1-internal.o \ 39 | sha1-pbkdf2.o \ 40 | sha1-tlsprf.o \ 41 | sha1-tprf.o \ 42 | sha256.o \ 43 | sha256-internal.o 44 | 45 | LIB_OBJS += crypto_internal.o 46 | LIB_OBJS += crypto_internal-cipher.o 47 | LIB_OBJS += crypto_internal-modexp.o 48 | LIB_OBJS += crypto_internal-rsa.o 49 | LIB_OBJS += tls_internal.o 50 | LIB_OBJS += fips_prf_internal.o 51 | 52 | 53 | libcrypto.a: $(LIB_OBJS) 54 | $(AR) crT $@ $? 55 | 56 | -include $(OBJS:%.o=%.d) 57 | -------------------------------------------------------------------------------- /network/bully/src/crypto/aes-cbc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AES-128 CBC 3 | * 4 | * Copyright (c) 2003-2007, Jouni Malinen 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | * 10 | * Alternatively, this software may be distributed under the terms of BSD 11 | * license. 12 | * 13 | * See README and COPYING for more details. 14 | */ 15 | 16 | #include "includes.h" 17 | 18 | #include "common.h" 19 | #include "aes.h" 20 | #include "aes_wrap.h" 21 | 22 | /** 23 | * aes_128_cbc_encrypt - AES-128 CBC encryption 24 | * @key: Encryption key 25 | * @iv: Encryption IV for CBC mode (16 bytes) 26 | * @data: Data to encrypt in-place 27 | * @data_len: Length of data in bytes (must be divisible by 16) 28 | * Returns: 0 on success, -1 on failure 29 | */ 30 | int aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len) 31 | { 32 | void *ctx; 33 | u8 cbc[AES_BLOCK_SIZE]; 34 | u8 *pos = data; 35 | int i, j, blocks; 36 | 37 | ctx = aes_encrypt_init(key, 16); 38 | if (ctx == NULL) 39 | return -1; 40 | os_memcpy(cbc, iv, AES_BLOCK_SIZE); 41 | 42 | blocks = data_len / AES_BLOCK_SIZE; 43 | for (i = 0; i < blocks; i++) { 44 | for (j = 0; j < AES_BLOCK_SIZE; j++) 45 | cbc[j] ^= pos[j]; 46 | aes_encrypt(ctx, cbc, cbc); 47 | os_memcpy(pos, cbc, AES_BLOCK_SIZE); 48 | pos += AES_BLOCK_SIZE; 49 | } 50 | aes_encrypt_deinit(ctx); 51 | return 0; 52 | } 53 | 54 | 55 | /** 56 | * aes_128_cbc_decrypt - AES-128 CBC decryption 57 | * @key: Decryption key 58 | * @iv: Decryption IV for CBC mode (16 bytes) 59 | * @data: Data to decrypt in-place 60 | * @data_len: Length of data in bytes (must be divisible by 16) 61 | * Returns: 0 on success, -1 on failure 62 | */ 63 | int aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len) 64 | { 65 | void *ctx; 66 | u8 cbc[AES_BLOCK_SIZE], tmp[AES_BLOCK_SIZE]; 67 | u8 *pos = data; 68 | int i, j, blocks; 69 | 70 | ctx = aes_decrypt_init(key, 16); 71 | if (ctx == NULL) 72 | return -1; 73 | os_memcpy(cbc, iv, AES_BLOCK_SIZE); 74 | 75 | blocks = data_len / AES_BLOCK_SIZE; 76 | for (i = 0; i < blocks; i++) { 77 | os_memcpy(tmp, pos, AES_BLOCK_SIZE); 78 | aes_decrypt(ctx, pos, pos); 79 | for (j = 0; j < AES_BLOCK_SIZE; j++) 80 | pos[j] ^= cbc[j]; 81 | os_memcpy(cbc, tmp, AES_BLOCK_SIZE); 82 | pos += AES_BLOCK_SIZE; 83 | } 84 | aes_decrypt_deinit(ctx); 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /network/bully/src/crypto/aes-ctr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AES-128 CTR 3 | * 4 | * Copyright (c) 2003-2007, Jouni Malinen 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | * 10 | * Alternatively, this software may be distributed under the terms of BSD 11 | * license. 12 | * 13 | * See README and COPYING for more details. 14 | */ 15 | 16 | #include "includes.h" 17 | 18 | #include "common.h" 19 | #include "aes.h" 20 | #include "aes_wrap.h" 21 | 22 | /** 23 | * aes_128_ctr_encrypt - AES-128 CTR mode encryption 24 | * @key: Key for encryption (16 bytes) 25 | * @nonce: Nonce for counter mode (16 bytes) 26 | * @data: Data to encrypt in-place 27 | * @data_len: Length of data in bytes 28 | * Returns: 0 on success, -1 on failure 29 | */ 30 | int aes_128_ctr_encrypt(const u8 *key, const u8 *nonce, 31 | u8 *data, size_t data_len) 32 | { 33 | void *ctx; 34 | size_t j, len, left = data_len; 35 | int i; 36 | u8 *pos = data; 37 | u8 counter[AES_BLOCK_SIZE], buf[AES_BLOCK_SIZE]; 38 | 39 | ctx = aes_encrypt_init(key, 16); 40 | if (ctx == NULL) 41 | return -1; 42 | os_memcpy(counter, nonce, AES_BLOCK_SIZE); 43 | 44 | while (left > 0) { 45 | aes_encrypt(ctx, counter, buf); 46 | 47 | len = (left < AES_BLOCK_SIZE) ? left : AES_BLOCK_SIZE; 48 | for (j = 0; j < len; j++) 49 | pos[j] ^= buf[j]; 50 | pos += len; 51 | left -= len; 52 | 53 | for (i = AES_BLOCK_SIZE - 1; i >= 0; i--) { 54 | counter[i]++; 55 | if (counter[i]) 56 | break; 57 | } 58 | } 59 | aes_encrypt_deinit(ctx); 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /network/bully/src/crypto/aes-encblock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AES encrypt_block 3 | * 4 | * Copyright (c) 2003-2007, Jouni Malinen 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | * 10 | * Alternatively, this software may be distributed under the terms of BSD 11 | * license. 12 | * 13 | * See README and COPYING for more details. 14 | */ 15 | 16 | #include "includes.h" 17 | 18 | #include "common.h" 19 | #include "aes.h" 20 | #include "aes_wrap.h" 21 | 22 | /** 23 | * aes_128_encrypt_block - Perform one AES 128-bit block operation 24 | * @key: Key for AES 25 | * @in: Input data (16 bytes) 26 | * @out: Output of the AES block operation (16 bytes) 27 | * Returns: 0 on success, -1 on failure 28 | */ 29 | int aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out) 30 | { 31 | void *ctx; 32 | ctx = aes_encrypt_init(key, 16); 33 | if (ctx == NULL) 34 | return -1; 35 | aes_encrypt(ctx, in, out); 36 | aes_encrypt_deinit(ctx); 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /network/bully/src/crypto/aes-internal-enc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AES (Rijndael) cipher - encrypt 3 | * 4 | * Modifications to public domain implementation: 5 | * - support only 128-bit keys 6 | * - cleanup 7 | * - use C pre-processor to make it easier to change S table access 8 | * - added option (AES_SMALL_TABLES) for reducing code size by about 8 kB at 9 | * cost of reduced throughput (quite small difference on Pentium 4, 10 | * 10-25% when using -O1 or -O2 optimization) 11 | * 12 | * Copyright (c) 2003-2005, Jouni Malinen 13 | * 14 | * This program is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU General Public License version 2 as 16 | * published by the Free Software Foundation. 17 | * 18 | * Alternatively, this software may be distributed under the terms of BSD 19 | * license. 20 | * 21 | * See README and COPYING for more details. 22 | */ 23 | 24 | #include "includes.h" 25 | 26 | #include "common.h" 27 | #include "crypto.h" 28 | #include "aes_i.h" 29 | 30 | void rijndaelEncrypt(const u32 rk[/*44*/], const u8 pt[16], u8 ct[16]) 31 | { 32 | u32 s0, s1, s2, s3, t0, t1, t2, t3; 33 | const int Nr = 10; 34 | #ifndef FULL_UNROLL 35 | int r; 36 | #endif /* ?FULL_UNROLL */ 37 | 38 | /* 39 | * map byte array block to cipher state 40 | * and add initial round key: 41 | */ 42 | s0 = GETU32(pt ) ^ rk[0]; 43 | s1 = GETU32(pt + 4) ^ rk[1]; 44 | s2 = GETU32(pt + 8) ^ rk[2]; 45 | s3 = GETU32(pt + 12) ^ rk[3]; 46 | 47 | #define ROUND(i,d,s) \ 48 | d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \ 49 | d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \ 50 | d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \ 51 | d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3] 52 | 53 | #ifdef FULL_UNROLL 54 | 55 | ROUND(1,t,s); 56 | ROUND(2,s,t); 57 | ROUND(3,t,s); 58 | ROUND(4,s,t); 59 | ROUND(5,t,s); 60 | ROUND(6,s,t); 61 | ROUND(7,t,s); 62 | ROUND(8,s,t); 63 | ROUND(9,t,s); 64 | 65 | rk += Nr << 2; 66 | 67 | #else /* !FULL_UNROLL */ 68 | 69 | /* Nr - 1 full rounds: */ 70 | r = Nr >> 1; 71 | for (;;) { 72 | ROUND(1,t,s); 73 | rk += 8; 74 | if (--r == 0) 75 | break; 76 | ROUND(0,s,t); 77 | } 78 | 79 | #endif /* ?FULL_UNROLL */ 80 | 81 | #undef ROUND 82 | 83 | /* 84 | * apply last round and 85 | * map cipher state to byte array block: 86 | */ 87 | s0 = TE41(t0) ^ TE42(t1) ^ TE43(t2) ^ TE44(t3) ^ rk[0]; 88 | PUTU32(ct , s0); 89 | s1 = TE41(t1) ^ TE42(t2) ^ TE43(t3) ^ TE44(t0) ^ rk[1]; 90 | PUTU32(ct + 4, s1); 91 | s2 = TE41(t2) ^ TE42(t3) ^ TE43(t0) ^ TE44(t1) ^ rk[2]; 92 | PUTU32(ct + 8, s2); 93 | s3 = TE41(t3) ^ TE42(t0) ^ TE43(t1) ^ TE44(t2) ^ rk[3]; 94 | PUTU32(ct + 12, s3); 95 | } 96 | 97 | 98 | void * aes_encrypt_init(const u8 *key, size_t len) 99 | { 100 | u32 *rk; 101 | if (len != 16) 102 | return NULL; 103 | rk = os_malloc(AES_PRIV_SIZE); 104 | if (rk == NULL) 105 | return NULL; 106 | rijndaelKeySetupEnc(rk, key); 107 | return rk; 108 | } 109 | 110 | 111 | void aes_encrypt(void *ctx, const u8 *plain, u8 *crypt) 112 | { 113 | rijndaelEncrypt(ctx, plain, crypt); 114 | } 115 | 116 | 117 | void aes_encrypt_deinit(void *ctx) 118 | { 119 | os_memset(ctx, 0, AES_PRIV_SIZE); 120 | os_free(ctx); 121 | } 122 | -------------------------------------------------------------------------------- /network/bully/src/crypto/aes-unwrap.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AES key unwrap (128-bit KEK, RFC3394) 3 | * 4 | * Copyright (c) 2003-2007, Jouni Malinen 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | * 10 | * Alternatively, this software may be distributed under the terms of BSD 11 | * license. 12 | * 13 | * See README and COPYING for more details. 14 | */ 15 | 16 | #include "includes.h" 17 | 18 | #include "common.h" 19 | #include "aes.h" 20 | #include "aes_wrap.h" 21 | 22 | /** 23 | * aes_unwrap - Unwrap key with AES Key Wrap Algorithm (128-bit KEK) (RFC3394) 24 | * @kek: Key encryption key (KEK) 25 | * @n: Length of the plaintext key in 64-bit units; e.g., 2 = 128-bit = 16 26 | * bytes 27 | * @cipher: Wrapped key to be unwrapped, (n + 1) * 64 bits 28 | * @plain: Plaintext key, n * 64 bits 29 | * Returns: 0 on success, -1 on failure (e.g., integrity verification failed) 30 | */ 31 | int aes_unwrap(const u8 *kek, int n, const u8 *cipher, u8 *plain) 32 | { 33 | u8 a[8], *r, b[16]; 34 | int i, j; 35 | void *ctx; 36 | 37 | /* 1) Initialize variables. */ 38 | os_memcpy(a, cipher, 8); 39 | r = plain; 40 | os_memcpy(r, cipher + 8, 8 * n); 41 | 42 | ctx = aes_decrypt_init(kek, 16); 43 | if (ctx == NULL) 44 | return -1; 45 | 46 | /* 2) Compute intermediate values. 47 | * For j = 5 to 0 48 | * For i = n to 1 49 | * B = AES-1(K, (A ^ t) | R[i]) where t = n*j+i 50 | * A = MSB(64, B) 51 | * R[i] = LSB(64, B) 52 | */ 53 | for (j = 5; j >= 0; j--) { 54 | r = plain + (n - 1) * 8; 55 | for (i = n; i >= 1; i--) { 56 | os_memcpy(b, a, 8); 57 | b[7] ^= n * j + i; 58 | 59 | os_memcpy(b + 8, r, 8); 60 | aes_decrypt(ctx, b, b); 61 | os_memcpy(a, b, 8); 62 | os_memcpy(r, b + 8, 8); 63 | r -= 8; 64 | } 65 | } 66 | aes_decrypt_deinit(ctx); 67 | 68 | /* 3) Output results. 69 | * 70 | * These are already in @plain due to the location of temporary 71 | * variables. Just verify that the IV matches with the expected value. 72 | */ 73 | for (i = 0; i < 8; i++) { 74 | if (a[i] != 0xa6) 75 | return -1; 76 | } 77 | 78 | return 0; 79 | } 80 | -------------------------------------------------------------------------------- /network/bully/src/crypto/aes-wrap.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AES Key Wrap Algorithm (128-bit KEK) (RFC3394) 3 | * 4 | * Copyright (c) 2003-2007, Jouni Malinen 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | * 10 | * Alternatively, this software may be distributed under the terms of BSD 11 | * license. 12 | * 13 | * See README and COPYING for more details. 14 | */ 15 | 16 | #include "includes.h" 17 | 18 | #include "common.h" 19 | #include "aes.h" 20 | #include "aes_wrap.h" 21 | 22 | /** 23 | * aes_wrap - Wrap keys with AES Key Wrap Algorithm (128-bit KEK) (RFC3394) 24 | * @kek: 16-octet Key encryption key (KEK) 25 | * @n: Length of the plaintext key in 64-bit units; e.g., 2 = 128-bit = 16 26 | * bytes 27 | * @plain: Plaintext key to be wrapped, n * 64 bits 28 | * @cipher: Wrapped key, (n + 1) * 64 bits 29 | * Returns: 0 on success, -1 on failure 30 | */ 31 | int aes_wrap(const u8 *kek, int n, const u8 *plain, u8 *cipher) 32 | { 33 | u8 *a, *r, b[16]; 34 | int i, j; 35 | void *ctx; 36 | 37 | a = cipher; 38 | r = cipher + 8; 39 | 40 | /* 1) Initialize variables. */ 41 | os_memset(a, 0xa6, 8); 42 | os_memcpy(r, plain, 8 * n); 43 | 44 | ctx = aes_encrypt_init(kek, 16); 45 | if (ctx == NULL) 46 | return -1; 47 | 48 | /* 2) Calculate intermediate values. 49 | * For j = 0 to 5 50 | * For i=1 to n 51 | * B = AES(K, A | R[i]) 52 | * A = MSB(64, B) ^ t where t = (n*j)+i 53 | * R[i] = LSB(64, B) 54 | */ 55 | for (j = 0; j <= 5; j++) { 56 | r = cipher + 8; 57 | for (i = 1; i <= n; i++) { 58 | os_memcpy(b, a, 8); 59 | os_memcpy(b + 8, r, 8); 60 | aes_encrypt(ctx, b, b); 61 | os_memcpy(a, b, 8); 62 | a[7] ^= n * j + i; 63 | os_memcpy(r, b + 8, 8); 64 | r += 8; 65 | } 66 | } 67 | aes_encrypt_deinit(ctx); 68 | 69 | /* 3) Output the results. 70 | * 71 | * These are already in @cipher due to the location of temporary 72 | * variables. 73 | */ 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /network/bully/src/crypto/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AES functions 3 | * Copyright (c) 2003-2006, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef AES_H 16 | #define AES_H 17 | 18 | #define AES_BLOCK_SIZE 16 19 | 20 | void * aes_encrypt_init(const u8 *key, size_t len); 21 | void aes_encrypt(void *ctx, const u8 *plain, u8 *crypt); 22 | void aes_encrypt_deinit(void *ctx); 23 | void * aes_decrypt_init(const u8 *key, size_t len); 24 | void aes_decrypt(void *ctx, const u8 *crypt, u8 *plain); 25 | void aes_decrypt_deinit(void *ctx); 26 | 27 | #endif /* AES_H */ 28 | -------------------------------------------------------------------------------- /network/bully/src/crypto/aes_wrap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AES-based functions 3 | * 4 | * - AES Key Wrap Algorithm (128-bit KEK) (RFC3394) 5 | * - One-Key CBC MAC (OMAC1) hash with AES-128 6 | * - AES-128 CTR mode encryption 7 | * - AES-128 EAX mode encryption/decryption 8 | * - AES-128 CBC 9 | * 10 | * Copyright (c) 2003-2007, Jouni Malinen 11 | * 12 | * This program is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License version 2 as 14 | * published by the Free Software Foundation. 15 | * 16 | * Alternatively, this software may be distributed under the terms of BSD 17 | * license. 18 | * 19 | * See README and COPYING for more details. 20 | */ 21 | 22 | #ifndef AES_WRAP_H 23 | #define AES_WRAP_H 24 | 25 | int __must_check aes_wrap(const u8 *kek, int n, const u8 *plain, u8 *cipher); 26 | int __must_check aes_unwrap(const u8 *kek, int n, const u8 *cipher, u8 *plain); 27 | int __must_check omac1_aes_128_vector(const u8 *key, size_t num_elem, 28 | const u8 *addr[], const size_t *len, 29 | u8 *mac); 30 | int __must_check omac1_aes_128(const u8 *key, const u8 *data, size_t data_len, 31 | u8 *mac); 32 | int __must_check aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out); 33 | int __must_check aes_128_ctr_encrypt(const u8 *key, const u8 *nonce, 34 | u8 *data, size_t data_len); 35 | int __must_check aes_128_eax_encrypt(const u8 *key, 36 | const u8 *nonce, size_t nonce_len, 37 | const u8 *hdr, size_t hdr_len, 38 | u8 *data, size_t data_len, u8 *tag); 39 | int __must_check aes_128_eax_decrypt(const u8 *key, 40 | const u8 *nonce, size_t nonce_len, 41 | const u8 *hdr, size_t hdr_len, 42 | u8 *data, size_t data_len, const u8 *tag); 43 | int __must_check aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data, 44 | size_t data_len); 45 | int __must_check aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data, 46 | size_t data_len); 47 | 48 | #endif /* AES_WRAP_H */ 49 | -------------------------------------------------------------------------------- /network/bully/src/crypto/crypto_internal-modexp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Crypto wrapper for internal crypto implementation - modexp 3 | * Copyright (c) 2006-2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | 17 | #include "common.h" 18 | #include "tls/bignum.h" 19 | #include "crypto.h" 20 | 21 | 22 | int crypto_mod_exp(const u8 *base, size_t base_len, 23 | const u8 *power, size_t power_len, 24 | const u8 *modulus, size_t modulus_len, 25 | u8 *result, size_t *result_len) 26 | { 27 | struct bignum *bn_base, *bn_exp, *bn_modulus, *bn_result; 28 | int ret = -1; 29 | 30 | bn_base = bignum_init(); 31 | bn_exp = bignum_init(); 32 | bn_modulus = bignum_init(); 33 | bn_result = bignum_init(); 34 | 35 | if (bn_base == NULL || bn_exp == NULL || bn_modulus == NULL || 36 | bn_result == NULL) 37 | goto error; 38 | 39 | if (bignum_set_unsigned_bin(bn_base, base, base_len) < 0 || 40 | bignum_set_unsigned_bin(bn_exp, power, power_len) < 0 || 41 | bignum_set_unsigned_bin(bn_modulus, modulus, modulus_len) < 0) 42 | goto error; 43 | 44 | if (bignum_exptmod(bn_base, bn_exp, bn_modulus, bn_result) < 0) 45 | goto error; 46 | 47 | ret = bignum_get_unsigned_bin(bn_result, result, result_len); 48 | 49 | error: 50 | bignum_deinit(bn_base); 51 | bignum_deinit(bn_exp); 52 | bignum_deinit(bn_modulus); 53 | bignum_deinit(bn_result); 54 | return ret; 55 | } 56 | -------------------------------------------------------------------------------- /network/bully/src/crypto/crypto_none.c: -------------------------------------------------------------------------------- 1 | /* 2 | * WPA Supplicant / Empty template functions for crypto wrapper 3 | * Copyright (c) 2005, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | 17 | #include "common.h" 18 | #include "crypto.h" 19 | 20 | 21 | int md4_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac) 22 | { 23 | return 0; 24 | } 25 | 26 | 27 | void des_encrypt(const u8 *clear, const u8 *key, u8 *cypher) 28 | { 29 | } 30 | -------------------------------------------------------------------------------- /network/bully/src/crypto/des_i.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DES and 3DES-EDE ciphers 3 | * Copyright (c) 2006-2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef DES_I_H 16 | #define DES_I_H 17 | 18 | struct des3_key_s { 19 | u32 ek[3][32]; 20 | u32 dk[3][32]; 21 | }; 22 | 23 | void des_key_setup(const u8 *key, u32 *ek, u32 *dk); 24 | void des_block_encrypt(const u8 *plain, const u32 *ek, u8 *crypt); 25 | void des_block_decrypt(const u8 *crypt, const u32 *dk, u8 *plain); 26 | 27 | void des3_key_setup(const u8 *key, struct des3_key_s *dkey); 28 | void des3_encrypt(const u8 *plain, const struct des3_key_s *key, u8 *crypt); 29 | void des3_decrypt(const u8 *crypt, const struct des3_key_s *key, u8 *plain); 30 | 31 | #endif /* DES_I_H */ 32 | -------------------------------------------------------------------------------- /network/bully/src/crypto/dh_group5.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Diffie-Hellman group 5 operations 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | 17 | #include "common.h" 18 | #include "dh_groups.h" 19 | #include "dh_group5.h" 20 | 21 | 22 | void * dh5_init(struct wpabuf **priv, struct wpabuf **publ) 23 | { 24 | *publ = dh_init(dh_groups_get(5), priv); 25 | if (*publ == 0) 26 | return NULL; 27 | return (void *) 1; 28 | } 29 | 30 | 31 | struct wpabuf * dh5_derive_shared(void *ctx, const struct wpabuf *peer_public, 32 | const struct wpabuf *own_private) 33 | { 34 | return dh_derive_shared(peer_public, own_private, dh_groups_get(5)); 35 | } 36 | 37 | 38 | void dh5_free(void *ctx) 39 | { 40 | } 41 | -------------------------------------------------------------------------------- /network/bully/src/crypto/dh_group5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Diffie-Hellman group 5 operations 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef DH_GROUP5_H 16 | #define DH_GROUP5_H 17 | 18 | void * dh5_init(struct wpabuf **priv, struct wpabuf **publ); 19 | struct wpabuf * dh5_derive_shared(void *ctx, const struct wpabuf *peer_public, 20 | const struct wpabuf *own_private); 21 | void dh5_free(void *ctx); 22 | 23 | #endif /* DH_GROUP5_H */ 24 | -------------------------------------------------------------------------------- /network/bully/src/crypto/dh_groups.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Diffie-Hellman groups 3 | * Copyright (c) 2007, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef DH_GROUPS_H 16 | #define DH_GROUPS_H 17 | 18 | struct dh_group { 19 | int id; 20 | const u8 *generator; 21 | size_t generator_len; 22 | const u8 *prime; 23 | size_t prime_len; 24 | }; 25 | 26 | const struct dh_group * dh_groups_get(int id); 27 | struct wpabuf * dh_init(const struct dh_group *dh, struct wpabuf **priv); 28 | struct wpabuf * dh_derive_shared(const struct wpabuf *peer_public, 29 | const struct wpabuf *own_private, 30 | const struct dh_group *dh); 31 | 32 | #endif /* DH_GROUPS_H */ 33 | -------------------------------------------------------------------------------- /network/bully/src/crypto/fips_prf_cryptoapi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FIPS 186-2 PRF for Microsoft CryptoAPI 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | 17 | #include "common.h" 18 | #include "crypto.h" 19 | 20 | 21 | int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen) 22 | { 23 | /* FIX: how to do this with CryptoAPI? */ 24 | return -1; 25 | } 26 | -------------------------------------------------------------------------------- /network/bully/src/crypto/fips_prf_gnutls.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FIPS 186-2 PRF for libgcrypt 3 | * Copyright (c) 2004-2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | #include 17 | 18 | #include "common.h" 19 | #include "crypto.h" 20 | 21 | 22 | int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen) 23 | { 24 | /* FIX: how to do this with libgcrypt? */ 25 | return -1; 26 | } 27 | -------------------------------------------------------------------------------- /network/bully/src/crypto/fips_prf_internal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FIPS 186-2 PRF for internal crypto implementation 3 | * Copyright (c) 2006-2007, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | 17 | #include "common.h" 18 | #include "sha1.h" 19 | #include "sha1_i.h" 20 | #include "crypto.h" 21 | 22 | 23 | int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen) 24 | { 25 | u8 xkey[64]; 26 | u32 t[5], _t[5]; 27 | int i, j, m, k; 28 | u8 *xpos = x; 29 | u32 carry; 30 | 31 | if (seed_len > sizeof(xkey)) 32 | seed_len = sizeof(xkey); 33 | 34 | /* FIPS 186-2 + change notice 1 */ 35 | 36 | os_memcpy(xkey, seed, seed_len); 37 | os_memset(xkey + seed_len, 0, 64 - seed_len); 38 | t[0] = 0x67452301; 39 | t[1] = 0xEFCDAB89; 40 | t[2] = 0x98BADCFE; 41 | t[3] = 0x10325476; 42 | t[4] = 0xC3D2E1F0; 43 | 44 | m = xlen / 40; 45 | for (j = 0; j < m; j++) { 46 | /* XSEED_j = 0 */ 47 | for (i = 0; i < 2; i++) { 48 | /* XVAL = (XKEY + XSEED_j) mod 2^b */ 49 | 50 | /* w_i = G(t, XVAL) */ 51 | os_memcpy(_t, t, 20); 52 | SHA1Transform(_t, xkey); 53 | _t[0] = host_to_be32(_t[0]); 54 | _t[1] = host_to_be32(_t[1]); 55 | _t[2] = host_to_be32(_t[2]); 56 | _t[3] = host_to_be32(_t[3]); 57 | _t[4] = host_to_be32(_t[4]); 58 | os_memcpy(xpos, _t, 20); 59 | 60 | /* XKEY = (1 + XKEY + w_i) mod 2^b */ 61 | carry = 1; 62 | for (k = 19; k >= 0; k--) { 63 | carry += xkey[k] + xpos[k]; 64 | xkey[k] = carry & 0xff; 65 | carry >>= 8; 66 | } 67 | 68 | xpos += SHA1_MAC_LEN; 69 | } 70 | /* x_j = w_0|w_1 */ 71 | } 72 | 73 | return 0; 74 | } 75 | -------------------------------------------------------------------------------- /network/bully/src/crypto/fips_prf_nss.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FIPS 186-2 PRF for NSS 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | #include 17 | 18 | #include "common.h" 19 | #include "crypto.h" 20 | 21 | 22 | int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen) 23 | { 24 | return -1; 25 | } 26 | -------------------------------------------------------------------------------- /network/bully/src/crypto/fips_prf_openssl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FIPS 186-2 PRF for libcrypto 3 | * Copyright (c) 2004-2005, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | #include 17 | 18 | #include "common.h" 19 | #include "crypto.h" 20 | 21 | 22 | static void sha1_transform(u8 *state, const u8 data[64]) 23 | { 24 | SHA_CTX context; 25 | os_memset(&context, 0, sizeof(context)); 26 | os_memcpy(&context.h0, state, 5 * 4); 27 | SHA1_Transform(&context, data); 28 | os_memcpy(state, &context.h0, 5 * 4); 29 | } 30 | 31 | 32 | int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen) 33 | { 34 | u8 xkey[64]; 35 | u32 t[5], _t[5]; 36 | int i, j, m, k; 37 | u8 *xpos = x; 38 | u32 carry; 39 | 40 | if (seed_len > sizeof(xkey)) 41 | seed_len = sizeof(xkey); 42 | 43 | /* FIPS 186-2 + change notice 1 */ 44 | 45 | os_memcpy(xkey, seed, seed_len); 46 | os_memset(xkey + seed_len, 0, 64 - seed_len); 47 | t[0] = 0x67452301; 48 | t[1] = 0xEFCDAB89; 49 | t[2] = 0x98BADCFE; 50 | t[3] = 0x10325476; 51 | t[4] = 0xC3D2E1F0; 52 | 53 | m = xlen / 40; 54 | for (j = 0; j < m; j++) { 55 | /* XSEED_j = 0 */ 56 | for (i = 0; i < 2; i++) { 57 | /* XVAL = (XKEY + XSEED_j) mod 2^b */ 58 | 59 | /* w_i = G(t, XVAL) */ 60 | os_memcpy(_t, t, 20); 61 | sha1_transform((u8 *) _t, xkey); 62 | _t[0] = host_to_be32(_t[0]); 63 | _t[1] = host_to_be32(_t[1]); 64 | _t[2] = host_to_be32(_t[2]); 65 | _t[3] = host_to_be32(_t[3]); 66 | _t[4] = host_to_be32(_t[4]); 67 | os_memcpy(xpos, _t, 20); 68 | 69 | /* XKEY = (1 + XKEY + w_i) mod 2^b */ 70 | carry = 1; 71 | for (k = 19; k >= 0; k--) { 72 | carry += xkey[k] + xpos[k]; 73 | xkey[k] = carry & 0xff; 74 | carry >>= 8; 75 | } 76 | 77 | xpos += 20; 78 | } 79 | /* x_j = w_0|w_1 */ 80 | } 81 | 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /network/bully/src/crypto/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MD5 hash implementation and interface functions 3 | * Copyright (c) 2003-2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef MD5_H 16 | #define MD5_H 17 | 18 | #define MD5_MAC_LEN 16 19 | 20 | int hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem, 21 | const u8 *addr[], const size_t *len, u8 *mac); 22 | int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len, 23 | u8 *mac); 24 | #ifdef CONFIG_FIPS 25 | int hmac_md5_vector_non_fips_allow(const u8 *key, size_t key_len, 26 | size_t num_elem, const u8 *addr[], 27 | const size_t *len, u8 *mac); 28 | int hmac_md5_non_fips_allow(const u8 *key, size_t key_len, const u8 *data, 29 | size_t data_len, u8 *mac); 30 | #else /* CONFIG_FIPS */ 31 | #define hmac_md5_vector_non_fips_allow hmac_md5_vector 32 | #define hmac_md5_non_fips_allow hmac_md5 33 | #endif /* CONFIG_FIPS */ 34 | 35 | #endif /* MD5_H */ 36 | -------------------------------------------------------------------------------- /network/bully/src/crypto/md5_i.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MD5 internal definitions 3 | * Copyright (c) 2003-2005, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef MD5_I_H 16 | #define MD5_I_H 17 | 18 | struct MD5Context { 19 | u32 buf[4]; 20 | u32 bits[2]; 21 | u8 in[64]; 22 | }; 23 | 24 | void MD5Init(struct MD5Context *context); 25 | void MD5Update(struct MD5Context *context, unsigned char const *buf, 26 | unsigned len); 27 | void MD5Final(unsigned char digest[16], struct MD5Context *context); 28 | 29 | #endif /* MD5_I_H */ 30 | -------------------------------------------------------------------------------- /network/bully/src/crypto/milenage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * UMTS AKA - Milenage algorithm (3GPP TS 35.205, .206, .207, .208) 3 | * Copyright (c) 2006-2007 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef MILENAGE_H 16 | #define MILENAGE_H 17 | 18 | void milenage_generate(const u8 *opc, const u8 *amf, const u8 *k, 19 | const u8 *sqn, const u8 *_rand, u8 *autn, u8 *ik, 20 | u8 *ck, u8 *res, size_t *res_len); 21 | int milenage_auts(const u8 *opc, const u8 *k, const u8 *_rand, const u8 *auts, 22 | u8 *sqn); 23 | int gsm_milenage(const u8 *opc, const u8 *k, const u8 *_rand, u8 *sres, 24 | u8 *kc); 25 | int milenage_check(const u8 *opc, const u8 *k, const u8 *sqn, const u8 *_rand, 26 | const u8 *autn, u8 *ik, u8 *ck, u8 *res, size_t *res_len, 27 | u8 *auts); 28 | int milenage_f1(const u8 *opc, const u8 *k, const u8 *_rand, 29 | const u8 *sqn, const u8 *amf, u8 *mac_a, u8 *mac_s); 30 | int milenage_f2345(const u8 *opc, const u8 *k, const u8 *_rand, 31 | u8 *res, u8 *ck, u8 *ik, u8 *ak, u8 *akstar); 32 | 33 | #endif /* MILENAGE_H */ 34 | -------------------------------------------------------------------------------- /network/bully/src/crypto/ms_funcs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * WPA Supplicant / shared MSCHAPV2 helper functions / RFC 2433 / RFC 2759 3 | * Copyright (c) 2004-2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef MS_FUNCS_H 16 | #define MS_FUNCS_H 17 | 18 | int generate_nt_response(const u8 *auth_challenge, const u8 *peer_challenge, 19 | const u8 *username, size_t username_len, 20 | const u8 *password, size_t password_len, 21 | u8 *response); 22 | int generate_nt_response_pwhash(const u8 *auth_challenge, 23 | const u8 *peer_challenge, 24 | const u8 *username, size_t username_len, 25 | const u8 *password_hash, 26 | u8 *response); 27 | int generate_authenticator_response(const u8 *password, size_t password_len, 28 | const u8 *peer_challenge, 29 | const u8 *auth_challenge, 30 | const u8 *username, size_t username_len, 31 | const u8 *nt_response, u8 *response); 32 | int generate_authenticator_response_pwhash( 33 | const u8 *password_hash, 34 | const u8 *peer_challenge, const u8 *auth_challenge, 35 | const u8 *username, size_t username_len, 36 | const u8 *nt_response, u8 *response); 37 | int nt_challenge_response(const u8 *challenge, const u8 *password, 38 | size_t password_len, u8 *response); 39 | 40 | void challenge_response(const u8 *challenge, const u8 *password_hash, 41 | u8 *response); 42 | int nt_password_hash(const u8 *password, size_t password_len, 43 | u8 *password_hash); 44 | int hash_nt_password_hash(const u8 *password_hash, u8 *password_hash_hash); 45 | int get_master_key(const u8 *password_hash_hash, const u8 *nt_response, 46 | u8 *master_key); 47 | int get_asymetric_start_key(const u8 *master_key, u8 *session_key, 48 | size_t session_key_len, int is_send, 49 | int is_server); 50 | int __must_check encrypt_pw_block_with_password_hash( 51 | const u8 *password, size_t password_len, 52 | const u8 *password_hash, u8 *pw_block); 53 | int __must_check new_password_encrypted_with_old_nt_password_hash( 54 | const u8 *new_password, size_t new_password_len, 55 | const u8 *old_password, size_t old_password_len, 56 | u8 *encrypted_pw_block); 57 | void nt_password_hash_encrypted_with_block(const u8 *password_hash, 58 | const u8 *block, u8 *cypher); 59 | int old_nt_password_hash_encrypted_with_new_nt_password_hash( 60 | const u8 *new_password, size_t new_password_len, 61 | const u8 *old_password, size_t old_password_len, 62 | u8 *encrypted_password_hash); 63 | 64 | #endif /* MS_FUNCS_H */ 65 | -------------------------------------------------------------------------------- /network/bully/src/crypto/rc4.c: -------------------------------------------------------------------------------- 1 | /* 2 | * RC4 stream cipher 3 | * Copyright (c) 2002-2005, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | 17 | #include "common.h" 18 | #include "crypto.h" 19 | 20 | #define S_SWAP(a,b) do { u8 t = S[a]; S[a] = S[b]; S[b] = t; } while(0) 21 | 22 | int rc4_skip(const u8 *key, size_t keylen, size_t skip, 23 | u8 *data, size_t data_len) 24 | { 25 | u32 i, j, k; 26 | u8 S[256], *pos; 27 | size_t kpos; 28 | 29 | /* Setup RC4 state */ 30 | for (i = 0; i < 256; i++) 31 | S[i] = i; 32 | j = 0; 33 | kpos = 0; 34 | for (i = 0; i < 256; i++) { 35 | j = (j + S[i] + key[kpos]) & 0xff; 36 | kpos++; 37 | if (kpos >= keylen) 38 | kpos = 0; 39 | S_SWAP(i, j); 40 | } 41 | 42 | /* Skip the start of the stream */ 43 | i = j = 0; 44 | for (k = 0; k < skip; k++) { 45 | i = (i + 1) & 0xff; 46 | j = (j + S[i]) & 0xff; 47 | S_SWAP(i, j); 48 | } 49 | 50 | /* Apply RC4 to data */ 51 | pos = data; 52 | for (k = 0; k < data_len; k++) { 53 | i = (i + 1) & 0xff; 54 | j = (j + S[i]) & 0xff; 55 | S_SWAP(i, j); 56 | *pos++ ^= S[(S[i] + S[j]) & 0xff]; 57 | } 58 | 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /network/bully/src/crypto/sha1-pbkdf2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * SHA1-based key derivation function (PBKDF2) for IEEE 802.11i 3 | * Copyright (c) 2003-2005, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | 17 | #include "common.h" 18 | #include "sha1.h" 19 | #include "md5.h" 20 | #include "crypto.h" 21 | 22 | static int pbkdf2_sha1_f(const char *passphrase, const char *ssid, 23 | size_t ssid_len, int iterations, unsigned int count, 24 | u8 *digest) 25 | { 26 | unsigned char tmp[SHA1_MAC_LEN], tmp2[SHA1_MAC_LEN]; 27 | int i, j; 28 | unsigned char count_buf[4]; 29 | const u8 *addr[2]; 30 | size_t len[2]; 31 | size_t passphrase_len = os_strlen(passphrase); 32 | 33 | addr[0] = (u8 *) ssid; 34 | len[0] = ssid_len; 35 | addr[1] = count_buf; 36 | len[1] = 4; 37 | 38 | /* F(P, S, c, i) = U1 xor U2 xor ... Uc 39 | * U1 = PRF(P, S || i) 40 | * U2 = PRF(P, U1) 41 | * Uc = PRF(P, Uc-1) 42 | */ 43 | 44 | count_buf[0] = (count >> 24) & 0xff; 45 | count_buf[1] = (count >> 16) & 0xff; 46 | count_buf[2] = (count >> 8) & 0xff; 47 | count_buf[3] = count & 0xff; 48 | if (hmac_sha1_vector((u8 *) passphrase, passphrase_len, 2, addr, len, 49 | tmp)) 50 | return -1; 51 | os_memcpy(digest, tmp, SHA1_MAC_LEN); 52 | 53 | for (i = 1; i < iterations; i++) { 54 | if (hmac_sha1((u8 *) passphrase, passphrase_len, tmp, 55 | SHA1_MAC_LEN, tmp2)) 56 | return -1; 57 | os_memcpy(tmp, tmp2, SHA1_MAC_LEN); 58 | for (j = 0; j < SHA1_MAC_LEN; j++) 59 | digest[j] ^= tmp2[j]; 60 | } 61 | 62 | return 0; 63 | } 64 | 65 | 66 | /** 67 | * pbkdf2_sha1 - SHA1-based key derivation function (PBKDF2) for IEEE 802.11i 68 | * @passphrase: ASCII passphrase 69 | * @ssid: SSID 70 | * @ssid_len: SSID length in bytes 71 | * @iterations: Number of iterations to run 72 | * @buf: Buffer for the generated key 73 | * @buflen: Length of the buffer in bytes 74 | * Returns: 0 on success, -1 of failure 75 | * 76 | * This function is used to derive PSK for WPA-PSK. For this protocol, 77 | * iterations is set to 4096 and buflen to 32. This function is described in 78 | * IEEE Std 802.11-2004, Clause H.4. The main construction is from PKCS#5 v2.0. 79 | */ 80 | int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, 81 | int iterations, u8 *buf, size_t buflen) 82 | { 83 | unsigned int count = 0; 84 | unsigned char *pos = buf; 85 | size_t left = buflen, plen; 86 | unsigned char digest[SHA1_MAC_LEN]; 87 | 88 | while (left > 0) { 89 | count++; 90 | if (pbkdf2_sha1_f(passphrase, ssid, ssid_len, iterations, 91 | count, digest)) 92 | return -1; 93 | plen = left > SHA1_MAC_LEN ? SHA1_MAC_LEN : left; 94 | os_memcpy(pos, digest, plen); 95 | pos += plen; 96 | left -= plen; 97 | } 98 | 99 | return 0; 100 | } 101 | -------------------------------------------------------------------------------- /network/bully/src/crypto/sha1-tprf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * SHA1 T-PRF for EAP-FAST 3 | * Copyright (c) 2003-2005, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | 17 | #include "common.h" 18 | #include "sha1.h" 19 | #include "crypto.h" 20 | 21 | /** 22 | * sha1_t_prf - EAP-FAST Pseudo-Random Function (T-PRF) 23 | * @key: Key for PRF 24 | * @key_len: Length of the key in bytes 25 | * @label: A unique label for each purpose of the PRF 26 | * @seed: Seed value to bind into the key 27 | * @seed_len: Length of the seed 28 | * @buf: Buffer for the generated pseudo-random key 29 | * @buf_len: Number of bytes of key to generate 30 | * Returns: 0 on success, -1 of failure 31 | * 32 | * This function is used to derive new, cryptographically separate keys from a 33 | * given key for EAP-FAST. T-PRF is defined in RFC 4851, Section 5.5. 34 | */ 35 | int sha1_t_prf(const u8 *key, size_t key_len, const char *label, 36 | const u8 *seed, size_t seed_len, u8 *buf, size_t buf_len) 37 | { 38 | unsigned char counter = 0; 39 | size_t pos, plen; 40 | u8 hash[SHA1_MAC_LEN]; 41 | size_t label_len = os_strlen(label); 42 | u8 output_len[2]; 43 | const unsigned char *addr[5]; 44 | size_t len[5]; 45 | 46 | addr[0] = hash; 47 | len[0] = 0; 48 | addr[1] = (unsigned char *) label; 49 | len[1] = label_len + 1; 50 | addr[2] = seed; 51 | len[2] = seed_len; 52 | addr[3] = output_len; 53 | len[3] = 2; 54 | addr[4] = &counter; 55 | len[4] = 1; 56 | 57 | output_len[0] = (buf_len >> 8) & 0xff; 58 | output_len[1] = buf_len & 0xff; 59 | pos = 0; 60 | while (pos < buf_len) { 61 | counter++; 62 | plen = buf_len - pos; 63 | if (hmac_sha1_vector(key, key_len, 5, addr, len, hash)) 64 | return -1; 65 | if (plen >= SHA1_MAC_LEN) { 66 | os_memcpy(&buf[pos], hash, SHA1_MAC_LEN); 67 | pos += SHA1_MAC_LEN; 68 | } else { 69 | os_memcpy(&buf[pos], hash, plen); 70 | break; 71 | } 72 | len[0] = SHA1_MAC_LEN; 73 | } 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /network/bully/src/crypto/sha1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SHA1 hash implementation and interface functions 3 | * Copyright (c) 2003-2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef SHA1_H 16 | #define SHA1_H 17 | 18 | #define SHA1_MAC_LEN 20 19 | 20 | int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, 21 | const u8 *addr[], const size_t *len, u8 *mac); 22 | int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, 23 | u8 *mac); 24 | int sha1_prf(const u8 *key, size_t key_len, const char *label, 25 | const u8 *data, size_t data_len, u8 *buf, size_t buf_len); 26 | int sha1_t_prf(const u8 *key, size_t key_len, const char *label, 27 | const u8 *seed, size_t seed_len, u8 *buf, size_t buf_len); 28 | int __must_check tls_prf(const u8 *secret, size_t secret_len, 29 | const char *label, const u8 *seed, size_t seed_len, 30 | u8 *out, size_t outlen); 31 | int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, 32 | int iterations, u8 *buf, size_t buflen); 33 | #endif /* SHA1_H */ 34 | -------------------------------------------------------------------------------- /network/bully/src/crypto/sha1_i.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SHA1 internal definitions 3 | * Copyright (c) 2003-2005, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef SHA1_I_H 16 | #define SHA1_I_H 17 | 18 | struct SHA1Context { 19 | u32 state[5]; 20 | u32 count[2]; 21 | unsigned char buffer[64]; 22 | }; 23 | 24 | void SHA1Init(struct SHA1Context *context); 25 | void SHA1Update(struct SHA1Context *context, const void *data, u32 len); 26 | void SHA1Final(unsigned char digest[20], struct SHA1Context *context); 27 | void SHA1Transform(u32 state[5], const unsigned char buffer[64]); 28 | 29 | #endif /* SHA1_I_H */ 30 | -------------------------------------------------------------------------------- /network/bully/src/crypto/sha256.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SHA256 hash implementation and interface functions 3 | * Copyright (c) 2003-2006, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef SHA256_H 16 | #define SHA256_H 17 | 18 | #define SHA256_MAC_LEN 32 19 | 20 | void hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, 21 | const u8 *addr[], const size_t *len, u8 *mac); 22 | void hmac_sha256(const u8 *key, size_t key_len, const u8 *data, 23 | size_t data_len, u8 *mac); 24 | void sha256_prf(const u8 *key, size_t key_len, const char *label, 25 | const u8 *data, size_t data_len, u8 *buf, size_t buf_len); 26 | 27 | #endif /* SHA256_H */ 28 | -------------------------------------------------------------------------------- /network/bully/src/frame.c: -------------------------------------------------------------------------------- 1 | /* 2 | bully - retrieve WPA/WPA2 passphrase from a WPS-enabled AP 3 | 4 | Copyright (C) 2012 Brian Purcell 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | #include "80211.h" 20 | #include "frame.h" 21 | 22 | 23 | static inline void f_set(frame_t *fp, int id, int next, uint8 *data, int size, int list) 24 | { 25 | fp[id].next = (next ? &fp[next] : NULL); 26 | fp[id].data = data; 27 | fp[id].size = size; 28 | fp[id].list = (list ? &fp[list] : NULL); 29 | }; 30 | 31 | 32 | frame_t *f_init() 33 | { 34 | frame_t *fp = calloc(F_SIZE, F_MAX); 35 | if (fp) { 36 | f_set(fp, F_ALL, 0, NULL, 0, F_TAP); 37 | f_set(fp, F_TAP, F_MAC, NULL, 0, 0); 38 | f_set(fp, F_MAC, F_PAY, NULL, 0, 0); 39 | f_set(fp, F_PAY, F_FCS, NULL, 0, F_LLC); 40 | f_set(fp, F_FCS, 0, NULL, 0, 0); 41 | f_set(fp, F_LLC, F_D1X, NULL, 0, 0); 42 | f_set(fp, F_D1X, F_EAP, NULL, 0, 0); 43 | f_set(fp, F_EAP, F_WFA, NULL, 0, 0); 44 | f_set(fp, F_WFA, F_MSG, NULL, 0, 0); 45 | f_set(fp, F_MSG, F_IDK, NULL, 0, 0); 46 | f_set(fp, F_IDK, 0, NULL, 0, 0); 47 | }; 48 | return fp; 49 | }; 50 | -------------------------------------------------------------------------------- /network/bully/src/frame.h: -------------------------------------------------------------------------------- 1 | /* 2 | bully - retrieve WPA/WPA2 passphrase from a WPS-enabled AP 3 | 4 | Copyright (C) 2012 Brian Purcell 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | #ifndef _FRAME_H 20 | #define _FRAME_H 21 | 22 | struct frame { 23 | struct frame *next; 24 | uint8 *data; 25 | int size; 26 | struct frame *list; 27 | }; 28 | typedef struct frame frame_t; 29 | #define F_SIZE (sizeof(frame_t)) 30 | 31 | #define F_ALL 0 32 | #define F_TAP 1 33 | #define F_MAC 2 34 | #define F_PAY 3 35 | #define F_FCS 4 36 | #define F_LLC 5 37 | #define F_D1X 6 38 | #define F_EAP 7 39 | #define F_WFA 8 40 | #define F_MSG 9 41 | #define F_IDK 10 42 | #define F_MAX 11 43 | 44 | static inline void f_set(frame_t * fp, int id, int next, uint8 * data, int size, int list); 45 | 46 | #endif /* _FRAME_H */ 47 | -------------------------------------------------------------------------------- /network/bully/src/iface.h: -------------------------------------------------------------------------------- 1 | /* 2 | bully - retrieve WPA/WPA2 passphrase from a WPS-enabled AP 3 | 4 | Copyright (C) 2012 Brian Purcell 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | #ifndef _IFACE_H 20 | #define _IFACE_H 21 | 22 | #include "bully.h" 23 | 24 | char BG_CHANS[] = "1,5,9,13,2,6,10,3,7,11,4,8,12"; 25 | char AN_CHANS[] = "36,40,44,48,52,56,58,60"; 26 | 27 | struct cfreq { 28 | int chan; 29 | int freq; 30 | } freqs[] = { 31 | { 1, 241200000 }, 32 | { 2, 241700000 }, 33 | { 3, 242200000 }, 34 | { 4, 242700000 }, 35 | { 5, 243200000 }, 36 | { 6, 243700000 }, 37 | { 7, 244200000 }, 38 | { 8, 244700000 }, 39 | { 9, 245200000 }, 40 | { 10, 245700000 }, 41 | { 11, 246200000 }, 42 | { 12, 246700000 }, 43 | { 13, 247200000 }, 44 | { 14, 248400000 }, 45 | { 34, 517000000 }, 46 | { 36, 518000000 }, 47 | { 38, 519000000 }, 48 | { 40, 520000000 }, 49 | { 42, 521000000 }, 50 | { 44, 522000000 }, 51 | { 46, 523000000 }, 52 | { 48, 524000000 }, 53 | { 52, 526000000 }, 54 | { 56, 528000000 }, 55 | { 58, 530000000 }, 56 | { 60, 532000000 }, 57 | { 100, 550000000 }, 58 | { 104, 552000000 }, 59 | { 108, 554000000 }, 60 | { 112, 556000000 }, 61 | { 116, 558000000 }, 62 | { 120, 560000000 }, 63 | { 124, 562000000 }, 64 | { 128, 564000000 }, 65 | { 132, 566000000 }, 66 | { 136, 568000000 }, 67 | { 140, 570000000 }, 68 | { 149, 574500000 }, 69 | { 153, 576500000 }, 70 | { 157, 578500000 }, 71 | { 161, 580500000 }, 72 | { 165, 582500000 } 73 | #define MAX_CHAN 165 74 | }; 75 | 76 | #define NUM_CHAN (sizeof(freqs)/sizeof(struct cfreq)) 77 | 78 | int set_chan(struct global *G, int chan); 79 | int set_chanx(struct global *G, int chanx); 80 | int next_chan(struct global *G); 81 | 82 | #endif /* _IFACE_H */ 83 | -------------------------------------------------------------------------------- /network/bully/src/lua/pure_algorithm.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Pure implementations in Lua 5.2 (without using the 'algorithm' library) 3 | ]]-- 4 | 5 | -- Same as 'algorithm.hex2dec(tbl_bssid, [offset])' 6 | -- or 'algorithm.hex2dec(str_bssid, [offset])' 7 | function gen_hex2dec(offset) 8 | local pin = tonumber(str_bssid:sub(-6), 16) 9 | pin = pin + (offset == nil and 0 or offset) -- Default offset = 0 10 | pin = pin % 10000000 11 | return pin * 10 + wps_pin_checksum(pin) 12 | end 13 | 14 | -- Same as 'algorithm.zyxel(tbl_bssid, [offset])' 15 | -- or 'algorithm.zyxel(str_bssid, [offset])' 16 | function gen_zyxel(offset) 17 | local pin = tonumber(str_bssid:sub(-1, -2) .. str_bssid:sub(-3, -4) 18 | .. str_bssid:sub(-5, -6), 16) 19 | pin = pin + (offset == nil and 0 or offset) 20 | pin = pin % 10000000 21 | return pin * 10 + wps_pin_checksum(pin) 22 | end 23 | 24 | -- Same as 'algorithm.dlink(tbl_bssid, [offset])' 25 | -- or 'algorithm.dlink(str_bssid, [offset]) 26 | function gen_dlink(offset) 27 | local pin = tonumber(str_bssid:sub(-6), 16) 28 | pin = pin + (offset == nil and 1 or offset) -- WAN mac is BSSID + 1 (default) 29 | pin = bit32.bxor(pin, tonumber("0x55AA55")) 30 | pin = bit32.bxor(pin, (bit32.lshift(bit32.band(pin, 15), 4) 31 | + bit32.lshift(bit32.band(pin, 15), 8) 32 | + bit32.lshift(bit32.band(pin, 15), 12) 33 | + bit32.lshift(bit32.band(pin, 15), 16) 34 | + bit32.lshift(bit32.band(pin, 15), 20))) 35 | pin = pin % 10000000 36 | if (pin < 1000000) then pin = pin + ((pin % 9) * 1000000) + 1000000 end 37 | return pin * 10 + wps_pin_checksum(pin) 38 | end 39 | 40 | -- Same as 'algorithm.belink(tbl_bssid, str_wps_serial)' 41 | -- or 'algorithm.belink(str_bssid, str_wps_serial)' 42 | function gen_belkin() 43 | local sn = { 44 | tonumber(str_wps_serial:sub(-1, -1), 16), 45 | tonumber(str_wps_serial:sub(-2, -2), 16), 46 | tonumber(str_wps_serial:sub(-3, -3), 16), 47 | tonumber(str_wps_serial:sub(-4, -4), 16) 48 | } 49 | local nic = { 50 | tonumber(str_bssid:sub(-1, -1), 16), 51 | tonumber(str_bssid:sub(-2, -2), 16), 52 | tonumber(str_bssid:sub(-3, -3), 16), 53 | tonumber(str_bssid:sub(-4, -4), 16) 54 | } 55 | local k1 = (sn[3] + sn[4] + nic[1] + nic[2]) % 16 56 | local k2 = (sn[1] + sn[2] + nic[4] + nic[3]) % 16 57 | local pin = bit32.bxor(k1, sn[2]) 58 | local t1, t2 = bit32.bxor(k1, sn[1]), bit32.bxor(k2, nic[2]) 59 | local p1 = bit32.bxor(nic[1], sn[2], t1) 60 | local p2 = bit32.bxor(k2, nic[1], t2) 61 | local p3 = bit32.bxor(k1, sn[3], k2, nic[3]) 62 | 63 | k1 = bit32.bxor(k1, k2) 64 | 65 | pin = bit32.bxor(pin, k1) * 16 66 | pin = (pin + t1) * 16; 67 | pin = (pin + p1) * 16; 68 | pin = (pin + t2) * 16; 69 | pin = (pin + p2) * 16; 70 | pin = (pin + k1) * 16; 71 | pin = pin + p3 72 | pin = (pin % 10000000) - (math.floor((pin % 10000000) / 10000000) * k1) 73 | return pin * 10 + wps_pin_checksum(pin) 74 | end 75 | -------------------------------------------------------------------------------- /network/bully/src/lua/pure_wps.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Pure implementations in Lua 5.2 (without using the 'wps' library) 3 | ]]-- 4 | 5 | -- Same as 'wps.pin_checksum(pin)' 6 | function wps_pin_checksum(pin) 7 | local accum = 0 8 | pin = pin * 10 9 | accum = accum + 3 * (math.floor(pin / 10000000) % 10) 10 | accum = accum + 1 * (math.floor(pin / 1000000) % 10) 11 | accum = accum + 3 * (math.floor(pin / 100000) % 10) 12 | accum = accum + 1 * (math.floor(pin / 10000) % 10) 13 | accum = accum + 3 * (math.floor(pin / 1000) % 10) 14 | accum = accum + 1 * (math.floor(pin / 100) % 10) 15 | accum = accum + 3 * (math.floor(pin / 10) % 10) 16 | return (10 - (accum % 10)) % 10 17 | end 18 | 19 | -- Same as 'wps.pin_valid(pin)' except this one returns true or false (!) 20 | function wps_pin_valid(pin) 21 | return wps_pin_checksum(math.floor(pin / 10)) == (pin % 10) 22 | end 23 | -------------------------------------------------------------------------------- /network/bully/src/lua/template.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | DO NOT modify directly global variables IF you want to preserve 3 | their original value throughout the execution of the script 4 | (tables and numbers; strings are immutable) 5 | ]]-- 6 | 7 | -- Make use of provided libraries! 8 | require("algorithm") 9 | -- require("wps") 10 | 11 | -- Entry point (returns an arbitrary list of PINs) 12 | function main() 13 | return algorithm.hex2dec(str_bssid), 12345670 14 | end 15 | 16 | --[[ 17 | Global variables: 18 | * tbl_bssid[1..6] (or 'str_bssid' as string variant) 19 | * str_essid (string) 20 | * str_wps_serial (string) 21 | * wps_version (real) 22 | ]]-- 23 | -------------------------------------------------------------------------------- /network/bully/src/luaclib.h: -------------------------------------------------------------------------------- 1 | /* 2 | bully - retrieve WPA/WPA2 passphrase from a WPS-enabled AP 3 | 4 | Copyright (C) 2017 wiire 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | /* Open WPS-related library */ 22 | int luaopen_wpslib(lua_State *L); 23 | 24 | /* Open PIN algorithms library */ 25 | int luaopen_algolib(lua_State *L); 26 | 27 | /* Create a basic Lua environment (omit some libraries) */ 28 | lua_State *basic_env(); 29 | -------------------------------------------------------------------------------- /network/bully/src/pdust.c: -------------------------------------------------------------------------------- 1 | /* 2 | bully - retrieve WPA/WPA2 passphrase from a WPS-enabled AP 3 | 4 | Copyright (C) 2017 wiire 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | #include 20 | #include 21 | 22 | #include "pdust.h" 23 | 24 | char OUI_NULL[OUI_STR_LEN] = "-"; 25 | vendor_t vendor_list[] = { 26 | {"\x00\x03\x7f", "AtherosC", PWPS_NONE}, /* Atheros Communications */ 27 | {"\x00\x10\x18", "Broadcom", PWPS_ECOS_SIMPLE}, /* Broadcom */ 28 | {"\x00\x50\x43", "MarvellS", PWPS_NONE}, /* MARVELL SEMICONDUCTOR, INC */ 29 | {"\x00\x0c\x43", "RalinkTe", PWPS_RT}, /* Ralink Technology, Corp. */ 30 | {"\x00\xe0\x4c", "RealtekS", PWPS_RTL819x} /* REALTEK SEMICONDUCTOR CORP. */ 31 | }; 32 | 33 | #define VENDOR_LIST_SIZE (sizeof(vendor_list)/sizeof(vendor_list[0])) 34 | 35 | char *get_vendor(uint8_t * oui) 36 | { 37 | int i; 38 | for (i = 0; i < VENDOR_LIST_SIZE; i++) { 39 | if (!memcmp(vendor_list[i].oui, oui, 3)) 40 | return vendor_list[i].name; 41 | }; 42 | return OUI_NULL; 43 | }; 44 | -------------------------------------------------------------------------------- /network/bully/src/pdust.h: -------------------------------------------------------------------------------- 1 | /* 2 | bully - retrieve WPA/WPA2 passphrase from a WPS-enabled AP 3 | 4 | Copyright (C) 2017 wiire 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | #ifndef _PDUST_H 20 | #define _PDUST_H 21 | 22 | #include 23 | 24 | /* Pixiewps modes */ 25 | #define PWPS_NONE 0 26 | #define PWPS_RT 1 27 | #define PWPS_ECOS_SIMPLE 2 28 | #define PWPS_RTL819x 3 29 | #define PWPS_ECOS_SIMPLEST 4 30 | #define PWPS_ECOS_KNUTH 5 31 | 32 | #define OUI_STR_LEN 8 + 1 33 | struct vendor_oui { 34 | uint8_t oui[3]; 35 | char name[OUI_STR_LEN]; 36 | uint8_t pixiewps_mode; 37 | }; 38 | typedef struct vendor_oui vendor_t; 39 | 40 | extern char OUI_NULL[OUI_STR_LEN]; 41 | extern vendor_t vendor_list[]; 42 | 43 | char *get_vendor(uint8_t *oui); 44 | 45 | struct wps_info { 46 | uint8_t vendor[3]; 47 | uint8_t vendor_p; 48 | uint8_t version; 49 | uint8_t uuid[16]; 50 | uint16_t category; 51 | uint16_t subcategory; 52 | uint16_t passw_id; 53 | uint8_t passw_id_p; 54 | uint16_t config_methods; 55 | char manufacturer[64 + 1]; 56 | char device_name[32 + 1]; 57 | char model_name[32 + 1]; 58 | char model_number[32 + 1]; 59 | char serial_number[32 + 1]; 60 | }; 61 | typedef struct wps_info wps_info_t; 62 | 63 | #endif /* _PDUST_H */ 64 | -------------------------------------------------------------------------------- /network/bully/src/pingen.h: -------------------------------------------------------------------------------- 1 | /* 2 | bully - retrieve WPA/WPA2 passphrase from a WPS-enabled AP 3 | 4 | Copyright (C) 2017 wiire 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | #ifndef _PINGEN_H 20 | #define _PINGEN_H 21 | 22 | #include 23 | 24 | unsigned int gen_hex2dec(uint8_t *bssid, const int offset); 25 | unsigned int gen_zyxel(uint8_t *bssid, const int offset); 26 | unsigned int gen_dlink(uint8_t *bssid, const int offset); 27 | unsigned int gen_belkin(uint8_t *bssid, const char *serial); 28 | 29 | /* Included to avoid possible linking issues with main project */ 30 | unsigned int m_wps_pin_checksum(unsigned int pin); 31 | unsigned int m_wps_pin_valid(unsigned int pin); 32 | 33 | #endif /* _PINGEN_H */ 34 | -------------------------------------------------------------------------------- /network/bully/src/timer.c: -------------------------------------------------------------------------------- 1 | /* 2 | bully - retrieve WPA/WPA2 passphrase from a WPS-enabled AP 3 | 4 | Copyright (C) 2012 Brian Purcell 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | static inline void set_timer(struct timeval *tv, int ms_from_now) 21 | { 22 | gettimeofday(tv, 0); 23 | tv->tv_sec += ms_from_now / 1000; 24 | ms_from_now -= (ms_from_now / 1000) * 1000; 25 | tv->tv_usec += ms_from_now * 1000; 26 | }; 27 | 28 | 29 | static inline int check_timer(struct timeval *tv) 30 | { 31 | struct timeval now; 32 | gettimeofday(&now, 0); 33 | if (tv->tv_sec < now.tv_sec) 34 | return TRUE; 35 | if (tv->tv_sec == now.tv_sec && tv->tv_usec < now.tv_usec) 36 | return TRUE; 37 | return FALSE; 38 | }; 39 | 40 | 41 | static inline int elapsed(struct timeval *then) 42 | { 43 | struct timeval now; 44 | gettimeofday(&now, 0); 45 | 46 | if (now.tv_usec < then->tv_usec) 47 | return ((now.tv_sec - 1) - then->tv_sec) * 1000 + (now.tv_usec + 1000000 - 48 | then->tv_usec) / 1000; 49 | else 50 | return (now.tv_sec - then->tv_sec) * 1000 + (now.tv_usec - then->tv_usec) / 1000; 51 | }; 52 | -------------------------------------------------------------------------------- /network/bully/src/tls/.gitignore: -------------------------------------------------------------------------------- 1 | libtls.a 2 | -------------------------------------------------------------------------------- /network/bully/src/tls/Makefile: -------------------------------------------------------------------------------- 1 | all: libtls.a 2 | 3 | clean: 4 | rm -f *~ *.o *.d libtls.a 5 | 6 | install: 7 | @echo Nothing to be made. 8 | 9 | 10 | include ../lib.rules 11 | 12 | CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH 13 | CFLAGS += -DCONFIG_CRYPTO_INTERNAL 14 | 15 | LIB_OBJS= \ 16 | asn1.o \ 17 | bignum.o \ 18 | pkcs1.o \ 19 | pkcs5.o \ 20 | pkcs8.o \ 21 | rsa.o \ 22 | tlsv1_client.o \ 23 | tlsv1_client_read.o \ 24 | tlsv1_client_write.o \ 25 | tlsv1_common.o \ 26 | tlsv1_cred.o \ 27 | tlsv1_record.o \ 28 | tlsv1_server.o \ 29 | tlsv1_server_read.o \ 30 | tlsv1_server_write.o \ 31 | x509v3.o 32 | 33 | 34 | libtls.a: $(LIB_OBJS) 35 | $(AR) crT $@ $? 36 | 37 | -include $(OBJS:%.o=%.d) 38 | -------------------------------------------------------------------------------- /network/bully/src/tls/asn1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ASN.1 DER parsing 3 | * Copyright (c) 2006, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef ASN1_H 16 | #define ASN1_H 17 | 18 | #define ASN1_TAG_EOC 0x00 /* not used with DER */ 19 | #define ASN1_TAG_BOOLEAN 0x01 20 | #define ASN1_TAG_INTEGER 0x02 21 | #define ASN1_TAG_BITSTRING 0x03 22 | #define ASN1_TAG_OCTETSTRING 0x04 23 | #define ASN1_TAG_NULL 0x05 24 | #define ASN1_TAG_OID 0x06 25 | #define ASN1_TAG_OBJECT_DESCRIPTOR 0x07 /* not yet parsed */ 26 | #define ASN1_TAG_EXTERNAL 0x08 /* not yet parsed */ 27 | #define ASN1_TAG_REAL 0x09 /* not yet parsed */ 28 | #define ASN1_TAG_ENUMERATED 0x0A /* not yet parsed */ 29 | #define ASN1_TAG_UTF8STRING 0x0C /* not yet parsed */ 30 | #define ANS1_TAG_RELATIVE_OID 0x0D 31 | #define ASN1_TAG_SEQUENCE 0x10 /* shall be constructed */ 32 | #define ASN1_TAG_SET 0x11 33 | #define ASN1_TAG_NUMERICSTRING 0x12 /* not yet parsed */ 34 | #define ASN1_TAG_PRINTABLESTRING 0x13 35 | #define ASN1_TAG_TG1STRING 0x14 /* not yet parsed */ 36 | #define ASN1_TAG_VIDEOTEXSTRING 0x15 /* not yet parsed */ 37 | #define ASN1_TAG_IA5STRING 0x16 38 | #define ASN1_TAG_UTCTIME 0x17 39 | #define ASN1_TAG_GENERALIZEDTIME 0x18 /* not yet parsed */ 40 | #define ASN1_TAG_GRAPHICSTRING 0x19 /* not yet parsed */ 41 | #define ASN1_TAG_VISIBLESTRING 0x1A 42 | #define ASN1_TAG_GENERALSTRING 0x1B /* not yet parsed */ 43 | #define ASN1_TAG_UNIVERSALSTRING 0x1C /* not yet parsed */ 44 | #define ASN1_TAG_BMPSTRING 0x1D /* not yet parsed */ 45 | 46 | #define ASN1_CLASS_UNIVERSAL 0 47 | #define ASN1_CLASS_APPLICATION 1 48 | #define ASN1_CLASS_CONTEXT_SPECIFIC 2 49 | #define ASN1_CLASS_PRIVATE 3 50 | 51 | 52 | struct asn1_hdr { 53 | const u8 *payload; 54 | u8 identifier, class, constructed; 55 | unsigned int tag, length; 56 | }; 57 | 58 | #define ASN1_MAX_OID_LEN 20 59 | struct asn1_oid { 60 | unsigned long oid[ASN1_MAX_OID_LEN]; 61 | size_t len; 62 | }; 63 | 64 | 65 | int asn1_get_next(const u8 *buf, size_t len, struct asn1_hdr *hdr); 66 | int asn1_parse_oid(const u8 *buf, size_t len, struct asn1_oid *oid); 67 | int asn1_get_oid(const u8 *buf, size_t len, struct asn1_oid *oid, 68 | const u8 **next); 69 | void asn1_oid_to_str(struct asn1_oid *oid, char *buf, size_t len); 70 | unsigned long asn1_bit_string_to_long(const u8 *buf, size_t len); 71 | 72 | #endif /* ASN1_H */ 73 | -------------------------------------------------------------------------------- /network/bully/src/tls/bignum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Big number math 3 | * Copyright (c) 2006, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef BIGNUM_H 16 | #define BIGNUM_H 17 | 18 | struct bignum; 19 | 20 | struct bignum * bignum_init(void); 21 | void bignum_deinit(struct bignum *n); 22 | size_t bignum_get_unsigned_bin_len(struct bignum *n); 23 | int bignum_get_unsigned_bin(const struct bignum *n, u8 *buf, size_t *len); 24 | int bignum_set_unsigned_bin(struct bignum *n, const u8 *buf, size_t len); 25 | int bignum_cmp(const struct bignum *a, const struct bignum *b); 26 | int bignum_cmp_d(const struct bignum *a, unsigned long b); 27 | int bignum_add(const struct bignum *a, const struct bignum *b, 28 | struct bignum *c); 29 | int bignum_sub(const struct bignum *a, const struct bignum *b, 30 | struct bignum *c); 31 | int bignum_mul(const struct bignum *a, const struct bignum *b, 32 | struct bignum *c); 33 | int bignum_mulmod(const struct bignum *a, const struct bignum *b, 34 | const struct bignum *c, struct bignum *d); 35 | int bignum_exptmod(const struct bignum *a, const struct bignum *b, 36 | const struct bignum *c, struct bignum *d); 37 | 38 | #endif /* BIGNUM_H */ 39 | -------------------------------------------------------------------------------- /network/bully/src/tls/pkcs1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PKCS #1 (RSA Encryption) 3 | * Copyright (c) 2006-2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef PKCS1_H 16 | #define PKCS1_H 17 | 18 | int pkcs1_encrypt(int block_type, struct crypto_rsa_key *key, 19 | int use_private, const u8 *in, size_t inlen, 20 | u8 *out, size_t *outlen); 21 | int pkcs1_v15_private_key_decrypt(struct crypto_rsa_key *key, 22 | const u8 *in, size_t inlen, 23 | u8 *out, size_t *outlen); 24 | int pkcs1_decrypt_public_key(struct crypto_rsa_key *key, 25 | const u8 *crypt, size_t crypt_len, 26 | u8 *plain, size_t *plain_len); 27 | 28 | #endif /* PKCS1_H */ 29 | -------------------------------------------------------------------------------- /network/bully/src/tls/pkcs5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PKCS #5 (Password-based Encryption) 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef PKCS5_H 16 | #define PKCS5_H 17 | 18 | u8 * pkcs5_decrypt(const u8 *enc_alg, size_t enc_alg_len, 19 | const u8 *enc_data, size_t enc_data_len, 20 | const char *passwd, size_t *data_len); 21 | 22 | #endif /* PKCS5_H */ 23 | -------------------------------------------------------------------------------- /network/bully/src/tls/pkcs8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PKCS #8 (Private-key information syntax) 3 | * Copyright (c) 2006-2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef PKCS8_H 16 | #define PKCS8_H 17 | 18 | struct crypto_private_key * pkcs8_key_import(const u8 *buf, size_t len); 19 | struct crypto_private_key * 20 | pkcs8_enc_key_import(const u8 *buf, size_t len, const char *passwd); 21 | 22 | #endif /* PKCS8_H */ 23 | -------------------------------------------------------------------------------- /network/bully/src/tls/rsa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RSA 3 | * Copyright (c) 2006, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef RSA_H 16 | #define RSA_H 17 | 18 | struct crypto_rsa_key; 19 | 20 | struct crypto_rsa_key * 21 | crypto_rsa_import_public_key(const u8 *buf, size_t len); 22 | struct crypto_rsa_key * 23 | crypto_rsa_import_private_key(const u8 *buf, size_t len); 24 | size_t crypto_rsa_get_modulus_len(struct crypto_rsa_key *key); 25 | int crypto_rsa_exptmod(const u8 *in, size_t inlen, u8 *out, size_t *outlen, 26 | struct crypto_rsa_key *key, int use_private); 27 | void crypto_rsa_free(struct crypto_rsa_key *key); 28 | 29 | #endif /* RSA_H */ 30 | -------------------------------------------------------------------------------- /network/bully/src/tls/tlsv1_client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TLSv1 client (RFC 2246) 3 | * Copyright (c) 2006-2007, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef TLSV1_CLIENT_H 16 | #define TLSV1_CLIENT_H 17 | 18 | #include "tlsv1_cred.h" 19 | 20 | struct tlsv1_client; 21 | 22 | int tlsv1_client_global_init(void); 23 | void tlsv1_client_global_deinit(void); 24 | struct tlsv1_client * tlsv1_client_init(void); 25 | void tlsv1_client_deinit(struct tlsv1_client *conn); 26 | int tlsv1_client_established(struct tlsv1_client *conn); 27 | int tlsv1_client_prf(struct tlsv1_client *conn, const char *label, 28 | int server_random_first, u8 *out, size_t out_len); 29 | u8 * tlsv1_client_handshake(struct tlsv1_client *conn, 30 | const u8 *in_data, size_t in_len, 31 | size_t *out_len, u8 **appl_data, 32 | size_t *appl_data_len); 33 | int tlsv1_client_encrypt(struct tlsv1_client *conn, 34 | const u8 *in_data, size_t in_len, 35 | u8 *out_data, size_t out_len); 36 | int tlsv1_client_decrypt(struct tlsv1_client *conn, 37 | const u8 *in_data, size_t in_len, 38 | u8 *out_data, size_t out_len); 39 | int tlsv1_client_get_cipher(struct tlsv1_client *conn, char *buf, 40 | size_t buflen); 41 | int tlsv1_client_shutdown(struct tlsv1_client *conn); 42 | int tlsv1_client_resumed(struct tlsv1_client *conn); 43 | int tlsv1_client_hello_ext(struct tlsv1_client *conn, int ext_type, 44 | const u8 *data, size_t data_len); 45 | int tlsv1_client_get_keys(struct tlsv1_client *conn, struct tls_keys *keys); 46 | int tlsv1_client_get_keyblock_size(struct tlsv1_client *conn); 47 | int tlsv1_client_set_cipher_list(struct tlsv1_client *conn, u8 *ciphers); 48 | int tlsv1_client_set_cred(struct tlsv1_client *conn, 49 | struct tlsv1_credentials *cred); 50 | 51 | typedef int (*tlsv1_client_session_ticket_cb) 52 | (void *ctx, const u8 *ticket, size_t len, const u8 *client_random, 53 | const u8 *server_random, u8 *master_secret); 54 | 55 | void tlsv1_client_set_session_ticket_cb(struct tlsv1_client *conn, 56 | tlsv1_client_session_ticket_cb cb, 57 | void *ctx); 58 | 59 | #endif /* TLSV1_CLIENT_H */ 60 | -------------------------------------------------------------------------------- /network/bully/src/tls/tlsv1_client_i.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TLSv1 client - internal structures 3 | * Copyright (c) 2006-2007, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef TLSV1_CLIENT_I_H 16 | #define TLSV1_CLIENT_I_H 17 | 18 | struct tlsv1_client { 19 | enum { 20 | CLIENT_HELLO, SERVER_HELLO, SERVER_CERTIFICATE, 21 | SERVER_KEY_EXCHANGE, SERVER_CERTIFICATE_REQUEST, 22 | SERVER_HELLO_DONE, CLIENT_KEY_EXCHANGE, CHANGE_CIPHER_SPEC, 23 | SERVER_CHANGE_CIPHER_SPEC, SERVER_FINISHED, ACK_FINISHED, 24 | ESTABLISHED, FAILED 25 | } state; 26 | 27 | struct tlsv1_record_layer rl; 28 | 29 | u8 session_id[TLS_SESSION_ID_MAX_LEN]; 30 | size_t session_id_len; 31 | u8 client_random[TLS_RANDOM_LEN]; 32 | u8 server_random[TLS_RANDOM_LEN]; 33 | u8 master_secret[TLS_MASTER_SECRET_LEN]; 34 | 35 | u8 alert_level; 36 | u8 alert_description; 37 | 38 | unsigned int certificate_requested:1; 39 | unsigned int session_resumed:1; 40 | unsigned int session_ticket_included:1; 41 | unsigned int use_session_ticket:1; 42 | 43 | struct crypto_public_key *server_rsa_key; 44 | 45 | struct tls_verify_hash verify; 46 | 47 | #define MAX_CIPHER_COUNT 30 48 | u16 cipher_suites[MAX_CIPHER_COUNT]; 49 | size_t num_cipher_suites; 50 | 51 | u16 prev_cipher_suite; 52 | 53 | u8 *client_hello_ext; 54 | size_t client_hello_ext_len; 55 | 56 | /* The prime modulus used for Diffie-Hellman */ 57 | u8 *dh_p; 58 | size_t dh_p_len; 59 | /* The generator used for Diffie-Hellman */ 60 | u8 *dh_g; 61 | size_t dh_g_len; 62 | /* The server's Diffie-Hellman public value */ 63 | u8 *dh_ys; 64 | size_t dh_ys_len; 65 | 66 | struct tlsv1_credentials *cred; 67 | 68 | tlsv1_client_session_ticket_cb session_ticket_cb; 69 | void *session_ticket_cb_ctx; 70 | }; 71 | 72 | 73 | void tls_alert(struct tlsv1_client *conn, u8 level, u8 description); 74 | void tlsv1_client_free_dh(struct tlsv1_client *conn); 75 | int tls_derive_pre_master_secret(u8 *pre_master_secret); 76 | int tls_derive_keys(struct tlsv1_client *conn, 77 | const u8 *pre_master_secret, size_t pre_master_secret_len); 78 | u8 * tls_send_client_hello(struct tlsv1_client *conn, size_t *out_len); 79 | u8 * tlsv1_client_send_alert(struct tlsv1_client *conn, u8 level, 80 | u8 description, size_t *out_len); 81 | u8 * tlsv1_client_handshake_write(struct tlsv1_client *conn, size_t *out_len, 82 | int no_appl_data); 83 | int tlsv1_client_process_handshake(struct tlsv1_client *conn, u8 ct, 84 | const u8 *buf, size_t *len, 85 | u8 **out_data, size_t *out_len); 86 | 87 | #endif /* TLSV1_CLIENT_I_H */ 88 | -------------------------------------------------------------------------------- /network/bully/src/tls/tlsv1_cred.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TLSv1 credentials 3 | * Copyright (c) 2006-2007, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef TLSV1_CRED_H 16 | #define TLSV1_CRED_H 17 | 18 | struct tlsv1_credentials { 19 | struct x509_certificate *trusted_certs; 20 | struct x509_certificate *cert; 21 | struct crypto_private_key *key; 22 | 23 | /* Diffie-Hellman parameters */ 24 | u8 *dh_p; /* prime */ 25 | size_t dh_p_len; 26 | u8 *dh_g; /* generator */ 27 | size_t dh_g_len; 28 | }; 29 | 30 | 31 | struct tlsv1_credentials * tlsv1_cred_alloc(void); 32 | void tlsv1_cred_free(struct tlsv1_credentials *cred); 33 | int tlsv1_set_ca_cert(struct tlsv1_credentials *cred, const char *cert, 34 | const u8 *cert_blob, size_t cert_blob_len, 35 | const char *path); 36 | int tlsv1_set_cert(struct tlsv1_credentials *cred, const char *cert, 37 | const u8 *cert_blob, size_t cert_blob_len); 38 | int tlsv1_set_private_key(struct tlsv1_credentials *cred, 39 | const char *private_key, 40 | const char *private_key_passwd, 41 | const u8 *private_key_blob, 42 | size_t private_key_blob_len); 43 | int tlsv1_set_dhparams(struct tlsv1_credentials *cred, const char *dh_file, 44 | const u8 *dh_blob, size_t dh_blob_len); 45 | 46 | #endif /* TLSV1_CRED_H */ 47 | -------------------------------------------------------------------------------- /network/bully/src/tls/tlsv1_record.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TLSv1 Record Protocol 3 | * Copyright (c) 2006-2007, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef TLSV1_RECORD_H 16 | #define TLSV1_RECORD_H 17 | 18 | #include "crypto/crypto.h" 19 | 20 | #define TLS_MAX_WRITE_MAC_SECRET_LEN 20 21 | #define TLS_MAX_WRITE_KEY_LEN 32 22 | #define TLS_MAX_IV_LEN 16 23 | #define TLS_MAX_KEY_BLOCK_LEN (2 * (TLS_MAX_WRITE_MAC_SECRET_LEN + \ 24 | TLS_MAX_WRITE_KEY_LEN + TLS_MAX_IV_LEN)) 25 | 26 | #define TLS_SEQ_NUM_LEN 8 27 | #define TLS_RECORD_HEADER_LEN 5 28 | 29 | /* ContentType */ 30 | enum { 31 | TLS_CONTENT_TYPE_CHANGE_CIPHER_SPEC = 20, 32 | TLS_CONTENT_TYPE_ALERT = 21, 33 | TLS_CONTENT_TYPE_HANDSHAKE = 22, 34 | TLS_CONTENT_TYPE_APPLICATION_DATA = 23 35 | }; 36 | 37 | struct tlsv1_record_layer { 38 | u8 write_mac_secret[TLS_MAX_WRITE_MAC_SECRET_LEN]; 39 | u8 read_mac_secret[TLS_MAX_WRITE_MAC_SECRET_LEN]; 40 | u8 write_key[TLS_MAX_WRITE_KEY_LEN]; 41 | u8 read_key[TLS_MAX_WRITE_KEY_LEN]; 42 | u8 write_iv[TLS_MAX_IV_LEN]; 43 | u8 read_iv[TLS_MAX_IV_LEN]; 44 | 45 | size_t hash_size; 46 | size_t key_material_len; 47 | size_t iv_size; /* also block_size */ 48 | 49 | enum crypto_hash_alg hash_alg; 50 | enum crypto_cipher_alg cipher_alg; 51 | 52 | u8 write_seq_num[TLS_SEQ_NUM_LEN]; 53 | u8 read_seq_num[TLS_SEQ_NUM_LEN]; 54 | 55 | u16 cipher_suite; 56 | u16 write_cipher_suite; 57 | u16 read_cipher_suite; 58 | 59 | struct crypto_cipher *write_cbc; 60 | struct crypto_cipher *read_cbc; 61 | }; 62 | 63 | 64 | int tlsv1_record_set_cipher_suite(struct tlsv1_record_layer *rl, 65 | u16 cipher_suite); 66 | int tlsv1_record_change_write_cipher(struct tlsv1_record_layer *rl); 67 | int tlsv1_record_change_read_cipher(struct tlsv1_record_layer *rl); 68 | int tlsv1_record_send(struct tlsv1_record_layer *rl, u8 content_type, u8 *buf, 69 | size_t buf_size, size_t payload_len, size_t *out_len); 70 | int tlsv1_record_receive(struct tlsv1_record_layer *rl, 71 | const u8 *in_data, size_t in_len, 72 | u8 *out_data, size_t *out_len, u8 *alert); 73 | 74 | #endif /* TLSV1_RECORD_H */ 75 | -------------------------------------------------------------------------------- /network/bully/src/tls/tlsv1_server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TLSv1 server (RFC 2246) 3 | * Copyright (c) 2006-2007, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef TLSV1_SERVER_H 16 | #define TLSV1_SERVER_H 17 | 18 | #include "tlsv1_cred.h" 19 | 20 | struct tlsv1_server; 21 | 22 | int tlsv1_server_global_init(void); 23 | void tlsv1_server_global_deinit(void); 24 | struct tlsv1_server * tlsv1_server_init(struct tlsv1_credentials *cred); 25 | void tlsv1_server_deinit(struct tlsv1_server *conn); 26 | int tlsv1_server_established(struct tlsv1_server *conn); 27 | int tlsv1_server_prf(struct tlsv1_server *conn, const char *label, 28 | int server_random_first, u8 *out, size_t out_len); 29 | u8 * tlsv1_server_handshake(struct tlsv1_server *conn, 30 | const u8 *in_data, size_t in_len, size_t *out_len); 31 | int tlsv1_server_encrypt(struct tlsv1_server *conn, 32 | const u8 *in_data, size_t in_len, 33 | u8 *out_data, size_t out_len); 34 | int tlsv1_server_decrypt(struct tlsv1_server *conn, 35 | const u8 *in_data, size_t in_len, 36 | u8 *out_data, size_t out_len); 37 | int tlsv1_server_get_cipher(struct tlsv1_server *conn, char *buf, 38 | size_t buflen); 39 | int tlsv1_server_shutdown(struct tlsv1_server *conn); 40 | int tlsv1_server_resumed(struct tlsv1_server *conn); 41 | int tlsv1_server_get_keys(struct tlsv1_server *conn, struct tls_keys *keys); 42 | int tlsv1_server_get_keyblock_size(struct tlsv1_server *conn); 43 | int tlsv1_server_set_cipher_list(struct tlsv1_server *conn, u8 *ciphers); 44 | int tlsv1_server_set_verify(struct tlsv1_server *conn, int verify_peer); 45 | 46 | typedef int (*tlsv1_server_session_ticket_cb) 47 | (void *ctx, const u8 *ticket, size_t len, const u8 *client_random, 48 | const u8 *server_random, u8 *master_secret); 49 | 50 | void tlsv1_server_set_session_ticket_cb(struct tlsv1_server *conn, 51 | tlsv1_server_session_ticket_cb cb, 52 | void *ctx); 53 | 54 | #endif /* TLSV1_SERVER_H */ 55 | -------------------------------------------------------------------------------- /network/bully/src/tls/tlsv1_server_i.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TLSv1 server - internal structures 3 | * Copyright (c) 2006-2007, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef TLSV1_SERVER_I_H 16 | #define TLSV1_SERVER_I_H 17 | 18 | struct tlsv1_server { 19 | enum { 20 | CLIENT_HELLO, SERVER_HELLO, SERVER_CERTIFICATE, 21 | SERVER_KEY_EXCHANGE, SERVER_CERTIFICATE_REQUEST, 22 | SERVER_HELLO_DONE, CLIENT_CERTIFICATE, CLIENT_KEY_EXCHANGE, 23 | CERTIFICATE_VERIFY, CHANGE_CIPHER_SPEC, CLIENT_FINISHED, 24 | SERVER_CHANGE_CIPHER_SPEC, SERVER_FINISHED, 25 | ESTABLISHED, FAILED 26 | } state; 27 | 28 | struct tlsv1_record_layer rl; 29 | 30 | u8 session_id[TLS_SESSION_ID_MAX_LEN]; 31 | size_t session_id_len; 32 | u8 client_random[TLS_RANDOM_LEN]; 33 | u8 server_random[TLS_RANDOM_LEN]; 34 | u8 master_secret[TLS_MASTER_SECRET_LEN]; 35 | 36 | u8 alert_level; 37 | u8 alert_description; 38 | 39 | struct crypto_public_key *client_rsa_key; 40 | 41 | struct tls_verify_hash verify; 42 | 43 | #define MAX_CIPHER_COUNT 30 44 | u16 cipher_suites[MAX_CIPHER_COUNT]; 45 | size_t num_cipher_suites; 46 | 47 | u16 cipher_suite; 48 | 49 | struct tlsv1_credentials *cred; 50 | 51 | int verify_peer; 52 | u16 client_version; 53 | 54 | u8 *session_ticket; 55 | size_t session_ticket_len; 56 | 57 | tlsv1_server_session_ticket_cb session_ticket_cb; 58 | void *session_ticket_cb_ctx; 59 | 60 | int use_session_ticket; 61 | 62 | u8 *dh_secret; 63 | size_t dh_secret_len; 64 | }; 65 | 66 | 67 | void tlsv1_server_alert(struct tlsv1_server *conn, u8 level, u8 description); 68 | int tlsv1_server_derive_keys(struct tlsv1_server *conn, 69 | const u8 *pre_master_secret, 70 | size_t pre_master_secret_len); 71 | u8 * tlsv1_server_handshake_write(struct tlsv1_server *conn, size_t *out_len); 72 | u8 * tlsv1_server_send_alert(struct tlsv1_server *conn, u8 level, 73 | u8 description, size_t *out_len); 74 | int tlsv1_server_process_handshake(struct tlsv1_server *conn, u8 ct, 75 | const u8 *buf, size_t *len); 76 | 77 | #endif /* TLSV1_SERVER_I_H */ 78 | -------------------------------------------------------------------------------- /network/bully/src/utils/.gitignore: -------------------------------------------------------------------------------- 1 | libutils.a 2 | -------------------------------------------------------------------------------- /network/bully/src/utils/Makefile: -------------------------------------------------------------------------------- 1 | all: libutils.a 2 | 3 | clean: 4 | rm -f *~ *.o *.d libutils.a 5 | 6 | install: 7 | @echo Nothing to be made. 8 | 9 | 10 | include ../lib.rules 11 | 12 | #CFLAGS += -DWPA_TRACE 13 | CFLAGS += -DCONFIG_IPV6 14 | 15 | LIB_OBJS= \ 16 | base64.o \ 17 | common.o \ 18 | ip_addr.o \ 19 | radiotap.o \ 20 | trace.o \ 21 | uuid.o \ 22 | wpa_debug.o \ 23 | wpabuf.o 24 | 25 | # Pick correct OS wrapper implementation 26 | LIB_OBJS += os_unix.o 27 | 28 | # Pick correct event loop implementation 29 | LIB_OBJS += eloop.o 30 | 31 | #LIB_OBJS += pcsc_funcs.o 32 | 33 | libutils.a: $(LIB_OBJS) 34 | $(AR) crT $@ $? 35 | 36 | -include $(OBJS:%.o=%.d) 37 | -------------------------------------------------------------------------------- /network/bully/src/utils/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Base64 encoding/decoding (RFC1341) 3 | * Copyright (c) 2005, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef BASE64_H 16 | #define BASE64_h 17 | 18 | unsigned char * base64_encode(const unsigned char *src, size_t len, 19 | size_t *out_len); 20 | unsigned char * base64_decode(const unsigned char *src, size_t len, 21 | size_t *out_len); 22 | 23 | #endif /* BASE64_H */ 24 | -------------------------------------------------------------------------------- /network/bully/src/utils/build_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_supplicant/hostapd - Build time configuration defines 3 | * Copyright (c) 2005-2006, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | * 14 | * This header file can be used to define configuration defines that were 15 | * originally defined in Makefile. This is mainly meant for IDE use or for 16 | * systems that do not have suitable 'make' tool. In these cases, it may be 17 | * easier to have a single place for defining all the needed C pre-processor 18 | * defines. 19 | */ 20 | 21 | #ifndef BUILD_CONFIG_H 22 | #define BUILD_CONFIG_H 23 | 24 | /* Insert configuration defines, e.g., #define EAP_MD5, here, if needed. */ 25 | 26 | #ifdef CONFIG_WIN32_DEFAULTS 27 | #define CONFIG_NATIVE_WINDOWS 28 | #define CONFIG_ANSI_C_EXTRA 29 | #define CONFIG_WINPCAP 30 | #define IEEE8021X_EAPOL 31 | #define PKCS12_FUNCS 32 | #define PCSC_FUNCS 33 | #define CONFIG_CTRL_IFACE 34 | #define CONFIG_CTRL_IFACE_NAMED_PIPE 35 | #define CONFIG_DRIVER_NDIS 36 | #define CONFIG_NDIS_EVENTS_INTEGRATED 37 | #define CONFIG_DEBUG_FILE 38 | #define EAP_MD5 39 | #define EAP_TLS 40 | #define EAP_MSCHAPv2 41 | #define EAP_PEAP 42 | #define EAP_TTLS 43 | #define EAP_GTC 44 | #define EAP_OTP 45 | #define EAP_LEAP 46 | #define EAP_TNC 47 | #define _CRT_SECURE_NO_DEPRECATE 48 | 49 | #ifdef USE_INTERNAL_CRYPTO 50 | #define CONFIG_TLS_INTERNAL_CLIENT 51 | #define CONFIG_INTERNAL_LIBTOMMATH 52 | #define CONFIG_CRYPTO_INTERNAL 53 | #endif /* USE_INTERNAL_CRYPTO */ 54 | #endif /* CONFIG_WIN32_DEFAULTS */ 55 | 56 | #ifdef __SYMBIAN32__ 57 | #define OS_NO_C_LIB_DEFINES 58 | #define CONFIG_ANSI_C_EXTRA 59 | #define CONFIG_NO_WPA_MSG 60 | #define CONFIG_NO_HOSTAPD_LOGGER 61 | #define CONFIG_NO_STDOUT_DEBUG 62 | #define CONFIG_BACKEND_FILE 63 | #define CONFIG_INTERNAL_LIBTOMMATH 64 | #define CONFIG_CRYPTO_INTERNAL 65 | #define IEEE8021X_EAPOL 66 | #define PKCS12_FUNCS 67 | #define EAP_MD5 68 | #define EAP_TLS 69 | #define EAP_MSCHAPv2 70 | #define EAP_PEAP 71 | #define EAP_TTLS 72 | #define EAP_GTC 73 | #define EAP_OTP 74 | #define EAP_LEAP 75 | #define EAP_FAST 76 | #endif /* __SYMBIAN32__ */ 77 | 78 | #ifdef CONFIG_XCODE_DEFAULTS 79 | #define CONFIG_DRIVER_OSX 80 | #define CONFIG_BACKEND_FILE 81 | #define IEEE8021X_EAPOL 82 | #define PKCS12_FUNCS 83 | #define CONFIG_CTRL_IFACE 84 | #define CONFIG_CTRL_IFACE_UNIX 85 | #define CONFIG_DEBUG_FILE 86 | #define EAP_MD5 87 | #define EAP_TLS 88 | #define EAP_MSCHAPv2 89 | #define EAP_PEAP 90 | #define EAP_TTLS 91 | #define EAP_GTC 92 | #define EAP_OTP 93 | #define EAP_LEAP 94 | #define EAP_TNC 95 | #define CONFIG_WPS 96 | #define EAP_WSC 97 | 98 | #ifdef USE_INTERNAL_CRYPTO 99 | #define CONFIG_TLS_INTERNAL_CLIENT 100 | #define CONFIG_INTERNAL_LIBTOMMATH 101 | #define CONFIG_CRYPTO_INTERNAL 102 | #endif /* USE_INTERNAL_CRYPTO */ 103 | #endif /* CONFIG_XCODE_DEFAULTS */ 104 | 105 | #endif /* BUILD_CONFIG_H */ 106 | -------------------------------------------------------------------------------- /network/bully/src/utils/includes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_supplicant/hostapd - Default include files 3 | * Copyright (c) 2005-2006, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | * 14 | * This header file is included into all C files so that commonly used header 15 | * files can be selected with OS specific ifdef blocks in one place instead of 16 | * having to have OS/C library specific selection in many files. 17 | */ 18 | 19 | #ifndef INCLUDES_H 20 | #define INCLUDES_H 21 | 22 | /* Include possible build time configuration before including anything else */ 23 | #include "build_config.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #ifndef _WIN32_WCE 30 | #ifndef CONFIG_TI_COMPILER 31 | #include 32 | #include 33 | #endif /* CONFIG_TI_COMPILER */ 34 | #include 35 | #endif /* _WIN32_WCE */ 36 | #include 37 | #include 38 | 39 | #ifndef CONFIG_TI_COMPILER 40 | #ifndef _MSC_VER 41 | #include 42 | #endif /* _MSC_VER */ 43 | #endif /* CONFIG_TI_COMPILER */ 44 | 45 | #ifndef CONFIG_NATIVE_WINDOWS 46 | #ifndef CONFIG_TI_COMPILER 47 | #include 48 | #include 49 | #include 50 | #ifndef __vxworks 51 | #ifndef __SYMBIAN32__ 52 | #include 53 | #endif /* __SYMBIAN32__ */ 54 | #include 55 | #endif /* __vxworks */ 56 | #endif /* CONFIG_TI_COMPILER */ 57 | #endif /* CONFIG_NATIVE_WINDOWS */ 58 | 59 | #endif /* INCLUDES_H */ 60 | -------------------------------------------------------------------------------- /network/bully/src/utils/ip_addr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IP address processing 3 | * Copyright (c) 2003-2006, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | 17 | #include "common.h" 18 | #include "ip_addr.h" 19 | 20 | const char * hostapd_ip_txt(const struct hostapd_ip_addr *addr, char *buf, 21 | size_t buflen) 22 | { 23 | if (buflen == 0 || addr == NULL) 24 | return NULL; 25 | 26 | if (addr->af == AF_INET) { 27 | os_strlcpy(buf, inet_ntoa(addr->u.v4), buflen); 28 | } else { 29 | buf[0] = '\0'; 30 | } 31 | #ifdef CONFIG_IPV6 32 | if (addr->af == AF_INET6) { 33 | if (inet_ntop(AF_INET6, &addr->u.v6, buf, buflen) == NULL) 34 | buf[0] = '\0'; 35 | } 36 | #endif /* CONFIG_IPV6 */ 37 | 38 | return buf; 39 | } 40 | 41 | 42 | int hostapd_ip_diff(struct hostapd_ip_addr *a, struct hostapd_ip_addr *b) 43 | { 44 | if (a == NULL && b == NULL) 45 | return 0; 46 | if (a == NULL || b == NULL) 47 | return 1; 48 | 49 | switch (a->af) { 50 | case AF_INET: 51 | if (a->u.v4.s_addr != b->u.v4.s_addr) 52 | return 1; 53 | break; 54 | #ifdef CONFIG_IPV6 55 | case AF_INET6: 56 | if (os_memcmp(&a->u.v6, &b->u.v6, sizeof(a->u.v6)) != 0) 57 | return 1; 58 | break; 59 | #endif /* CONFIG_IPV6 */ 60 | } 61 | 62 | return 0; 63 | } 64 | 65 | 66 | int hostapd_parse_ip_addr(const char *txt, struct hostapd_ip_addr *addr) 67 | { 68 | #ifndef CONFIG_NATIVE_WINDOWS 69 | if (inet_aton(txt, &addr->u.v4)) { 70 | addr->af = AF_INET; 71 | return 0; 72 | } 73 | 74 | #ifdef CONFIG_IPV6 75 | if (inet_pton(AF_INET6, txt, &addr->u.v6) > 0) { 76 | addr->af = AF_INET6; 77 | return 0; 78 | } 79 | #endif /* CONFIG_IPV6 */ 80 | #endif /* CONFIG_NATIVE_WINDOWS */ 81 | 82 | return -1; 83 | } 84 | -------------------------------------------------------------------------------- /network/bully/src/utils/ip_addr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IP address processing 3 | * Copyright (c) 2003-2006, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef IP_ADDR_H 16 | #define IP_ADDR_H 17 | 18 | struct hostapd_ip_addr { 19 | int af; /* AF_INET / AF_INET6 */ 20 | union { 21 | struct in_addr v4; 22 | #ifdef CONFIG_IPV6 23 | struct in6_addr v6; 24 | #endif /* CONFIG_IPV6 */ 25 | u8 max_len[16]; 26 | } u; 27 | }; 28 | 29 | const char * hostapd_ip_txt(const struct hostapd_ip_addr *addr, char *buf, 30 | size_t buflen); 31 | int hostapd_ip_diff(struct hostapd_ip_addr *a, struct hostapd_ip_addr *b); 32 | int hostapd_parse_ip_addr(const char *txt, struct hostapd_ip_addr *addr); 33 | 34 | #endif /* IP_ADDR_H */ 35 | -------------------------------------------------------------------------------- /network/bully/src/utils/list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Doubly-linked list 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef LIST_H 16 | #define LIST_H 17 | 18 | /** 19 | * struct dl_list - Doubly-linked list 20 | */ 21 | struct dl_list { 22 | struct dl_list *next; 23 | struct dl_list *prev; 24 | }; 25 | 26 | static inline void dl_list_init(struct dl_list *list) 27 | { 28 | list->next = list; 29 | list->prev = list; 30 | } 31 | 32 | static inline void dl_list_add(struct dl_list *list, struct dl_list *item) 33 | { 34 | item->next = list->next; 35 | item->prev = list; 36 | list->next->prev = item; 37 | list->next = item; 38 | } 39 | 40 | static inline void dl_list_add_tail(struct dl_list *list, struct dl_list *item) 41 | { 42 | dl_list_add(list->prev, item); 43 | } 44 | 45 | static inline void dl_list_del(struct dl_list *item) 46 | { 47 | item->next->prev = item->prev; 48 | item->prev->next = item->next; 49 | item->next = NULL; 50 | item->prev = NULL; 51 | } 52 | 53 | static inline int dl_list_empty(struct dl_list *list) 54 | { 55 | return list->next == list; 56 | } 57 | 58 | static inline unsigned int dl_list_len(struct dl_list *list) 59 | { 60 | struct dl_list *item; 61 | int count = 0; 62 | for (item = list->next; item != list; item = item->next) 63 | count++; 64 | return count; 65 | } 66 | 67 | #ifndef offsetof 68 | #define offsetof(type, member) ((long) &((type *) 0)->member) 69 | #endif 70 | 71 | #define dl_list_entry(item, type, member) \ 72 | ((type *) ((char *) item - offsetof(type, member))) 73 | 74 | #define dl_list_first(list, type, member) \ 75 | (dl_list_empty((list)) ? NULL : \ 76 | dl_list_entry((list)->next, type, member)) 77 | 78 | #define dl_list_for_each(item, list, type, member) \ 79 | for (item = dl_list_entry((list)->next, type, member); \ 80 | &item->member != (list); \ 81 | item = dl_list_entry(item->member.next, type, member)) 82 | 83 | #define dl_list_for_each_safe(item, n, list, type, member) \ 84 | for (item = dl_list_entry((list)->next, type, member), \ 85 | n = dl_list_entry(item->member.next, type, member); \ 86 | &item->member != (list); \ 87 | item = n, n = dl_list_entry(n->member.next, type, member)) 88 | 89 | #endif /* LIST_H */ 90 | -------------------------------------------------------------------------------- /network/bully/src/utils/pcsc_funcs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * WPA Supplicant / PC/SC smartcard interface for USIM, GSM SIM 3 | * Copyright (c) 2004-2006, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef PCSC_FUNCS_H 16 | #define PCSC_FUNCS_H 17 | 18 | /* GSM files 19 | * File type in first octet: 20 | * 3F = Master File 21 | * 7F = Dedicated File 22 | * 2F = Elementary File under the Master File 23 | * 6F = Elementary File under a Dedicated File 24 | */ 25 | #define SCARD_FILE_MF 0x3F00 26 | #define SCARD_FILE_GSM_DF 0x7F20 27 | #define SCARD_FILE_UMTS_DF 0x7F50 28 | #define SCARD_FILE_GSM_EF_IMSI 0x6F07 29 | #define SCARD_FILE_EF_DIR 0x2F00 30 | #define SCARD_FILE_EF_ICCID 0x2FE2 31 | #define SCARD_FILE_EF_CK 0x6FE1 32 | #define SCARD_FILE_EF_IK 0x6FE2 33 | 34 | #define SCARD_CHV1_OFFSET 13 35 | #define SCARD_CHV1_FLAG 0x80 36 | 37 | typedef enum { 38 | SCARD_GSM_SIM_ONLY, 39 | SCARD_USIM_ONLY, 40 | SCARD_TRY_BOTH 41 | } scard_sim_type; 42 | 43 | 44 | #ifdef PCSC_FUNCS 45 | struct scard_data * scard_init(scard_sim_type sim_type); 46 | void scard_deinit(struct scard_data *scard); 47 | 48 | int scard_set_pin(struct scard_data *scard, const char *pin); 49 | int scard_get_imsi(struct scard_data *scard, char *imsi, size_t *len); 50 | int scard_gsm_auth(struct scard_data *scard, const unsigned char *_rand, 51 | unsigned char *sres, unsigned char *kc); 52 | int scard_umts_auth(struct scard_data *scard, const unsigned char *_rand, 53 | const unsigned char *autn, 54 | unsigned char *res, size_t *res_len, 55 | unsigned char *ik, unsigned char *ck, unsigned char *auts); 56 | 57 | #else /* PCSC_FUNCS */ 58 | 59 | #define scard_init(s) NULL 60 | #define scard_deinit(s) do { } while (0) 61 | #define scard_set_pin(s, p) -1 62 | #define scard_get_imsi(s, i, l) -1 63 | #define scard_gsm_auth(s, r, s2, k) -1 64 | #define scard_umts_auth(s, r, a, r2, rl, i, c, a2) -1 65 | 66 | #endif /* PCSC_FUNCS */ 67 | 68 | #endif /* PCSC_FUNCS_H */ 69 | -------------------------------------------------------------------------------- /network/bully/src/utils/radiotap_iter.h: -------------------------------------------------------------------------------- 1 | #ifndef __RADIOTAP_ITER_H 2 | #define __RADIOTAP_ITER_H 3 | 4 | #include "radiotap.h" 5 | 6 | /* Radiotap header iteration 7 | * implemented in radiotap.c 8 | */ 9 | /** 10 | * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 11 | * @rtheader: pointer to the radiotap header we are walking through 12 | * @max_length: length of radiotap header in cpu byte ordering 13 | * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 14 | * @this_arg: pointer to current radiotap arg 15 | * @arg_index: internal next argument index 16 | * @arg: internal next argument pointer 17 | * @next_bitmap: internal pointer to next present u32 18 | * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 19 | */ 20 | 21 | struct ieee80211_radiotap_iterator { 22 | struct ieee80211_radiotap_header *rtheader; 23 | int max_length; 24 | int this_arg_index; 25 | unsigned char *this_arg; 26 | 27 | int arg_index; 28 | unsigned char *arg; 29 | uint32_t *next_bitmap; 30 | uint32_t bitmap_shifter; 31 | }; 32 | 33 | extern int ieee80211_radiotap_iterator_init( 34 | struct ieee80211_radiotap_iterator *iterator, 35 | struct ieee80211_radiotap_header *radiotap_header, 36 | int max_length); 37 | 38 | extern int ieee80211_radiotap_iterator_next( 39 | struct ieee80211_radiotap_iterator *iterator); 40 | 41 | #endif /* __RADIOTAP_ITER_H */ 42 | -------------------------------------------------------------------------------- /network/bully/src/utils/trace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Backtrace debugging 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef TRACE_H 16 | #define TRACE_H 17 | 18 | #define WPA_TRACE_LEN 16 19 | 20 | #ifdef WPA_TRACE 21 | #include 22 | 23 | #include "list.h" 24 | 25 | #define WPA_TRACE_INFO void *btrace[WPA_TRACE_LEN]; int btrace_num; 26 | 27 | struct wpa_trace_ref { 28 | struct dl_list list; 29 | const void *addr; 30 | WPA_TRACE_INFO 31 | }; 32 | #define WPA_TRACE_REF(name) struct wpa_trace_ref wpa_trace_ref_##name 33 | 34 | #define wpa_trace_dump(title, ptr) \ 35 | wpa_trace_dump_func((title), (ptr)->btrace, (ptr)->btrace_num) 36 | void wpa_trace_dump_func(const char *title, void **btrace, int btrace_num); 37 | #define wpa_trace_record(ptr) \ 38 | (ptr)->btrace_num = backtrace((ptr)->btrace, WPA_TRACE_LEN) 39 | void wpa_trace_show(const char *title); 40 | #define wpa_trace_add_ref(ptr, name, addr) \ 41 | wpa_trace_add_ref_func(&(ptr)->wpa_trace_ref_##name, (addr)) 42 | void wpa_trace_add_ref_func(struct wpa_trace_ref *ref, const void *addr); 43 | #define wpa_trace_remove_ref(ptr, name, addr) \ 44 | do { \ 45 | if ((addr)) \ 46 | dl_list_del(&(ptr)->wpa_trace_ref_##name.list); \ 47 | } while (0) 48 | void wpa_trace_check_ref(const void *addr); 49 | 50 | #else /* WPA_TRACE */ 51 | 52 | #define WPA_TRACE_INFO 53 | #define WPA_TRACE_REF(n) 54 | #define wpa_trace_dump(title, ptr) do { } while (0) 55 | #define wpa_trace_record(ptr) do { } while (0) 56 | #define wpa_trace_show(title) do { } while (0) 57 | #define wpa_trace_add_ref(ptr, name, addr) do { } while (0) 58 | #define wpa_trace_remove_ref(ptr, name, addr) do { } while (0) 59 | #define wpa_trace_check_ref(addr) do { } while (0) 60 | 61 | #endif /* WPA_TRACE */ 62 | 63 | 64 | #ifdef WPA_TRACE_BFD 65 | 66 | void wpa_trace_dump_funcname(const char *title, void *pc); 67 | 68 | #else /* WPA_TRACE_BFD */ 69 | 70 | #define wpa_trace_dump_funcname(title, pc) do { } while (0) 71 | 72 | #endif /* WPA_TRACE_BFD */ 73 | 74 | #endif /* TRACE_H */ 75 | -------------------------------------------------------------------------------- /network/bully/src/utils/uuid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Universally Unique IDentifier (UUID) 3 | * Copyright (c) 2008, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | 17 | #include "common.h" 18 | #include "uuid.h" 19 | 20 | int uuid_str2bin(const char *str, u8 *bin) 21 | { 22 | const char *pos; 23 | u8 *opos; 24 | 25 | pos = str; 26 | opos = bin; 27 | 28 | if (hexstr2bin(pos, opos, 4)) 29 | return -1; 30 | pos += 8; 31 | opos += 4; 32 | 33 | if (*pos++ != '-' || hexstr2bin(pos, opos, 2)) 34 | return -1; 35 | pos += 4; 36 | opos += 2; 37 | 38 | if (*pos++ != '-' || hexstr2bin(pos, opos, 2)) 39 | return -1; 40 | pos += 4; 41 | opos += 2; 42 | 43 | if (*pos++ != '-' || hexstr2bin(pos, opos, 2)) 44 | return -1; 45 | pos += 4; 46 | opos += 2; 47 | 48 | if (*pos++ != '-' || hexstr2bin(pos, opos, 6)) 49 | return -1; 50 | 51 | return 0; 52 | } 53 | 54 | 55 | int uuid_bin2str(const u8 *bin, char *str, size_t max_len) 56 | { 57 | int len; 58 | len = os_snprintf(str, max_len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-" 59 | "%02x%02x-%02x%02x%02x%02x%02x%02x", 60 | bin[0], bin[1], bin[2], bin[3], 61 | bin[4], bin[5], bin[6], bin[7], 62 | bin[8], bin[9], bin[10], bin[11], 63 | bin[12], bin[13], bin[14], bin[15]); 64 | if (len < 0 || (size_t) len >= max_len) 65 | return -1; 66 | return 0; 67 | } 68 | 69 | 70 | int is_nil_uuid(const u8 *uuid) 71 | { 72 | int i; 73 | for (i = 0; i < UUID_LEN; i++) 74 | if (uuid[i]) 75 | return 0; 76 | return 1; 77 | } 78 | -------------------------------------------------------------------------------- /network/bully/src/utils/uuid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Universally Unique IDentifier (UUID) 3 | * Copyright (c) 2008, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef UUID_H 16 | #define UUID_H 17 | 18 | #define UUID_LEN 16 19 | 20 | int uuid_str2bin(const char *str, u8 *bin); 21 | int uuid_bin2str(const u8 *bin, char *str, size_t max_len); 22 | int is_nil_uuid(const u8 *uuid); 23 | 24 | #endif /* UUID_H */ 25 | -------------------------------------------------------------------------------- /network/bully/src/version.h: -------------------------------------------------------------------------------- 1 | #define VERSION "v1.0-22" 2 | -------------------------------------------------------------------------------- /network/bully/src/wps/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /network/bully/src/wps/http.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HTTP for WPS 3 | * Copyright (c) 2000-2003 Intel Corporation 4 | * Copyright (c) 2006-2007 Sony Corporation 5 | * Copyright (c) 2008-2009 Atheros Communications 6 | * Copyright (c) 2009, Jouni Malinen 7 | * 8 | * See wps_upnp.c for more details on licensing and code history. 9 | */ 10 | 11 | #ifndef HTTP_H 12 | #define HTTP_H 13 | 14 | enum http_reply_code { 15 | HTTP_OK = 200, 16 | HTTP_BAD_REQUEST = 400, 17 | UPNP_INVALID_ACTION = 401, 18 | UPNP_INVALID_ARGS = 402, 19 | HTTP_NOT_FOUND = 404, 20 | HTTP_PRECONDITION_FAILED = 412, 21 | HTTP_INTERNAL_SERVER_ERROR = 500, 22 | HTTP_UNIMPLEMENTED = 501, 23 | UPNP_ACTION_FAILED = 501, 24 | UPNP_ARG_VALUE_INVALID = 600, 25 | UPNP_ARG_VALUE_OUT_OF_RANGE = 601, 26 | UPNP_OUT_OF_MEMORY = 603 27 | }; 28 | 29 | #endif /* HTTP_H */ 30 | -------------------------------------------------------------------------------- /network/bully/src/wps/http_client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * http_client - HTTP client 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef HTTP_CLIENT_H 16 | #define HTTP_CLIENT_H 17 | 18 | struct http_client; 19 | 20 | enum http_client_event { 21 | HTTP_CLIENT_FAILED, 22 | HTTP_CLIENT_TIMEOUT, 23 | HTTP_CLIENT_OK, 24 | HTTP_CLIENT_INVALID_REPLY, 25 | }; 26 | 27 | char * http_client_url_parse(const char *url, struct sockaddr_in *dst, 28 | char **path); 29 | struct http_client * http_client_addr(struct sockaddr_in *dst, 30 | struct wpabuf *req, size_t max_response, 31 | void (*cb)(void *ctx, 32 | struct http_client *c, 33 | enum http_client_event event), 34 | void *cb_ctx); 35 | struct http_client * http_client_url(const char *url, 36 | struct wpabuf *req, size_t max_response, 37 | void (*cb)(void *ctx, 38 | struct http_client *c, 39 | enum http_client_event event), 40 | void *cb_ctx); 41 | void http_client_free(struct http_client *c); 42 | struct wpabuf * http_client_get_body(struct http_client *c); 43 | char * http_client_get_hdr_line(struct http_client *c, const char *tag); 44 | char * http_link_update(char *url, const char *base); 45 | 46 | #endif /* HTTP_CLIENT_H */ 47 | -------------------------------------------------------------------------------- /network/bully/src/wps/http_server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * http_server - HTTP server 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef HTTP_SERVER_H 16 | #define HTTP_SERVER_H 17 | 18 | struct http_server; 19 | struct http_request; 20 | 21 | void http_request_deinit(struct http_request *req); 22 | void http_request_send(struct http_request *req, struct wpabuf *resp); 23 | void http_request_send_and_deinit(struct http_request *req, 24 | struct wpabuf *resp); 25 | enum httpread_hdr_type http_request_get_type(struct http_request *req); 26 | char * http_request_get_uri(struct http_request *req); 27 | char * http_request_get_hdr(struct http_request *req); 28 | char * http_request_get_data(struct http_request *req); 29 | char * http_request_get_hdr_line(struct http_request *req, const char *tag); 30 | struct sockaddr_in * http_request_get_cli_addr(struct http_request *req); 31 | 32 | struct http_server * http_server_init(struct in_addr *addr, int port, 33 | void (*cb)(void *ctx, 34 | struct http_request *req), 35 | void *cb_ctx); 36 | void http_server_deinit(struct http_server *srv); 37 | int http_server_get_port(struct http_server *srv); 38 | 39 | #endif /* HTTP_SERVER_H */ 40 | -------------------------------------------------------------------------------- /network/bully/src/wps/upnp_xml.h: -------------------------------------------------------------------------------- 1 | /* 2 | * UPnP XML helper routines 3 | * Copyright (c) 2000-2003 Intel Corporation 4 | * Copyright (c) 2006-2007 Sony Corporation 5 | * Copyright (c) 2008-2009 Atheros Communications 6 | * Copyright (c) 2009, Jouni Malinen 7 | * 8 | * See wps_upnp.c for more details on licensing and code history. 9 | */ 10 | 11 | #ifndef UPNP_XML_H 12 | #define UPNP_XML_H 13 | 14 | #include "http.h" 15 | 16 | void xml_data_encode(struct wpabuf *buf, const char *data, int len); 17 | void xml_add_tagged_data(struct wpabuf *buf, const char *tag, 18 | const char *data); 19 | char * xml_get_first_item(const char *doc, const char *item); 20 | struct wpabuf * xml_get_base64_item(const char *data, const char *name, 21 | enum http_reply_code *ret); 22 | 23 | #endif /* UPNP_XML_H */ 24 | -------------------------------------------------------------------------------- /network/bully/src/wps/wps_dev_attr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Wi-Fi Protected Setup - device attributes 3 | * Copyright (c) 2008, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef WPS_DEV_ATTR_H 16 | #define WPS_DEV_ATTR_H 17 | 18 | struct wps_parse_attr; 19 | 20 | int wps_build_device_attrs(struct wps_device_data *dev, struct wpabuf *msg); 21 | int wps_build_os_version(struct wps_device_data *dev, struct wpabuf *msg); 22 | int wps_build_rf_bands(struct wps_device_data *dev, struct wpabuf *msg); 23 | int wps_build_primary_dev_type(struct wps_device_data *dev, 24 | struct wpabuf *msg); 25 | int wps_process_device_attrs(struct wps_device_data *dev, 26 | struct wps_parse_attr *attr); 27 | int wps_process_os_version(struct wps_device_data *dev, const u8 *ver); 28 | int wps_process_rf_bands(struct wps_device_data *dev, const u8 *bands); 29 | void wps_device_data_dup(struct wps_device_data *dst, 30 | const struct wps_device_data *src); 31 | void wps_device_data_free(struct wps_device_data *dev); 32 | 33 | #endif /* WPS_DEV_ATTR_H */ 34 | -------------------------------------------------------------------------------- /network/bully/src/wps/wps_er.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Wi-Fi Protected Setup - External Registrar 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #ifndef WPS_ER_H 16 | #define WPS_ER_H 17 | 18 | #include "utils/list.h" 19 | 20 | struct wps_er_sta { 21 | struct dl_list list; 22 | struct wps_er_ap *ap; 23 | u8 addr[ETH_ALEN]; 24 | u16 config_methods; 25 | u8 uuid[WPS_UUID_LEN]; 26 | u8 pri_dev_type[8]; 27 | u16 dev_passwd_id; 28 | int m1_received; 29 | char *manufacturer; 30 | char *model_name; 31 | char *model_number; 32 | char *serial_number; 33 | char *dev_name; 34 | struct wps_data *wps; 35 | struct http_client *http; 36 | struct wps_credential *cred; 37 | }; 38 | 39 | struct wps_er_ap { 40 | struct dl_list list; 41 | struct wps_er *er; 42 | struct dl_list sta; /* list of STAs/Enrollees using this AP */ 43 | struct in_addr addr; 44 | char *location; 45 | struct http_client *http; 46 | struct wps_data *wps; 47 | 48 | u8 uuid[WPS_UUID_LEN]; 49 | u8 pri_dev_type[8]; 50 | u8 wps_state; 51 | u8 mac_addr[ETH_ALEN]; 52 | char *friendly_name; 53 | char *manufacturer; 54 | char *manufacturer_url; 55 | char *model_description; 56 | char *model_name; 57 | char *model_number; 58 | char *model_url; 59 | char *serial_number; 60 | char *udn; 61 | char *upc; 62 | 63 | char *scpd_url; 64 | char *control_url; 65 | char *event_sub_url; 66 | 67 | int subscribed; 68 | u8 sid[WPS_UUID_LEN]; 69 | unsigned int id; 70 | 71 | struct wps_credential *ap_settings; 72 | 73 | void (*m1_handler)(struct wps_er_ap *ap, struct wpabuf *m1); 74 | }; 75 | 76 | struct wps_er { 77 | struct wps_context *wps; 78 | char ifname[17]; 79 | u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */ 80 | char *ip_addr_text; /* IP address of network i.f. we use */ 81 | unsigned ip_addr; /* IP address of network i.f. we use (host order) */ 82 | int multicast_sd; 83 | int ssdp_sd; 84 | struct dl_list ap; 85 | struct dl_list ap_unsubscribing; 86 | struct http_server *http_srv; 87 | int http_port; 88 | unsigned int next_ap_id; 89 | unsigned int event_id; 90 | int deinitializing; 91 | void (*deinit_done_cb)(void *ctx); 92 | void *deinit_done_ctx; 93 | }; 94 | 95 | 96 | /* wps_er.c */ 97 | void wps_er_ap_add(struct wps_er *er, const u8 *uuid, struct in_addr *addr, 98 | const char *location, int max_age); 99 | void wps_er_ap_remove(struct wps_er *er, struct in_addr *addr); 100 | 101 | /* wps_er_ssdp.c */ 102 | int wps_er_ssdp_init(struct wps_er *er); 103 | void wps_er_ssdp_deinit(struct wps_er *er); 104 | void wps_er_send_ssdp_msearch(struct wps_er *er); 105 | 106 | #endif /* WPS_ER_H */ 107 | -------------------------------------------------------------------------------- /network/bully/src/wps/wps_nfc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NFC routines for Wi-Fi Protected Setup 3 | * Copyright (c) 2009, Masashi Honma 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | #include "common.h" 17 | 18 | #include "wps/wps.h" 19 | #include "wps_i.h" 20 | 21 | 22 | struct wps_nfc_data { 23 | struct oob_nfc_device_data *oob_nfc_dev; 24 | }; 25 | 26 | 27 | static void * init_nfc(struct wps_context *wps, 28 | struct oob_device_data *oob_dev, int registrar) 29 | { 30 | struct oob_nfc_device_data *oob_nfc_dev; 31 | struct wps_nfc_data *data; 32 | 33 | oob_nfc_dev = wps_get_oob_nfc_device(oob_dev->device_name); 34 | if (oob_nfc_dev == NULL) { 35 | wpa_printf(MSG_ERROR, "WPS (NFC): Unknown NFC device (%s)", 36 | oob_dev->device_name); 37 | return NULL; 38 | } 39 | 40 | if (oob_nfc_dev->init_func(oob_dev->device_path) < 0) 41 | return NULL; 42 | 43 | data = os_zalloc(sizeof(*data)); 44 | if (data == NULL) { 45 | wpa_printf(MSG_ERROR, "WPS (NFC): Failed to allocate " 46 | "nfc data area"); 47 | return NULL; 48 | } 49 | data->oob_nfc_dev = oob_nfc_dev; 50 | return data; 51 | } 52 | 53 | 54 | static struct wpabuf * read_nfc(void *priv) 55 | { 56 | struct wps_nfc_data *data = priv; 57 | struct wpabuf *wifi, *buf; 58 | char *raw_data; 59 | size_t len; 60 | 61 | raw_data = data->oob_nfc_dev->read_func(&len); 62 | if (raw_data == NULL) 63 | return NULL; 64 | 65 | wifi = wpabuf_alloc_copy(raw_data, len); 66 | os_free(raw_data); 67 | if (wifi == NULL) { 68 | wpa_printf(MSG_ERROR, "WPS (NFC): Failed to allocate " 69 | "nfc read area"); 70 | return NULL; 71 | } 72 | 73 | buf = ndef_parse_wifi(wifi); 74 | wpabuf_free(wifi); 75 | if (buf == NULL) 76 | wpa_printf(MSG_ERROR, "WPS (NFC): Failed to unwrap"); 77 | return buf; 78 | } 79 | 80 | 81 | static int write_nfc(void *priv, struct wpabuf *buf) 82 | { 83 | struct wps_nfc_data *data = priv; 84 | struct wpabuf *wifi; 85 | int ret; 86 | 87 | wifi = ndef_build_wifi(buf); 88 | if (wifi == NULL) { 89 | wpa_printf(MSG_ERROR, "WPS (NFC): Failed to wrap"); 90 | return -1; 91 | } 92 | 93 | ret = data->oob_nfc_dev->write_func(wpabuf_mhead(wifi), 94 | wpabuf_len(wifi)); 95 | wpabuf_free(wifi); 96 | return ret; 97 | } 98 | 99 | 100 | static void deinit_nfc(void *priv) 101 | { 102 | struct wps_nfc_data *data = priv; 103 | 104 | data->oob_nfc_dev->deinit_func(); 105 | 106 | os_free(data); 107 | } 108 | 109 | 110 | struct oob_device_data oob_nfc_device_data = { 111 | .device_name = NULL, 112 | .device_path = NULL, 113 | .init_func = init_nfc, 114 | .read_func = read_nfc, 115 | .write_func = write_nfc, 116 | .deinit_func = deinit_nfc, 117 | }; 118 | -------------------------------------------------------------------------------- /network/bully/src/wps/wps_nfc_pn531.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NFC PN531 routines for Wi-Fi Protected Setup 3 | * Copyright (c) 2009, Masashi Honma 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | #include "common.h" 17 | 18 | #include "wps/wps.h" 19 | #include "wps_i.h" 20 | 21 | #include "WpsNfcType.h" 22 | #include "WpsNfc.h" 23 | 24 | 25 | static int init_nfc_pn531(char *path) 26 | { 27 | u32 ret; 28 | 29 | ret = WpsNfcInit(); 30 | if (ret != WPS_NFCLIB_ERR_SUCCESS) { 31 | wpa_printf(MSG_ERROR, "WPS (PN531): Failed to initialize " 32 | "NFC Library: 0x%08x", ret); 33 | return -1; 34 | } 35 | 36 | ret = WpsNfcOpenDevice((int8 *) path); 37 | if (ret != WPS_NFCLIB_ERR_SUCCESS) { 38 | wpa_printf(MSG_ERROR, "WPS (PN531): Failed to open " 39 | "NFC Device(%s): 0x%08x", path, ret); 40 | goto fail; 41 | } 42 | 43 | ret = WpsNfcTokenDiscovery(); 44 | if (ret != WPS_NFCLIB_ERR_SUCCESS) { 45 | wpa_printf(MSG_ERROR, "WPS (PN531): Failed to discover " 46 | "token: 0x%08x", ret); 47 | WpsNfcCloseDevice(); 48 | goto fail; 49 | } 50 | 51 | return 0; 52 | 53 | fail: 54 | WpsNfcDeinit(); 55 | return -1; 56 | } 57 | 58 | 59 | static void * read_nfc_pn531(size_t *size) 60 | { 61 | uint32 len; 62 | u32 ret; 63 | int8 *data; 64 | 65 | ret = WpsNfcRawReadToken(&data, &len); 66 | if (ret != WPS_NFCLIB_ERR_SUCCESS) { 67 | wpa_printf(MSG_ERROR, "WPS (PN531): Failed to read: 0x%08x", 68 | ret); 69 | return NULL; 70 | } 71 | 72 | *size = len; 73 | return data; 74 | } 75 | 76 | 77 | static int write_nfc_pn531(void *data, size_t len) 78 | { 79 | u32 ret; 80 | 81 | ret = WpsNfcRawWriteToken(data, len); 82 | if (ret != WPS_NFCLIB_ERR_SUCCESS) { 83 | wpa_printf(MSG_ERROR, "WPS (PN531): Failed to write: 0x%08x", 84 | ret); 85 | return -1; 86 | } 87 | 88 | return 0; 89 | } 90 | 91 | 92 | static void deinit_nfc_pn531(void) 93 | { 94 | u32 ret; 95 | 96 | ret = WpsNfcCloseDevice(); 97 | if (ret != WPS_NFCLIB_ERR_SUCCESS) 98 | wpa_printf(MSG_ERROR, "WPS (PN531): Failed to close " 99 | "NFC Device: 0x%08x", ret); 100 | 101 | ret = WpsNfcDeinit(); 102 | if (ret != WPS_NFCLIB_ERR_SUCCESS) 103 | wpa_printf(MSG_ERROR, "WPS (PN531): Failed to deinitialize " 104 | "NFC Library: 0x%08x", ret); 105 | } 106 | 107 | 108 | struct oob_nfc_device_data oob_nfc_pn531_device_data = { 109 | .init_func = init_nfc_pn531, 110 | .read_func = read_nfc_pn531, 111 | .write_func = write_nfc_pn531, 112 | .deinit_func = deinit_nfc_pn531, 113 | }; 114 | -------------------------------------------------------------------------------- /network/bully/src/wps/wps_upnp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * UPnP WPS Device 3 | * Copyright (c) 2000-2003 Intel Corporation 4 | * Copyright (c) 2006-2007 Sony Corporation 5 | * Copyright (c) 2008-2009 Atheros Communications 6 | * Copyright (c) 2009, Jouni Malinen 7 | * 8 | * See wps_upnp.c for more details on licensing and code history. 9 | */ 10 | 11 | #ifndef WPS_UPNP_H 12 | #define WPS_UPNP_H 13 | 14 | struct upnp_wps_device_sm; 15 | struct wps_context; 16 | struct wps_data; 17 | 18 | struct upnp_wps_peer { 19 | struct wps_data *wps; 20 | }; 21 | 22 | enum upnp_wps_wlanevent_type { 23 | UPNP_WPS_WLANEVENT_TYPE_PROBE = 1, 24 | UPNP_WPS_WLANEVENT_TYPE_EAP = 2 25 | }; 26 | 27 | struct upnp_wps_device_ctx { 28 | int (*rx_req_put_wlan_response)( 29 | void *priv, enum upnp_wps_wlanevent_type ev_type, 30 | const u8 *mac_addr, const struct wpabuf *msg, 31 | enum wps_msg_type msg_type); 32 | 33 | char *ap_pin; 34 | }; 35 | 36 | struct upnp_wps_device_sm * 37 | upnp_wps_device_init(struct upnp_wps_device_ctx *ctx, struct wps_context *wps, 38 | void *priv); 39 | void upnp_wps_device_deinit(struct upnp_wps_device_sm *sm); 40 | 41 | int upnp_wps_device_start(struct upnp_wps_device_sm *sm, char *net_if); 42 | void upnp_wps_device_stop(struct upnp_wps_device_sm *sm); 43 | 44 | int upnp_wps_device_send_wlan_event(struct upnp_wps_device_sm *sm, 45 | const u8 from_mac_addr[ETH_ALEN], 46 | enum upnp_wps_wlanevent_type ev_type, 47 | const struct wpabuf *msg); 48 | int upnp_wps_subscribers(struct upnp_wps_device_sm *sm); 49 | int upnp_wps_set_ap_pin(struct upnp_wps_device_sm *sm, const char *ap_pin); 50 | 51 | #endif /* WPS_UPNP_H */ 52 | -------------------------------------------------------------------------------- /network/bully/src/wps/wps_upnp_ap.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Wi-Fi Protected Setup - UPnP AP functionality 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | * 9 | * Alternatively, this software may be distributed under the terms of BSD 10 | * license. 11 | * 12 | * See README and COPYING for more details. 13 | */ 14 | 15 | #include "includes.h" 16 | 17 | #include "common.h" 18 | #include "eloop.h" 19 | #include "uuid.h" 20 | #include "wps_i.h" 21 | #include "wps_upnp.h" 22 | #include "wps_upnp_i.h" 23 | 24 | 25 | static void upnp_er_set_selected_timeout(void *eloop_ctx, void *timeout_ctx) 26 | { 27 | struct subscription *s = eloop_ctx; 28 | wpa_printf(MSG_DEBUG, "WPS: SetSelectedRegistrar from ER timed out"); 29 | s->selected_registrar = 0; 30 | wps_registrar_selected_registrar_changed(s->reg); 31 | } 32 | 33 | 34 | int upnp_er_set_selected_registrar(struct wps_registrar *reg, 35 | struct subscription *s, 36 | const struct wpabuf *msg) 37 | { 38 | struct wps_parse_attr attr; 39 | 40 | wpa_hexdump_buf(MSG_MSGDUMP, "WPS: SetSelectedRegistrar attributes", 41 | msg); 42 | 43 | if (wps_parse_msg(msg, &attr) < 0) 44 | return -1; 45 | if (!wps_version_supported(attr.version)) { 46 | wpa_printf(MSG_DEBUG, "WPS: Unsupported SetSelectedRegistrar " 47 | "version 0x%x", attr.version ? *attr.version : 0); 48 | return -1; 49 | } 50 | 51 | s->reg = reg; 52 | eloop_cancel_timeout(upnp_er_set_selected_timeout, s, NULL); 53 | 54 | if (attr.selected_registrar == NULL || *attr.selected_registrar == 0) { 55 | wpa_printf(MSG_DEBUG, "WPS: SetSelectedRegistrar: Disable " 56 | "Selected Registrar"); 57 | s->selected_registrar = 0; 58 | } else { 59 | s->selected_registrar = 1; 60 | s->dev_password_id = attr.dev_password_id ? 61 | WPA_GET_BE16(attr.dev_password_id) : DEV_PW_DEFAULT; 62 | s->config_methods = attr.sel_reg_config_methods ? 63 | WPA_GET_BE16(attr.sel_reg_config_methods) : -1; 64 | eloop_register_timeout(WPS_PBC_WALK_TIME, 0, 65 | upnp_er_set_selected_timeout, s, NULL); 66 | } 67 | 68 | wps_registrar_selected_registrar_changed(reg); 69 | 70 | return 0; 71 | } 72 | 73 | 74 | void upnp_er_remove_notification(struct subscription *s) 75 | { 76 | s->selected_registrar = 0; 77 | eloop_cancel_timeout(upnp_er_set_selected_timeout, s, NULL); 78 | if (s->reg) 79 | wps_registrar_selected_registrar_changed(s->reg); 80 | } 81 | -------------------------------------------------------------------------------- /network/bully/version.mk: -------------------------------------------------------------------------------- 1 | PKG_NAME:=bully 2 | PKG_VERSION:=1.0 3 | PKG_RELEASE:=22 4 | -------------------------------------------------------------------------------- /network/dsniff/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2006 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=dsniff 11 | PKG_VERSION:=2.4b1 12 | PKG_RELEASE:=2 13 | 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 15 | PKG_SOURCE_URL:=http://www.monkey.org/~dugsong/dsniff/beta 16 | PKG_MD5SUM:=2f761fa3475682a7512b0b43568ee7d6 17 | 18 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-2.4 19 | 20 | include $(INCLUDE_DIR)/package.mk 21 | 22 | define Package/dsniff 23 | SECTION:=net 24 | CATEGORY:=Network 25 | DEPENDS:=+libpcap +libnids +libnet0 +libopenssl +libgdbm $(LIBRPC_DEPENDS) 26 | TITLE:=A collection of tools for network auditing and penetration testing 27 | URL:=http://www.monkey.org/~dugsong/dsniff/ 28 | endef 29 | 30 | define Package/dsniff/description 31 | A collection of tools for network auditing and penetration testing. 32 | endef 33 | 34 | TARGET_LDFLAGS += $(LIBRPC) 35 | 36 | define Build/Configure 37 | $(call Build/Configure/Default, \ 38 | --with-gdbm="$(STAGING_DIR)/usr" \ 39 | --with-libnids="$(STAGING_DIR)/usr" \ 40 | --with-libpcap="$(STAGING_DIR)/usr" \ 41 | --with-libnet="$(STAGING_DIR)/usr/lib/libnet-1.0.x" \ 42 | --with-openssl="$(STAGING_DIR)/usr" \ 43 | --without-db \ 44 | --without-x \ 45 | ) 46 | endef 47 | 48 | define Build/Compile 49 | $(MAKE) -C $(PKG_BUILD_DIR) \ 50 | $(TARGET_CONFIGURE_OPTS) \ 51 | install_prefix="$(PKG_INSTALL_DIR)" \ 52 | all install 53 | endef 54 | 55 | define Package/dsniff/install 56 | $(INSTALL_DIR) $(1)/usr/sbin 57 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ 58 | $(INSTALL_DIR) $(1)/usr/lib 59 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/ 60 | endef 61 | 62 | $(eval $(call BuildPackage,dsniff)) 63 | -------------------------------------------------------------------------------- /network/dsniff/patches/001-arpspoof_fix.patch: -------------------------------------------------------------------------------- 1 | diff -urN dsniff.old/arp.c dsniff.dev/arp.c 2 | --- dsniff.old/arp.c 2001-03-15 09:32:58.000000000 +0100 3 | +++ dsniff.dev/arp.c 2006-03-03 01:41:10.000000000 +0100 4 | @@ -39,7 +39,7 @@ 5 | 6 | #ifdef BSD 7 | int 8 | -arp_cache_lookup(in_addr_t ip, struct ether_addr *ether) 9 | +arp_cache_lookup(in_addr_t ip, struct ether_addr *ether, const char *lif) 10 | { 11 | int mib[6]; 12 | size_t len; 13 | @@ -91,7 +91,7 @@ 14 | #endif 15 | 16 | int 17 | -arp_cache_lookup(in_addr_t ip, struct ether_addr *ether) 18 | +arp_cache_lookup(in_addr_t ip, struct ether_addr *ether, const char *lif) 19 | { 20 | int sock; 21 | struct arpreq ar; 22 | @@ -99,7 +99,7 @@ 23 | 24 | memset((char *)&ar, 0, sizeof(ar)); 25 | #ifdef __linux__ 26 | - strncpy(ar.arp_dev, "eth0", sizeof(ar.arp_dev)); /* XXX - *sigh* */ 27 | + strncpy(ar.arp_dev, lif, strlen(lif)); 28 | #endif 29 | sin = (struct sockaddr_in *)&ar.arp_pa; 30 | sin->sin_family = AF_INET; 31 | diff -urN dsniff.old/arp.h dsniff.dev/arp.h 32 | --- dsniff.old/arp.h 2001-03-15 09:27:08.000000000 +0100 33 | +++ dsniff.dev/arp.h 2006-03-03 01:42:23.000000000 +0100 34 | @@ -11,6 +11,6 @@ 35 | #ifndef _ARP_H_ 36 | #define _ARP_H_ 37 | 38 | -int arp_cache_lookup(in_addr_t ip, struct ether_addr *ether); 39 | +int arp_cache_lookup(in_addr_t ip, struct ether_addr *ether, const char *lif); 40 | 41 | #endif /* _ARP_H_ */ 42 | diff -urN dsniff.old/arpspoof.c dsniff.dev/arpspoof.c 43 | --- dsniff.old/arpspoof.c 2001-03-15 09:32:58.000000000 +0100 44 | +++ dsniff.dev/arpspoof.c 2006-03-03 01:42:00.000000000 +0100 45 | @@ -113,7 +113,7 @@ 46 | int i = 0; 47 | 48 | do { 49 | - if (arp_cache_lookup(ip, mac) == 0) 50 | + if (arp_cache_lookup(ip, mac, intf) == 0) 51 | return (1); 52 | #ifdef __linux__ 53 | /* XXX - force the kernel to arp. feh. */ 54 | -------------------------------------------------------------------------------- /network/dsniff/patches/004-no_yp.patch: -------------------------------------------------------------------------------- 1 | Index: dsniff-2.4/decode.c 2 | =================================================================== 3 | --- dsniff-2.4.orig/decode.c 2010-11-03 23:42:49.419000001 +0100 4 | +++ dsniff-2.4/decode.c 2010-11-03 23:42:56.481000002 +0100 5 | @@ -51,8 +51,6 @@ 6 | extern int decode_portmap(u_char *, int, u_char *, int); 7 | extern int decode_mountd(u_char *, int, u_char *, int); 8 | extern int decode_vrrp(u_char *, int, u_char *, int); 9 | -extern int decode_ypserv(u_char *, int, u_char *, int); 10 | -extern int decode_yppasswd(u_char *, int, u_char *, int); 11 | 12 | static struct decode decodes[] = { 13 | { "hex", decode_hex }, 14 | @@ -88,8 +86,6 @@ 15 | { "irc", decode_irc }, 16 | { "portmap", decode_portmap }, 17 | { "mountd", decode_mountd }, 18 | - { "ypserv", decode_ypserv }, 19 | - { "yppasswd", decode_yppasswd }, 20 | { NULL } 21 | }; 22 | 23 | Index: dsniff-2.4/dsniff.services 24 | =================================================================== 25 | --- dsniff-2.4.orig/dsniff.services 2010-11-03 23:42:49.429000001 +0100 26 | +++ dsniff-2.4/dsniff.services 2010-11-03 23:42:56.481000002 +0100 27 | @@ -66,5 +66,3 @@ 28 | aim 9898/tcp 29 | pcanywhere 65301/tcp 30 | mountd 100005/rpc 31 | -ypserv 100004/rpc 32 | -yppasswd 100009/rpc 33 | Index: dsniff-2.4/Makefile.in 34 | =================================================================== 35 | --- dsniff-2.4.orig/Makefile.in 2010-11-03 23:42:51.736998874 +0100 36 | +++ dsniff-2.4/Makefile.in 2010-11-03 23:42:56.481000002 +0100 37 | @@ -60,7 +60,7 @@ 38 | decode_pop.c decode_portmap.c decode_postgresql.c decode_pptp.c \ 39 | decode_rip.c decode_rlogin.c decode_smb.c decode_smtp.c \ 40 | decode_sniffer.c decode_snmp.c decode_socks.c decode_tds.c \ 41 | - decode_telnet.c decode_vrrp.c decode_yp.c decode_x11.c 42 | + decode_telnet.c decode_vrrp.c decode_x11.c 43 | 44 | GEN = mount.h mount.c nfs_prot.h nfs_prot.c 45 | 46 | -------------------------------------------------------------------------------- /network/dsniff/patches/005-openssl_fix.patch: -------------------------------------------------------------------------------- 1 | --- dsniff-2.4b1.orig/sshcrypto.c 2 | +++ dsniff-2.4b1/sshcrypto.c 3 | @@ -14,6 +14,8 @@ 4 | 5 | #include 6 | #include 7 | +#include 8 | +#include 9 | 10 | #include 11 | #include 12 | -------------------------------------------------------------------------------- /network/dsniff/patches/006-pcap_header.patch: -------------------------------------------------------------------------------- 1 | Index: dsniff-2.4/configure 2 | =================================================================== 3 | --- dsniff-2.4.orig/configure 2010-11-03 23:42:52.921000006 +0100 4 | +++ dsniff-2.4/configure 2010-11-03 23:43:00.504000001 +0100 5 | @@ -3033,7 +3033,7 @@ 6 | PCAPINC="-I$withval -I$withval/bpf" 7 | PCAPLIB="-L$withval -lpcap" 8 | elif test -f $withval/include/pcap.h -a \ 9 | - -f $withval/include/net/bpf.h -a \ 10 | + -f $withval/include/pcap-bpf.h -a \ 11 | -f $withval/lib/libpcap.a; then 12 | owd=`pwd` 13 | if cd $withval; then withval=`pwd`; cd $owd; fi 14 | -------------------------------------------------------------------------------- /network/dsniff/patches/007-time_h.patch: -------------------------------------------------------------------------------- 1 | diff -urNad --exclude=CVS --exclude=.svn dsniff-2.4b1/msgsnarf.c dsniff-2.4b1/msgsnarf.c 2 | --- dsniff-2.4b1/msgsnarf.c 2001-03-15 08:33:04.000000000 +0000 3 | +++ dsniff-2.4b1/msgsnarf.c 2005-07-11 20:15:50.000000000 +0000 4 | @@ -23,6 +23,7 @@ 5 | #include 6 | #include 7 | #include 8 | +#include 9 | 10 | #include "buf.h" 11 | #include "decode.h" 12 | diff -urNad --exclude=CVS --exclude=.svn dsniff-2.4b1/sshow.c dsniff-2.4b1/sshow.c 13 | --- dsniff-2.4b1/sshow.c 2005-07-11 20:14:19.000000000 +0000 14 | +++ dsniff-2.4b1/sshow.c 2005-07-11 20:15:26.000000000 +0000 15 | @@ -15,6 +15,7 @@ 16 | 17 | #include 18 | #include 19 | +#include 20 | 21 | #include 22 | #include 23 | -------------------------------------------------------------------------------- /network/dsniff/patches/008-md5_include.patch: -------------------------------------------------------------------------------- 1 | Index: dsniff-2.4/record.c 2 | =================================================================== 3 | --- dsniff-2.4.orig/record.c 2010-11-03 23:43:14.268000004 +0100 4 | +++ dsniff-2.4/record.c 2010-11-03 23:43:16.947000004 +0100 5 | @@ -14,7 +14,7 @@ 6 | 7 | #include 8 | #include 9 | -#include 10 | +#include "missing/md5.h" 11 | #include 12 | #include 13 | 14 | -------------------------------------------------------------------------------- /network/dsniff/patches/010-clk-tck-fix.patch: -------------------------------------------------------------------------------- 1 | Index: dsniff-2.4/sshow.c 2 | =================================================================== 3 | --- dsniff-2.4.orig/sshow.c 2010-11-03 23:41:56.335999997 +0100 4 | +++ dsniff-2.4/sshow.c 2010-11-03 23:42:10.981000001 +0100 5 | @@ -42,6 +42,10 @@ 6 | 7 | #define HISTORY_SIZE 16 8 | 9 | +#ifndef CLK_TCK 10 | +# define CLK_TCK CLOCKS_PER_SEC 11 | +#endif 12 | + 13 | typedef struct { 14 | u_int min, max; 15 | } range; 16 | -------------------------------------------------------------------------------- /network/ettercap/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2006-2010 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=ettercap 11 | PKG_VERSION:=0.8.3 12 | PKG_RELEASE:=1 13 | 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 15 | PKG_SOURCE_URL:=https://github.com/Ettercap/ettercap.git 16 | PKG_SOURCE_VERSION:=90f2a397966d721868a1fb49c5ecaba0f0af72d0 17 | 18 | PKG_FIXUP:=autoreconf 19 | PKG_INSTALL:=1 20 | PKG_BUILD_PARALLEL:=1 21 | 22 | include $(INCLUDE_DIR)/package.mk 23 | include $(INCLUDE_DIR)/nls.mk 24 | 25 | define Package/ettercap 26 | SECTION:=net 27 | CATEGORY:=Network 28 | DEPENDS:=+libpcap +libnet1 +libopenssl +libpcre +libncurses +libltdl +libpthread +zlib 29 | TITLE:=Ettercap is a suite for man in the middle attacks on LAN. 30 | URL:=http://ettercap.sourceforge.net 31 | endef 32 | 33 | define Package/ettercap/description 34 | It features sniffing of live connections, content filtering on the fly 35 | and many other interesting tricks. 36 | It supports active and passive dissection of many protocols (even 37 | ciphered ones) and includes many feature for network and host analysis. 38 | endef 39 | 40 | define Package/ettercap/conffiles 41 | /etc/etter.conf 42 | endef 43 | 44 | define Build/Prepare 45 | $(call Build/Prepare/Default) 46 | # remove default optimization flags set by configure 47 | $(SED) 's,DEBUG_FLAGS=.*,DEBUG_FLAGS=,g' $(PKG_BUILD_DIR)/configure 48 | endef 49 | 50 | CONFIGURE_ARGS += \ 51 | --with-libpcap="$(STAGING_DIR)/usr" \ 52 | --with-libnet="$(STAGING_DIR)/usr/lib/libnet-1.1.x" \ 53 | --with-openssl="$(STAGING_DIR)/usr" \ 54 | --with-libpcre="$(STAGING_DIR)/usr" \ 55 | --with-iconv="$(ICONV_PREFIX)" \ 56 | --with-libncurses="$(STAGING_DIR)/usr" \ 57 | --disable-gtk \ 58 | --disable-debug \ 59 | --enable-plugins 60 | 61 | MAKE_FLAGS += \ 62 | DESTDIR="$(PKG_INSTALL_DIR)" 63 | 64 | define Package/ettercap/install 65 | $(INSTALL_DIR) $(1)/etc 66 | $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/etter.conf $(1)/etc/ 67 | $(INSTALL_DIR) $(1)/usr/bin 68 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/etter{cap,filter,log} $(1)/usr/bin/ 69 | $(INSTALL_DIR) $(1)/usr/lib/ettercap 70 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ettercap/*.so $(1)/usr/lib/ettercap/ 71 | $(INSTALL_DIR) $(1)/usr/share/ettercap 72 | $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ettercap/* $(1)/usr/share/ettercap/ 73 | endef 74 | 75 | $(eval $(call BuildPackage,ettercap)) 76 | -------------------------------------------------------------------------------- /network/ettercap/patches/001-cmake_in_source_build.patch: -------------------------------------------------------------------------------- 1 | --- a/CMakeLists.txt 2 | +++ b/CMakeLists.txt 3 | @@ -6,8 +6,6 @@ set(VERSION "0.8.2") 4 | set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") 5 | set(CMAKE_SCRIPT_PATH "${CMAKE_SOURCE_DIR}/cmake/Scripts") 6 | 7 | -include(MacroEnsureOutOfSourceBuild) 8 | -macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there.") 9 | 10 | option(ENABLE_CURSES "Enable curses interface" ON) 11 | option(ENABLE_GTK "Enable GTK interface" ON) -------------------------------------------------------------------------------- /network/ettercap/patches/001-cross_compiling.patch: -------------------------------------------------------------------------------- 1 | diff -urN ettercap-NG-0.7.3/configure ettercap-NG-0.7.3.new/configure 2 | --- ettercap-NG-0.7.3/configure 2005-05-27 17:11:45.000000000 +0200 3 | +++ ettercap-NG-0.7.3.new/configure 2006-08-21 20:15:07.000000000 +0200 4 | @@ -27354,6 +27354,7 @@ 5 | 6 | echo "$as_me:$LINENO: checking for NS_GET32" >&5 7 | echo $ECHO_N "checking for NS_GET32... $ECHO_C" >&6 8 | +cross_compiling=no 9 | if test "$cross_compiling" = yes; then 10 | { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling 11 | See \`config.log' for more details." >&5 12 | diff -urN ettercap-NG-0.7.3/configure.in ettercap-NG-0.7.3.new/configure.in 13 | --- ettercap-NG-0.7.3/configure.in 2005-01-13 10:24:28.000000000 +0100 14 | +++ ettercap-NG-0.7.3.new/configure.in 2006-08-21 20:13:29.000000000 +0200 15 | @@ -236,7 +236,7 @@ 16 | AC_CHECK_HEADERS(sys/poll.h poll.h sys/select.h) 17 | AC_CHECK_HEADERS(sys/cdefs.h) 18 | dnl nameser NS_GET32 and so on... 19 | -EC_NS_GET() 20 | +#EC_NS_GET() 21 | 22 | dnl ================================================================== 23 | dnl Checks for typedefs, structures, and compiler characteristics. 24 | -------------------------------------------------------------------------------- /network/ettercap/patches/002-cmake_iconv_names.patch: -------------------------------------------------------------------------------- 1 | --- a/cmake/Modules/EttercapLibCheck.cmake 2 | +++ b/cmake/Modules/EttercapLibCheck.cmake 3 | @@ -98,7 +98,7 @@ include(CheckLibraryExists) 4 | include(CheckIncludeFile) 5 | 6 | # Iconv 7 | -FIND_LIBRARY(HAVE_ICONV iconv) 8 | +FIND_LIBRARY(HAVE_ICONV NAMES iconv libiconv-full PATHS ${STAGING_DIR}/usr/lib/libiconv-full) 9 | CHECK_FUNCTION_EXISTS(iconv HAVE_UTF8) 10 | if(HAVE_ICONV) 11 | # Seem that we have a dedicated iconv library not built in libc (e.g. FreeBSD) 12 | --- a/CMakeLists.txt 13 | ++++ b/CMakeLists.txt 14 | @@ -126,6 +126,8 @@ endif(NOT DISABLE_RPATH) 15 | set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb3 -DDEBUG -Wall -Wno-pointer-sign -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Wextra -Wredundant-decls" CACHE STRING "" FORCE) 16 | set(CMAKE_C_FLAGS_RELEASE "-O2 -w -D_FORTIFY_SOURCE=2" CACHE STRING "" FORCE) 17 | 18 | + 19 | + 20 | if(OS_DARWIN) 21 | set(CMAKE_EXE_LINKER_FLAGS "-Wl" CACHE STRING "" FORCE) 22 | set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-Wl" CACHE STRING "" FORCE) -------------------------------------------------------------------------------- /network/ettercap/patches/002-libnet_check_honor_ldflags.patch: -------------------------------------------------------------------------------- 1 | diff -ruN ettercap-NG-0.7.3-old/configure ettercap-NG-0.7.3-new/configure 2 | --- ettercap-NG-0.7.3-old/configure 2006-10-03 18:24:09.000000000 +0200 3 | +++ ettercap-NG-0.7.3-new/configure 2006-10-03 18:28:57.000000000 +0200 4 | @@ -31759,7 +31759,7 @@ 5 | 6 | OLDLDFLAGS="${LDFLAGS}" 7 | OLDLIBS="${LIBS}" 8 | - LDFLAGS="$LNETLIB" 9 | + LDFLAGS="$LDFLAGS $LNETLIB" 10 | LIBS="$LIBS" 11 | 12 | echo "$as_me:$LINENO: checking for libnet_adv_free_packet in -lnet" >&5 13 | diff -ruN ettercap-NG-0.7.3-old/configure.in ettercap-NG-0.7.3-new/configure.in 14 | --- ettercap-NG-0.7.3-old/configure.in 2006-10-03 18:24:09.000000000 +0200 15 | +++ ettercap-NG-0.7.3-new/configure.in 2006-10-03 18:26:45.000000000 +0200 16 | @@ -500,7 +500,7 @@ 17 | ] 18 | ) 19 | 20 | -EC_CHECK_FUNC(net, libnet_adv_free_packet, $LNETLIB, $LIBS,, AC_MSG_ERROR([Incorrect libnet version. libnet >= 1.1.2.1 required])) 21 | +EC_CHECK_FUNC(net, libnet_adv_free_packet, $LDFLAGS $LNETLIB, $LIBS,, AC_MSG_ERROR([Incorrect libnet version. libnet >= 1.1.2.1 required])) 22 | 23 | dnl ------------------ 24 | dnl Checks for openssl 25 | -------------------------------------------------------------------------------- /network/ettercap/patches/003-automake-compat.patch: -------------------------------------------------------------------------------- 1 | --- a/configure.in 2 | +++ b/configure.in 3 | @@ -197,6 +197,9 @@ dnl ======================== 4 | dnl Libtool related... 5 | dnl ======================== 6 | 7 | +LT_INIT 8 | +LTDL_INIT 9 | +LT_CONFIG_LTDL_DIR([libltdl]) 10 | AC_DISABLE_STATIC 11 | AC_LIBTOOL_WIN32_DLL 12 | AC_LIBTOOL_DLOPEN 13 | --- a/include/ec_os_mingw.h 14 | +++ b/include/ec_os_mingw.h 15 | @@ -163,7 +163,7 @@ EC_API_EXTERN const char *ec_win_get_ec_ 16 | */ 17 | #if !defined(HAVE_DLOPEN) 18 | #define RTLD_NOW 0 19 | - #define LTDL_SHLIB_EXT "*.dll" 20 | + #define LT_MODULE_EXT ".dll" 21 | 22 | #define dlopen(dll,flg) ec_win_dlopen (dll, flg) 23 | #define lt_dlopen(dll) ec_win_dlopen (dll, 0) 24 | --- a/src/ec_plugins.c 25 | +++ b/src/ec_plugins.c 26 | @@ -131,7 +131,7 @@ int plugin_filter(struct dirent *d) 27 | int plugin_filter(const struct dirent *d) 28 | #endif 29 | { 30 | - if ( match_pattern(d->d_name, PLUGIN_PATTERN LTDL_SHLIB_EXT) ) 31 | + if ( match_pattern(d->d_name, PLUGIN_PATTERN LT_MODULE_EXT) ) 32 | return 1; 33 | 34 | return 0; 35 | -------------------------------------------------------------------------------- /network/files/kismet_package.conf: -------------------------------------------------------------------------------- 1 | # Insecure defaults for tetra; before making it a proper module 2 | # we should integrate with the tetra ui 3 | httpd_username=kismet 4 | httpd_password=kismet 5 | 6 | httpd_home=/etc/kismet/http_data 7 | 8 | # Save memory on Tetra 9 | keep_location_cloud_history=false 10 | keep_datasource_signal_history=false 11 | 12 | packet_dedup_size=512 13 | 14 | packet_backlog_warning=512 15 | packet_backlog_limit=1024 16 | 17 | tcp_buffer_kb=64 18 | ipc_buffer_kb=64 19 | -------------------------------------------------------------------------------- /network/hcxtools/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2019 Andreas Nilsen 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=hcxtools 11 | PKG_VERSION:=6.1.6 12 | PKG_RELEASE:=$(AUTORELEASE) 13 | 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 15 | PKG_SOURCE_URL:=https://codeload.github.com/zerbea/hcxtools/tar.gz/$(PKG_VERSION)? 16 | PKG_HASH:=27b1b1ad722b9d82f8e92c6bec92d081159e5b8225bd2a477bf8d304ff4aeb03 17 | 18 | PKG_MAINTAINER:=Andreas Nilsen 19 | PKG_LICENSE:=MIT 20 | PKG_LICENSE_FILES:=license.txt 21 | 22 | include $(INCLUDE_DIR)/package.mk 23 | 24 | define Package/hcxtools 25 | SECTION:=net 26 | CATEGORY:=Network 27 | DEPENDS:=+libpthread +libpcap +zlib +libcurl +libopenssl 28 | TITLE:=hcxtools 29 | URL:=https://github.com/ZerBea/hcxtools 30 | SUBMENU:=Wireless 31 | endef 32 | 33 | define Package/hcxtools/description 34 | Set of tools convert packets from captures (h = hash, c = capture, convert and calculate candidates, x = different hashtypes) 35 | for the use with latest hashcat or John the Ripper. 36 | endef 37 | 38 | define Build/Compile 39 | $(MAKE) -C $(PKG_BUILD_DIR)/ \ 40 | $(TARGET_CONFIGURE_OPTS) \ 41 | CFLAGS="$(TARGET_CFLAGS)" 42 | endef 43 | 44 | define Package/hcxtools/install 45 | $(INSTALL_DIR) $(1)/sbin 46 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/hcxeiutool $(1)/sbin/ 47 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/hcxessidtool $(1)/sbin/ 48 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/hcxhash2cap $(1)/sbin/ 49 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/hcxhashcattool $(1)/sbin/ 50 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/hcxhashtool $(1)/sbin/ 51 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/hcxmactool $(1)/sbin/ 52 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/hcxpcapngtool $(1)/sbin/ 53 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/hcxpmkidtool $(1)/sbin/ 54 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/hcxpmktool $(1)/sbin/ 55 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/hcxpsktool $(1)/sbin/ 56 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/hcxwltool $(1)/sbin/ 57 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/whoismac $(1)/sbin/ 58 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/wlancap2wpasec $(1)/sbin/ 59 | endef 60 | 61 | $(eval $(call BuildPackage,hcxtools)) 62 | -------------------------------------------------------------------------------- /network/hcxtools/patches/010-openssl.patch: -------------------------------------------------------------------------------- 1 | --- a/hcxhashtool.c 2 | +++ b/hcxhashtool.c 3 | @@ -104,9 +104,6 @@ static void closelists() 4 | { 5 | if(hashlist != NULL) free(hashlist); 6 | if(ouilist != NULL) free(ouilist); 7 | -EVP_cleanup(); 8 | -CRYPTO_cleanup_all_ex_data(); 9 | -ERR_free_strings(); 10 | return; 11 | } 12 | /*===========================================================================*/ 13 | @@ -125,8 +122,6 @@ eapolwrittencount = 0; 14 | essidwrittencount = 0; 15 | hccapxwrittencount = 0; 16 | hccapwrittencount = 0; 17 | -ERR_load_crypto_strings(); 18 | -OpenSSL_add_all_algorithms(); 19 | if((hashlist = (hashlist_t*)calloc(hashlistcount, HASHLIST_SIZE)) == NULL) return false; 20 | if((ouilist = (ouilist_t*)calloc(ouilistcount, OUILIST_SIZE)) == NULL) return false; 21 | return true; 22 | --- a/hcxpcapngtool.c 23 | +++ b/hcxpcapngtool.c 24 | @@ -358,9 +358,6 @@ if(eapmschapv2msglist != NULL) free(eapm 25 | if(eapmschapv2hashlist != NULL) free(eapmschapv2hashlist); 26 | if(tacacsplist != NULL) free(tacacsplist); 27 | 28 | -EVP_cleanup(); 29 | -CRYPTO_cleanup_all_ex_data(); 30 | -ERR_free_strings(); 31 | return; 32 | } 33 | /*===========================================================================*/ 34 | @@ -369,8 +366,6 @@ static bool initlists() 35 | static unsigned long opensslversion; 36 | static const char nastring[] = { "N/A" }; 37 | 38 | -ERR_load_crypto_strings(); 39 | -OpenSSL_add_all_algorithms(); 40 | opensslversion = OpenSSL_version_num(); 41 | opensslversionmajor = (opensslversion & 0x10000000L) >> 28; 42 | opensslversionminor = (opensslversion & 0x01100000L) >> 20; 43 | --- a/hcxpmktool.c 44 | +++ b/hcxpmktool.c 45 | @@ -920,8 +920,6 @@ while((auswahl = getopt_long(argc, argv, 46 | } 47 | } 48 | 49 | -ERR_load_crypto_strings(); 50 | -OpenSSL_add_all_algorithms(); 51 | printf("\n"); 52 | if((essidstring != NULL) && (pskstring != NULL) && (pmkstring == NULL) && (hashlinestring == NULL)) 53 | { 54 | @@ -953,9 +951,6 @@ else if((essidstring != NULL) && (pskstr 55 | } 56 | 57 | printf("\n"); 58 | -EVP_cleanup(); 59 | -CRYPTO_cleanup_all_ex_data(); 60 | -ERR_free_strings(); 61 | return EXIT_SUCCESS; 62 | } 63 | /*===========================================================================*/ 64 | --- a/hcxpsktool.c 65 | +++ b/hcxpsktool.c 66 | @@ -61,8 +61,6 @@ essidglen = 32; 67 | t = time(NULL); 68 | tm = localtime(&t); 69 | thisyear = tm->tm_year +1900; 70 | -ERR_load_crypto_strings(); 71 | -OpenSSL_add_all_algorithms(); 72 | return; 73 | } 74 | /*===========================================================================*/ 75 | @@ -2770,10 +2768,6 @@ if(pskname != NULL) 76 | fclose(fhpsk); 77 | } 78 | 79 | -EVP_cleanup(); 80 | -CRYPTO_cleanup_all_ex_data(); 81 | -ERR_free_strings(); 82 | - 83 | return EXIT_SUCCESS; 84 | } 85 | /*===========================================================================*/ 86 | -------------------------------------------------------------------------------- /network/kismet-hak5/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=kismet-hak5 4 | PKG_VERSION:=2020-03-R1 5 | PKG_RELEASE:=1 6 | 7 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 8 | PKG_SOURCE_PROTO:=git 9 | PKG_SOURCE_URL:=https://github.com/kismetwireless/kismet.git 10 | PKG_SOURCE_VERSION:=925cf90e0112a0bfc926e21e0fae4503ae3b7a78 11 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz 12 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 13 | 14 | include $(INCLUDE_DIR)/package.mk 15 | 16 | PKG_USE_MIPS16:=0 17 | 18 | HOST_BUILD_DEPENDS:=protobuf/host 19 | 20 | define Package/kismet-hak5 21 | SECTION:=net 22 | CATEGORY:=Network 23 | TITLE:=Kismet (Hak5) 24 | URL:=https://www.kismetwireless.net/ 25 | DEPENDS:=+libpthread +libpcap +libpcre +libmicrohttpd +libnl +libcap +libstdcpp +libncurses +libsqlite3 +zlib +protobuf-lite +libprotobuf-c +libdw 26 | SUBMENU:=wireless 27 | endef 28 | 29 | define Package/kismet-hak5/description 30 | Kismet wireless capture and IDS 31 | Latest web UI based Kismet 32 | Linux Wi-Fi and Bluetooth capture tools 33 | endef 34 | 35 | define Build/Configure 36 | $(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR)) 37 | endef 38 | 39 | CONFIGURE_ARGS += \ 40 | --sysconfdir=/etc/kismet \ 41 | --bindir=/usr/bin \ 42 | --disable-python-tools \ 43 | --with-protoc=$(STAGING_DIR_HOSTPKG)/bin/protoc \ 44 | --enable-protobuflite 45 | 46 | # Override libs to force lpthread because we don't detect it properly on openwrt 47 | CONFIGURE_VARS += \ 48 | CXXFLAGS="$$$$CXXFLAGS" \ 49 | LIBS="-lm -lpthread" 50 | 51 | define Build/Compile 52 | $(MAKE) -C $(PKG_BUILD_DIR) \ 53 | LD="$(TARGET_CXX)" \ 54 | all 55 | endef 56 | 57 | define Package/kismet-hak5/install 58 | $(INSTALL_DIR) $(1)/usr/bin 59 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/kismet $(1)/usr/bin/ 60 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/kismet_cap_pcapfile $(1)/usr/bin/ 61 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/capture_linux_wifi/kismet_cap_linux_wifi $(1)/usr/bin/ 62 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/capture_linux_bluetooth/kismet_cap_linux_bluetooth $(1)/usr/bin/ 63 | 64 | $(INSTALL_DIR) $(1)/etc/kismet/ 65 | $(INSTALL_CONF) ./files/kismet_package.conf $(1)/etc/kismet 66 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet.conf $(1)/etc/kismet 67 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_80211.conf $(1)/etc/kismet 68 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_alerts.conf $(1)/etc/kismet 69 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_filter.conf $(1)/etc/kismet 70 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_httpd.conf $(1)/etc/kismet 71 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_logging.conf $(1)/etc/kismet 72 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_memory.conf $(1)/etc/kismet 73 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_storage.conf $(1)/etc/kismet 74 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_uav.conf $(1)/etc/kismet 75 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_manuf.txt $(1)/etc/kismet 76 | cp -Rv $(PKG_BUILD_DIR)/http_data $(1)/etc/kismet/ 77 | endef 78 | 79 | $(eval $(call BuildPackage,kismet-hak5)) 80 | -------------------------------------------------------------------------------- /network/kismet-hak5/files/kismet_package.conf: -------------------------------------------------------------------------------- 1 | # Insecure defaults for tetra; before making it a proper module 2 | # we should integrate with the tetra ui 3 | httpd_username=kismet 4 | httpd_password=kismet 5 | 6 | httpd_home=/etc/kismet/http_data 7 | 8 | # Save memory on Tetra 9 | keep_location_cloud_history=false 10 | keep_datasource_signal_history=false 11 | 12 | packet_dedup_size=512 13 | 14 | packet_backlog_warning=512 15 | packet_backlog_limit=1024 16 | 17 | tcp_buffer_kb=64 18 | ipc_buffer_kb=64 19 | -------------------------------------------------------------------------------- /network/kismet-master/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=kismet 4 | PKG_VERSION:=2020-04-R3 5 | PKG_RELEASE:=1 6 | 7 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 8 | PKG_SOURCE_PROTO:=git 9 | 10 | PKG_SOURCE_URL:=https://codeload.github.com/kismetwireless/kismet/tar.gz/kismet-$(PKG_VERSION)? 11 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION).tar.gz 12 | PKG_SOURCE_VERSION:=$(PKG_VERSION) 13 | #PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 14 | 15 | include $(INCLUDE_DIR)/package.mk 16 | 17 | PKG_USE_MIPS16:=0 18 | 19 | HOST_BUILD_DEPENDS:=protobuf/host 20 | 21 | define Package/kismet 22 | SECTION:=net 23 | CATEGORY:=Network 24 | TITLE:=Kismet 25 | URL:=https://www.kismetwireless.net/ 26 | DEPENDS:=+libpthread +libpcap +libpcre +libmicrohttpd +libnl +libcap +libstdcpp +libncurses +libsqlite3 +zlib +protobuf-lite +libprotobuf-c +libdw 27 | SUBMENU:=wireless 28 | endef 29 | 30 | define Package/kismet/description 31 | Kismet wireless capture and IDS 32 | Latest web UI based Kismet 33 | Linux Wi-Fi and Bluetooth capture tools 34 | endef 35 | 36 | define Build/Configure 37 | $(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR)) 38 | endef 39 | 40 | CONFIGURE_ARGS += \ 41 | --sysconfdir=/etc/kismet \ 42 | --bindir=/usr/bin \ 43 | --disable-python-tools \ 44 | --with-protoc=$(STAGING_DIR_HOSTPKG)/bin/protoc \ 45 | --enable-protobuflite 46 | 47 | # Override libs to force lpthread because we don't detect it properly on openwrt 48 | CONFIGURE_VARS += \ 49 | CXXFLAGS="$$$$CXXFLAGS" \ 50 | LIBS="-lm -lpthread" 51 | 52 | define Build/Compile 53 | $(MAKE) -C $(PKG_BUILD_DIR) \ 54 | LD="$(TARGET_CXX)" \ 55 | all 56 | endef 57 | 58 | define Package/kismet/install 59 | $(INSTALL_DIR) $(1)/usr/bin 60 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/kismet $(1)/usr/bin/ 61 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/kismet_cap_pcapfile $(1)/usr/bin/ 62 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/capture_linux_wifi/kismet_cap_linux_wifi $(1)/usr/bin/ 63 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/capture_linux_bluetooth/kismet_cap_linux_bluetooth $(1)/usr/bin/ 64 | 65 | $(INSTALL_DIR) $(1)/etc/kismet/ 66 | $(INSTALL_CONF) ./files/kismet_site.conf $(1)/etc/kismet/ 67 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet.conf $(1)/etc/kismet 68 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_80211.conf $(1)/etc/kismet 69 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_alerts.conf $(1)/etc/kismet 70 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_filter.conf $(1)/etc/kismet 71 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_httpd.conf $(1)/etc/kismet 72 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_logging.conf $(1)/etc/kismet 73 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_memory.conf $(1)/etc/kismet 74 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_storage.conf $(1)/etc/kismet 75 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_uav.conf $(1)/etc/kismet 76 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_manuf.txt.gz $(1)/etc/kismet 77 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_adsb_icao.txt.gz $(1)/etc/kismet 78 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_bluetooth_ids.txt.gz $(1)/etc/kismet 79 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_bluetooth_manuf.txt.gz $(1)/etc/kismet 80 | cp -Rv $(PKG_BUILD_DIR)/http_data $(1)/etc/kismet/ 81 | endef 82 | 83 | $(eval $(call BuildPackage,kismet)) 84 | 85 | -------------------------------------------------------------------------------- /network/kismet-master/files/kismet_package.conf: -------------------------------------------------------------------------------- 1 | # Insecure defaults for tetra; before making it a proper module 2 | # we should integrate with the tetra ui 3 | httpd_username=kismet 4 | httpd_password=kismet 5 | 6 | httpd_home=/etc/kismet/http_data 7 | 8 | # Save memory on Tetra 9 | keep_location_cloud_history=false 10 | keep_datasource_signal_history=false 11 | 12 | packet_dedup_size=512 13 | 14 | packet_backlog_warning=512 15 | packet_backlog_limit=1024 16 | 17 | tcp_buffer_kb=64 18 | ipc_buffer_kb=64 19 | -------------------------------------------------------------------------------- /network/kismet-remotecap-hak5/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=kismet-remotecap-hak5 4 | PKG_VERSION:=2020-03-R1 5 | PKG_RELEASE:=1 6 | 7 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 8 | PKG_SOURCE_PROTO:=git 9 | PKG_SOURCE_URL:=https://github.com/kismetwireless/kismet.git 10 | PKG_SOURCE_VERSION:=925cf90e0112a0bfc926e21e0fae4503ae3b7a78 11 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz 12 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 13 | 14 | include $(INCLUDE_DIR)/package.mk 15 | 16 | PKG_USE_MIPS16:=0 17 | 18 | HOST_BUILD_DEPENDS:=protobuf/host 19 | 20 | define Package/kismet-remotecap-hak5 21 | SECTION:=net 22 | CATEGORY:=Network 23 | TITLE:=Kismet Remote Capture (Hak5) 24 | URL:=https://www.kismetwireless.net/ 25 | DEPENDS:=+libpthread +libpcap +libpcre +libmicrohttpd +libnl +libcap +libstdcpp +libncurses +libsqlite3 +zlib +protobuf-lite +libprotobuf-c +libdw 26 | SUBMENU:=wireless 27 | endef 28 | 29 | define Package/kismet-remotecap-hak5/description 30 | Kismet Wireless Remote Capture Tools. 31 | endef 32 | 33 | define Build/Configure 34 | $(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR)) 35 | endef 36 | 37 | CONFIGURE_ARGS += \ 38 | --sysconfdir=/etc/kismet \ 39 | --bindir=/usr/bin \ 40 | --disable-python-tools \ 41 | --with-protoc=$(STAGING_DIR_HOSTPKG)/bin/protoc \ 42 | --enable-capture-tools-only 43 | 44 | # Override libs to force lpthread because we don't detect it properly on openwrt 45 | CONFIGURE_VARS += \ 46 | CXXFLAGS="$$$$CXXFLAGS" \ 47 | LIBS="-lm -lpthread" 48 | 49 | define Build/Compile 50 | $(MAKE) -C $(PKG_BUILD_DIR) \ 51 | LD="$(TARGET_CXX)" \ 52 | datasources 53 | endef 54 | 55 | define Package/kismet-remotecap-hak5/install 56 | $(INSTALL_DIR) $(1)/usr/bin 57 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/kismet_cap_pcapfile $(1)/usr/bin/ 58 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/kismet_cap_kismetdb $(1)/usr/bin/ 59 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/capture_linux_wifi/kismet_cap_linux_wifi $(1)/usr/bin/ 60 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/capture_linux_bluetooth/kismet_cap_linux_bluetooth $(1)/usr/bin/ 61 | 62 | $(INSTALL_DIR) $(1)/etc/kismet/ 63 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet.conf $(1)/etc/kismet 64 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_80211.conf $(1)/etc/kismet 65 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_alerts.conf $(1)/etc/kismet 66 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_filter.conf $(1)/etc/kismet 67 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_httpd.conf $(1)/etc/kismet 68 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_logging.conf $(1)/etc/kismet 69 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_memory.conf $(1)/etc/kismet 70 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_storage.conf $(1)/etc/kismet 71 | $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_uav.conf $(1)/etc/kismet 72 | endef 73 | 74 | $(eval $(call BuildPackage,kismet-remotecap-hak5)) 75 | 76 | -------------------------------------------------------------------------------- /network/mdk3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2009-2014 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=mdk3 11 | PKG_VERSION:=v6 12 | PKG_RELEASE:=2 13 | PKG_MD5SUM:=67705a814ded2a2e6f70522ca0dc6da9 14 | 15 | PKG_BUILD_DIR:=$(BUILD_DIR)/mdk3-$(PKG_VERSION) 16 | PKG_SOURCE_URL:=http://homepages.tu-darmstadt.de/~p_larbig/wlan/ 17 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 18 | 19 | PKG_BUILD_PARALLEL:=1 20 | 21 | include $(INCLUDE_DIR)/package.mk 22 | 23 | define Package/mdk3 24 | SECTION:=net 25 | CATEGORY:=Network 26 | DEPENDS:=+libpthread 27 | TITLE:= MDK3 28 | URL:=http://homepages.tu-darmstadt.de/~p_larbig/wlan/ 29 | SUBMENU:=wireless 30 | endef 31 | 32 | define Package/mdk3/description 33 | Tool to exploit wireless vulnerabilities 34 | endef 35 | 36 | MAKE_FLAGS += \ 37 | $(TARGET_CONFIGURE_OPTS) 38 | 39 | define Package/mdk3/install 40 | $(INSTALL_DIR) $(1)/usr/sbin 41 | $(CP) $(PKG_BUILD_DIR)/mdk3 $(1)/usr/sbin/ 42 | endef 43 | 44 | $(eval $(call BuildPackage,mdk3)) 45 | -------------------------------------------------------------------------------- /network/mdk3/patches/001-radiotap_needs_types_h.patch: -------------------------------------------------------------------------------- 1 | --- a/osdep/radiotap/radiotap-parser.c 2 | +++ b/osdep/radiotap/radiotap-parser.c 3 | @@ -18,6 +18,7 @@ 4 | 5 | #include 6 | #include 7 | +#include 8 | 9 | #include "radiotap-parser.h" 10 | 11 | -------------------------------------------------------------------------------- /network/mdk3/patches/010-fix-dependencies.patch: -------------------------------------------------------------------------------- 1 | --- 2 | Makefile | 4 ++-- 3 | 1 file changed, 2 insertions(+), 2 deletions(-) 4 | 5 | --- a/Makefile 6 | +++ b/Makefile 7 | @@ -18,8 +18,8 @@ osd: 8 | $(LIBOSD): 9 | $(MAKE) -C $(OSD) 10 | 11 | -mdk3: mdk3.c $(OSD)/libosdep.a 12 | - $(CC) $(CFLAGS) $(LINKFLAGS) $^ -o $@ $(LIBS) 13 | +mdk3: $(LIBOSD) mdk3.c 14 | + $(CC) $(CFLAGS) $(LINKFLAGS) mdk3.c $(OSD)/lib$(OSD).a -o $@ $(LIBS) 15 | 16 | install: mdk3 17 | $(MAKE) -C $(OSD) install 18 | -------------------------------------------------------------------------------- /network/mdk3/patches/020-Makefile_honour_CFLAGS_for_VFP.patch: -------------------------------------------------------------------------------- 1 | --- a/Makefile 2 | +++ b/Makefile 3 | @@ -1,4 +1,4 @@ 4 | -CFLAGS = -g -O3 -Wall -Wextra 5 | +CFLAGS += -g -O3 -Wall -Wextra 6 | LINKFLAGS = -lpthread 7 | 8 | DESTDIR = 9 | -------------------------------------------------------------------------------- /network/ngrep/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2007-2010 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=ngrep 11 | PKG_VERSION:=1.45 12 | PKG_RELEASE:=3 13 | 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 15 | PKG_SOURCE_URL:=@SF/ngrep 16 | PKG_MD5SUM:=bc8150331601f3b869549c94866b4f1c 17 | 18 | PKG_INSTALL:=1 19 | 20 | include $(INCLUDE_DIR)/package.mk 21 | 22 | define Package/ngrep 23 | SECTION:=net 24 | CATEGORY:=Network 25 | DEPENDS:=+libpcap +libpcre 26 | TITLE:=network grep 27 | URL:=http://ngrep.sourceforge.net 28 | endef 29 | 30 | define Package/ngrep/description 31 | ngrep a pcap-aware tool that will allow you to specify extended 32 | regular expressions to match against data payloads of packets. It 33 | currently recognizes TCP, UDP, and ICMP across Ethernet, PPP, SLIP, 34 | FDDI, Token Ring and null interfaces, and understands BPF filter 35 | logic in the same fashion as more common packet sniffing tools, 36 | like tcpdump and snoop. 37 | endef 38 | 39 | CONFIGURE_ARGS+= \ 40 | --with-pcap-includes=$(STAGING_DIR)/usr/include \ 41 | --enable-pcre \ 42 | --with-pcre=$(STAGING_DIR)/usr \ 43 | --disable-dropprivs \ 44 | 45 | CONFIGURE_VARS+= \ 46 | LDFLAGS="$(TARGET_LDFLAGS) -lpcre" \ 47 | 48 | define Package/ngrep/install 49 | $(INSTALL_DIR) $(1)/usr/bin 50 | $(CP) $(PKG_INSTALL_DIR)/usr/bin/ngrep $(1)/usr/bin/ 51 | endef 52 | 53 | $(eval $(call BuildPackage,ngrep)) 54 | -------------------------------------------------------------------------------- /network/ngrep/patches/001-makefile_in.patch: -------------------------------------------------------------------------------- 1 | diff -u ngrep-1.45/Makefile.in ngrep-1.45.mod/Makefile.in 2 | --- ngrep-1.45/Makefile.in Tue Nov 28 15:35:37 2006 3 | +++ ngrep-1.45.mod/Makefile.in Sat May 19 10:40:57 2007 4 | @@ -32,13 +32,13 @@ 5 | 6 | INSTALL = ./install-sh 7 | 8 | -REGEX_DIR=@REGEX_DIR@ 9 | -REGEX_OBJS=@REGEX_OBJS@ 10 | +REGEX_DIR= 11 | +REGEX_OBJS= 12 | 13 | 14 | all: $(TARGET) 15 | 16 | -$(TARGET): $(REGEX_OBJS) $(OBJS) 17 | +$(TARGET): $(OBJS) 18 | $(CC) $(CFLAGS) $(LDFLAGS) $(STRIPFLAG) -o $(TARGET) $(OBJS) $(REGEX_OBJS) $(LIBS) 19 | 20 | debug: $(REGEX_OBJS) $(OBJS) -------------------------------------------------------------------------------- /network/ngrep/patches/001-ngrep.patch: -------------------------------------------------------------------------------- 1 | diff -ur ngrep-1.45/ngrep.c ngrep-1.45.mod/ngrep.c 2 | --- ngrep-1.45/ngrep.c Tue Nov 28 15:38:43 2006 3 | +++ ngrep-1.45.mod/ngrep.c Sat May 19 10:21:27 2007 4 | @@ -92,7 +92,7 @@ 5 | #endif 6 | 7 | #if USE_PCRE 8 | -#include "pcre-5.0/pcre.h" 9 | +#include "pcre.h" 10 | #else 11 | #include "regex-0.12/regex.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /network/p0f/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=p0f 4 | PKG_VERSION:=3.09b 5 | PKG_MAINTAINER:=Michal Zalewski 6 | 7 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz 8 | PKG_SOURCE_URL:=http://lcamtuf.coredump.cx/p0f3/releases/ 9 | PKG_HASH:=543b68638e739be5c3e818c3958c3b124ac0ccb8be62ba274b4241dbdec00e7f 10 | 11 | PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 12 | 13 | #PKG_INSTALL:=1 14 | 15 | include $(INCLUDE_DIR)/package.mk 16 | 17 | define Package/p0f 18 | SECTION:=net 19 | CATEGORY:=Network 20 | TITLE:=Passive TCP/IP stack fingerprinting tool 21 | DEPENDS:=+libpcap +libpthread 22 | URL:=http://lcamtuf.coredump.cx/p0f3/ 23 | MAINTAINER:=Michal Zalewski 24 | endef 25 | 26 | define Package/p0f/description 27 | p0f is a passive TCP/IP stack fingerprinting tool. p0f can attempt to identify the system running on 28 | machines that send network traffic to the box it is running on, or to a machine that shares a medium with 29 | the machine it is running on. p0f can also assist in analysing other aspects of the remote system. 30 | endef 31 | 32 | #TARGET_CFLAGS += -ggdb3 33 | 34 | #define Build/Prepare 35 | # mkdir -p $(PKG_BUILD_DIR) 36 | # $(CP) ./src/* $(PKG_BUILD_DIR)/ 37 | #endef 38 | 39 | 40 | define Package/p0f/install 41 | $(INSTALL_DIR) $(1)/usr/sbin/ 42 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/p0f $(1)/usr/sbin/ 43 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/p0f-client $(1)/usr/sbin/ 44 | $(INSTALL_DIR) $(1)/etc/p0f 45 | $(CP) $(PKG_BUILD_DIR)/p0f.fp $(1)/etc/p0f/ 46 | endef 47 | 48 | 49 | $(eval $(call BuildPackage,p0f)) 50 | -------------------------------------------------------------------------------- /network/p0f/patches/001-build.sh.patch: -------------------------------------------------------------------------------- 1 | --- a/build.sh 2 | +++ b/build.sh 3 | @@ -320,6 +320,8 @@ 4 | 5 | $CC $USE_CFLAGS $USE_LDFLAGS "$PROGNAME.c" $OBJFILES -o "$PROGNAME" $USE_LIBS &>"$TMP.log" 6 | 7 | +$CC $USE_CFLAGS tools/p0f-client.c -o p0f-client &>"$TMP.log" 8 | + 9 | if [ ! -x "$PROGNAME" ]; then 10 | 11 | echo "FAIL" 12 | -------------------------------------------------------------------------------- /network/reaver/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2012 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=reaver-wps-fork-t6x 11 | PKG_REV:=Big_endian 12 | PKG_VERSION:=$(PKG_REV) 13 | PKG_RELEASE:=1 14 | 15 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 16 | PKG_SOURCE_URL:=https://github.com/t6x/reaver-wps-fork-t6x.git 17 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 18 | PKG_SOURCE_VERSION:=$(PKG_REV) 19 | PKG_SOURCE_PROTO:=git 20 | 21 | include $(INCLUDE_DIR)/package.mk 22 | 23 | define Package/reaver 24 | SECTION:=net 25 | CATEGORY:=Network 26 | SUBMENU:=wireless 27 | TITLE:=Efficient online and offline brute force attack against Wifi Protected Setup 28 | URL:=https://github.com/t6x/reaver-wps-fork-t6x 29 | DEPENDS:=+libpcap +libsqlite3 30 | endef 31 | 32 | define Package/reaver/description 33 | Reaver targets the external registrar functionality mandated by the WiFi 34 | Protected Setup specification. 35 | Access points will provide authenticated registrars with their current 36 | wireless configuration (including the WPA PSK), and also accept a new 37 | configuration from the registrar. 38 | New implementations consist of the PixieDust attack and many more. 39 | endef 40 | 41 | CONFIGURE_PATH:=src 42 | 43 | MAKE_PATH:=src 44 | 45 | TARGET_CFLAGS+=$(TARGET_CPPFLAGS) 46 | 47 | define Package/reaver/install 48 | $(INSTALL_DIR) $(1)/usr/bin 49 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/{reaver,wash} $(1)/usr/bin/ 50 | $(INSTALL_DIR) $(1)/etc/reaver 51 | $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/reaver.db $(1)/etc/reaver/ 52 | endef 53 | 54 | $(eval $(call BuildPackage,reaver)) 55 | -------------------------------------------------------------------------------- /network/sslsplit/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016-2018 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=sslsplit 11 | PKG_VERSION:=0.5.5 12 | PKG_RELEASE:=1 13 | PKG_LICENSE:=BSD-2-Clause 14 | PKG_LICENSE_FILES:=LICENSE LICENSE.contrib LICENSE.third 15 | 16 | PKG_SOURCE:=sslsplit.tar.gz 17 | PKG_SOURCE_URL:=https://github.com/droe/sslsplit.git 18 | PKG_SOURCE_PROTO:=git 19 | PKG_SOURCE_VERSION:=0.5.5 20 | 21 | PKG_INSTALL:=1 22 | 23 | PKG_MAINTAINER:=Awais Chishti 24 | 25 | include $(INCLUDE_DIR)/package.mk 26 | 27 | define Package/sslsplit 28 | SECTION:=net 29 | CATEGORY:=Network 30 | DEPENDS:=+libevent2 +libopenssl +libevent2-openssl +libevent2-pthreads +libnet-1.2.x +libpcap +USE_MUSL:musl-fts 31 | TITLE:=Transparent SSL/TLS interception 32 | URL:=https://www.roe.ch/SSLsplit 33 | endef 34 | 35 | define Package/sslsplit/description 36 | Transparent SSL/TLS interception 37 | endef 38 | 39 | MAKE_FLAGS += prefix=/usr \ 40 | OSNAME=Linux 41 | 42 | define Package/sslsplit/install 43 | $(INSTALL_DIR) $(1)/bin 44 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/sslsplit $(1)/bin/ 45 | endef 46 | 47 | $(eval $(call BuildPackage,sslsplit)) 48 | -------------------------------------------------------------------------------- /network/sslsplit/patches/GNUmakefile.patch: -------------------------------------------------------------------------------- 1 | --- a/GNUmakefile 2 | +++ b/GNUmakefile 3 | @@ -79,7 +79,8 @@ 4 | ### Debugging 5 | 6 | # These flags are added to CFLAGS iff building from a git repo. 7 | -DEBUG_CFLAGS?= -g 8 | +# Disable to save space 9 | +#DEBUG_CFLAGS?= -g 10 | #DEBUG_CFLAGS+= -Werror 11 | 12 | # Define to remove false positives when debugging memory allocation. 13 | @@ -381,6 +382,8 @@ TPKG_CPPFLAGS+= -I$(CHECK_FOUND)/include 14 | TPKG_LDFLAGS+= -L$(CHECK_FOUND)/lib 15 | TPKG_LIBS+= -lcheck 16 | endif 17 | +# Additional flags for compilation with musl-fts 18 | +PKG_LIBS+= -lfts 19 | 20 | ifneq (,$(strip $(PKGS))) 21 | PKG_CFLAGS+= $(shell $(PKGCONFIG) $(PCFLAGS) --cflags-only-other $(PKGS)) 22 | @@ -402,8 +405,8 @@ CPPDEFS+= -D_GNU_SOURCE \ 23 | CPPCHECKFLAGS+= $(CPPDEFS) 24 | 25 | ifneq (ccc-analyzer,$(notdir $(CC))) 26 | -PKG_CPPFLAGS:= $(subst -I,-isystem,$(PKG_CPPFLAGS)) 27 | -TPKG_CPPFLAGS:= $(subst -I,-isystem,$(TPKG_CPPFLAGS)) 28 | +PKG_CPPFLAGS:= $(subst -I, ,$(PKG_CPPFLAGS)) 29 | +TPKG_CPPFLAGS:= $(subst -I, ,$(TPKG_CPPFLAGS)) 30 | endif 31 | 32 | CFLAGS+= $(PKG_CFLAGS) \ 33 | -------------------------------------------------------------------------------- /network/sslstrip/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2006-2010 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=sslstrip 11 | PKG_VERSION:=0.9 12 | PKG_RELEASE:=1 13 | 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 15 | PKG_SOURCE_URL:=http://www.moxie.org/software/sslstrip 16 | PKG_MD5SUM:=944020144e4f5528888b3dfbb107dd78 17 | 18 | include $(INCLUDE_DIR)/package.mk 19 | $(call include_mk, python-package.mk) 20 | 21 | define Package/sslstrip 22 | SECTION:=net 23 | CATEGORY:=Network 24 | TITLE:=sslstrip 25 | URL:=http://www.moxie.org/software/sslstrip/index.html 26 | DEPENDS:=+python +python-twisted +python-openssl 27 | endef 28 | 29 | define Package/sslstrip/description 30 | sslstrip will transparently hijack HTTP traffic on a network, 31 | watch for HTTPS links and redirects, then map those links 32 | into either look-alike HTTP links or homograph-similar HTTPS 33 | links. It also supports modes for supplying a favicon which 34 | looks like a lock icon, selective logging, and session denial. 35 | endef 36 | 37 | define Build/Compile 38 | $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr") 39 | endef 40 | 41 | define Package/sslstrip/install 42 | $(INSTALL_DIR) $(1)/usr/bin 43 | $(CP) $(PKG_BUILD_DIR)/sslstrip.py $(1)/usr/bin 44 | 45 | # $(INSTALL_DIR) $(1)/usr/share/sslstrip 46 | # $(CP) $(PKG_INSTALL_DIR)/usr/share/sslstrip/* $(1)/usr/share/sslstrip 47 | 48 | $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) 49 | $(CP) $(PKG_BUILD_DIR)/sslstrip/* $(1)$(PYTHON_PKG_DIR) 50 | endef 51 | 52 | $(eval $(call BuildPackage,sslstrip)) 53 | 54 | -------------------------------------------------------------------------------- /utils/at/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008-2014 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=at 11 | PKG_VERSION:=3.1.23 12 | PKG_RELEASE:=2 13 | 14 | PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz 15 | PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/a/at 16 | PKG_MD5SUM:=1cec945506b5ddf1d776c92c315fc581 17 | 18 | include $(INCLUDE_DIR)/package.mk 19 | 20 | define Package/at 21 | SECTION:=utils 22 | CATEGORY:=Utilities 23 | DEPENDS:=+libelf1 24 | TITLE:=Delayed job execution and batch processing 25 | URL:=http://packages.debian.org/stable/at 26 | MAINTAINER:=Luka Perkov 27 | endef 28 | 29 | define Package/at/description 30 | At and batch read shell commands from standard input storing them as a job to 31 | be scheduled for execution in the future. 32 | endef 33 | 34 | export SENDMAIL=/bin/true 35 | EXTRA_CFLAGS:=-DNEED_YYWRAP -I$(PKG_BUILD_DIR) \ 36 | $(TARGET_LDFLAGS) 37 | 38 | CONFIGURE_ARGS+=--prefix=/usr \ 39 | --with-daemon_username=nobody \ 40 | --with-daemon_groupname=nogroup \ 41 | --with-jobdir=/var/spool/cron/atjobs \ 42 | --with-atspool=/var/spool/cron/atspool 43 | 44 | CONFIGURE_VARS += \ 45 | ac_cv_header_security_pam_appl_h=no 46 | 47 | define Package/at/install 48 | $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/sbin $(1)/etc/init.d/ 49 | $(INSTALL_BIN) ./files/atd.init $(1)/etc/init.d/atd 50 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/at $(1)/usr/bin 51 | ln -sf at $(1)/usr/bin/atq 52 | ln -sf at $(1)/usr/bin/atrm 53 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/atd $(1)/usr/sbin 54 | endef 55 | 56 | $(eval $(call BuildPackage,at)) 57 | -------------------------------------------------------------------------------- /utils/at/files/atd.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2011 OpenWrt.org 3 | 4 | START=50 5 | 6 | SERVICE_USE_PID=1 7 | 8 | start() { 9 | [ -d /var/spool/cron/atjobs ] || { 10 | mkdir -m 0755 -p /var/spool/cron/atjobs 11 | touch /var/spool/cron/atjobs/.SEQ 12 | chown -R nobody:nogroup /var/spool/cron/atjobs 13 | } 14 | [ -d /var/spool/cron/atspool ] || { 15 | mkdir -m 0755 -p /var/spool/cron/atspool 16 | chown -R nobody:nogroup /var/spool/cron/atspool 17 | } 18 | service_start /usr/sbin/atd 19 | } 20 | 21 | stop() { 22 | service_stop /usr/sbin/atd 23 | } 24 | -------------------------------------------------------------------------------- /utils/at/patches/100-remove-glibc-assumption.patch: -------------------------------------------------------------------------------- 1 | From 7f811d9c4ebc9444e613e251c31d6bf537a24dc1 Mon Sep 17 00:00:00 2001 2 | From: Khem Raj 3 | Date: Mon, 13 Apr 2015 16:35:30 -0700 4 | Subject: [PATCH] remove glibc assumption 5 | 6 | glibc time.h header has an undocumented __isleap macro 7 | that we are using anf musl is missing it. 8 | Since it is undocumented & does not appear 9 | on any other libc, stop using it and just define the macro in 10 | locally instead. 11 | 12 | Upstream-Status: Pending 13 | 14 | Signed-off-by: Khem Raj 15 | [patch from: http://patchwork.openembedded.org/patch/91893/ ] 16 | Signed-off-by: Phil Eichinger 17 | --- 18 | parsetime.y | 11 +++++++---- 19 | 1 file changed, 7 insertions(+), 4 deletions(-) 20 | 21 | diff --git a/parsetime.y b/parsetime.y 22 | index 7005e88..324e6d3 100644 23 | --- a/parsetime.y 24 | +++ b/parsetime.y 25 | @@ -8,6 +8,9 @@ 26 | 27 | #define YYDEBUG 1 28 | 29 | +#define is_leap_year(y) \ 30 | + ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0)) 31 | + 32 | struct tm exectm; 33 | static int isgmt; 34 | static int yearspec; 35 | @@ -217,8 +220,8 @@ date : month_name day_number 36 | mnum == 12) && dnum > 31) 37 | || ((mnum == 4 || mnum == 6 || mnum == 9 || 38 | mnum == 11) && dnum > 30) 39 | - || (mnum == 2 && dnum > 29 && __isleap(ynum+1900)) 40 | - || (mnum == 2 && dnum > 28 && !__isleap(ynum+1900)) 41 | + || (mnum == 2 && dnum > 29 && is_leap_year(ynum+1900)) 42 | + || (mnum == 2 && dnum > 28 && !is_leap_year(ynum+1900)) 43 | ) 44 | { 45 | yyerror("Error in day of month"); 46 | @@ -261,8 +264,8 @@ date : month_name day_number 47 | mnum == 12) && dnum > 31) 48 | || ((mnum == 4 || mnum == 6 || mnum == 9 || 49 | mnum == 11) && dnum > 30) 50 | - || (mnum == 2 && dnum > 29 && __isleap(ynum+1900)) 51 | - || (mnum == 2 && dnum > 28 && !__isleap(ynum+1900)) 52 | + || (mnum == 2 && dnum > 29 && is_leap_year(ynum+1900)) 53 | + || (mnum == 2 && dnum > 28 && !is_leap_year(ynum+1900)) 54 | ) 55 | { 56 | yyerror("Error in day of month"); 57 | -- 58 | 2.1.4 59 | 60 | 61 | -------------------------------------------------------------------------------- /utils/at/patches/110-getloadavg.patch: -------------------------------------------------------------------------------- 1 | --- a/getloadavg.c 2 | +++ b/getloadavg.c 3 | @@ -69,8 +69,9 @@ Boston, MA 02110-1301 USA */ 4 | #include 5 | #endif 6 | 7 | -#include "lisp.h" 8 | -#include "sysfile.h" /* for encapsulated open, close, read, write */ 9 | +#include 10 | +#include 11 | +#include 12 | 13 | #ifndef HAVE_GETLOADAVG 14 | 15 | --------------------------------------------------------------------------------