I've got LEDE router and I need demonstrate on him the Man-In-The-Middle attack (for university purpose).
Especially following type of attacks:
karma
evil twin
spoofhost
For these reason I’ve been decide use the ettercap program. But this program is not available in LEDE Package table. Although I found some source code for LEDE on gitlab - link. But I have no idea how to assembly. When I tried simply download git repository and build using make I getting following error:
ku@LEDE:~/openwrt-packages-master/net/ettercap$ make
Makefile:23: /nls.mk: No such file or directory
make: *** No rule to make target '/nls.mk'. Stop.
ku@LEDE:~/openwrt-packages-master/net/ettercap$
I've already read documentation on LEDE project but still don't know how to proceed. Can you please give me hint how to begin ?
I think the Makefile is meant to be used when cross-compiling on a Linux host, not on LEDE. In which case it may be enough to use the SDK instead of the complete LEDE tree.
Most routers lack the RAM and CPU power necessary to compile natively. Thus it is almost always done on a PC. I'm not sure about the SDK. I would set up the complete buildroot on a Linux PC, and be sure it works (build for your model).
Then add an ettercap directory in the /feeds/packages/net directory, and copy the Makefile and patches directory into it. Run make menuconfig and hit / to search for ettercap (should be under Network). Select it as a module and re-make.
If successful, locate the .ipk file in the bin/packages directory and scp it to your router and install with opkg. It has several dependencies which need to be installed first. You should be able to get those the usual way from the server rather than build yourself.
Since this project is several years old, it may not make without some changes.
I've downloaded the SDK and copy an ettercap folder from gitlab to SDK to /feeds/packages path. But during compilation get an error that is missing "libnet-1.1.x" library. I found this library in the gitlab repository in libs folder. So I've copy to SDK folder to feeds/packages/libs/ and install.
But in compile failure.
[kucabpet@virtual openwrt-sdk-ramips-mt762]$ make -j9
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'r8169-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'e100-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'bnx2-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'ar3k-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'mwifiex-sdio-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'kmod-phy-bcm-ns-usb2', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'edgeport-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'kmod-phy-bcm-ns-usb3', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'prism54-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'rtl8192su-firmware', which does not exist
tmp/.config-package.in:36:warning: ignoring type redefinition of 'PACKAGE_libc' from 'boolean' to 'tristate'
tmp/.config-package.in:64:warning: ignoring type redefinition of 'PACKAGE_libgcc' from 'boolean' to 'tristate'
tmp/.config-package.in:149:warning: ignoring type redefinition of 'PACKAGE_libpthread' from 'boolean' to 'tristate'
#
# configuration written to .config
#
make[1] world
make[2] package/compile
make[3] -C package/linux compile
make[3] -C package/toolchain compile
make[3] -C feeds/base/package/libs/ncurses host-compile
make[3] -C feeds/base/package/libs/zlib compile
make[3] -C feeds/packages/libs/pcre compile
make[3] -C feeds/base/package/libs/libpcap compile
make[3] -C feeds/base/package/libs/libtool compile
make[3] -C feeds/base/package/libs/openssl compile
make[3] -C feeds/base/package/libs/libiconv compile
make[3] -C feeds/base/package/libs/gettext compile
make[3] -C feeds/packages/libs/libnet-1.1.x compile
make[3] -C feeds/base/package/libs/ncurses compile
make -r world: build failed. Please re-run make with -j1 V=s to see what's going on
make: *** [world] Error 1
After re-run with more details information:
[kucabpet@virtual openwrt-sdk-ramips-mt762]$ make -j1 V=s
make[5]: Entering directory `/home/kucabpet/openwrt-sdk-ramips-mt762/build_dir/target-mipsel_24kc_musl/libnet/src'
/bin/sh ../libtool --tag=CC --mode=compile ccache_cc -DHAVE_CONFIG_H -I. -I../include -I/home/kucabpet/openwrt-sdk-ramips-mt762/staging_dir/target-mipsel_24kc_musl/usr/include -I/home/kucabpet/openwrt-sdk-ramips-mt762/staging_dir/target-mipsel_24kc_musl/include -I/home/kucabpet/openwrt-sdk-ramips-mt762/staging_dir/toolchain-mipsel_24kc_gcc-5.5.0_musl/usr/include -I/home/kucabpet/openwrt-sdk-ramips-mt762/staging_dir/toolchain-mipsel_24kc_gcc-5.5.0_musl/include/fortify -I/home/kucabpet/openwrt-sdk-ramips-mt762/staging_dir/toolchain-mipsel_24kc_gcc-5.5.0_musl/include -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -iremap/home/kucabpet/openwrt-sdk-ramips-mt762/build_dir/target-mipsel_24kc_musl/libnet:libnet -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -Wall -c -o libnet_init.lo libnet_init.c
OpenWrt-libtool: compile: ccache_cc -DHAVE_CONFIG_H -I. -I../include -I/home/kucabpet/openwrt-sdk-ramips-mt762/staging_dir/target-mipsel_24kc_musl/usr/include -I/home/kucabpet/openwrt-sdk-ramips-mt762/staging_dir/target-mipsel_24kc_musl/include -I/home/kucabpet/openwrt-sdk-ramips-mt762/staging_dir/toolchain-mipsel_24kc_gcc-5.5.0_musl/usr/include -I/home/kucabpet/openwrt-sdk-ramips-mt762/staging_dir/toolchain-mipsel_24kc_gcc-5.5.0_musl/include/fortify -I/home/kucabpet/openwrt-sdk-ramips-mt762/staging_dir/toolchain-mipsel_24kc_gcc-5.5.0_musl/include -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -iremap/home/kucabpet/openwrt-sdk-ramips-mt762/build_dir/target-mipsel_24kc_musl/libnet:libnet -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -Wall -c libnet_init.c -fPIC -DPIC -o .libs/libnet_init.o
libnet_init.c: In function 'libnet_init':
libnet_init.c:88:55: error: format not a string literal and no format arguments [-Werror=format-security]
snprintf(err_buf, LIBNET_ERRBUF_SIZE, l->err_buf);
^
libnet_init.c:88:55: error: format not a string literal and no format arguments [-Werror=format-security]
libnet_init.c:93:55: error: format not a string literal and no format arguments [-Werror=format-security]
snprintf(err_buf, LIBNET_ERRBUF_SIZE, l->err_buf);
^
libnet_init.c:93:55: error: format not a string literal and no format arguments [-Werror=format-security]
libnet_init.c:101:55: error: format not a string literal and no format arguments [-Werror=format-security]
snprintf(err_buf, LIBNET_ERRBUF_SIZE, l->err_buf);
^
libnet_init.c:101:55: error: format not a string literal and no format arguments [-Werror=format-security]
libnet_init.c:109:55: error: format not a string literal and no format arguments [-Werror=format-security]
snprintf(err_buf, LIBNET_ERRBUF_SIZE, l->err_buf);
^
libnet_init.c:109:55: error: format not a string literal and no format arguments [-Werror=format-security]
libnet_init.c: In function 'libnet_getdevice':
libnet_init.c:203:12: warning: pointer targets in return differ in signedness [-Wpointer-sign]
return (l->device);
^
libnet_init.c: In function 'libnet_init':
libnet_init.c:80:13: warning: array subscript is above array bounds [-Warray-bounds]
l->label[sizeof(l->label)] = '\0';
^
cc1: some warnings being treated as errors
make[5]: *** [libnet_init.lo] Error 1
make[5]: Leaving directory `/home/kucabpet/openwrt-sdk-ramips-mt762/build_dir/target-mipsel_24kc_musl/libnet/src'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/home/kucabpet/openwrt-sdk-ramips-mt762/build_dir/target-mipsel_24kc_musl/libnet'
make[3]: *** [/home/kucabpet/openwrt-sdk-ramips-mt762/build_dir/target-mipsel_24kc_musl/libnet/.built] Error 2
make[3]: Leaving directory `/home/kucabpet/openwrt-sdk-ramips-mt762/feeds/packages/libs/libnet-1.1.x'
make[2]: *** [package/feeds/packages/libnet-1.1.x/compile] Error 2
make[2]: Leaving directory `/home/kucabpet/openwrt-sdk-ramips-mt762'
make[1]: *** [/home/kucabpet/openwrt-sdk-ramips-mt762/staging_dir/target-mipsel_24kc_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory `/home/kucabpet/openwrt-sdk-ramips-mt762'
make: *** [world] Error 2
Maybe you can use libnet-1.2.x which is available in the feeds. (./scripts/feeds update; ./scripts/feeds install libnet-1.2.x) I tried to compile but I got errors in ettercap:
In file included from wdg.c:23:0:
./wdg.h:189:4: error: unknown type name 'u_char'
u_char screen_color;
^
./wdg.h:190:4: error: unknown type name 'u_char'
u_char border_color;
^
./wdg.h:191:4: error: unknown type name 'u_char'
u_char focus_color;
^
./wdg.h:192:4: error: unknown type name 'u_char'
u_char title_color;
^
./wdg.h:193:4: error: unknown type name 'u_char'
u_char window_color;
^
./wdg.h:194:4: error: unknown type name 'u_char'
u_char select_color;
^
./wdg.h:304:28: error: unknown type name 'u_char'
extern void wdg_init_color(u_char pair, u_char fg, u_char bg);
^
./wdg.h:304:41: error: unknown type name 'u_char'
extern void wdg_init_color(u_char pair, u_char fg, u_char bg);
^
./wdg.h:304:52: error: unknown type name 'u_char'
extern void wdg_init_color(u_char pair, u_char fg, u_char bg);
^
./wdg.h:305:51: error: unknown type name 'u_char'
extern void wdg_set_color(wdg_t *wo, size_t part, u_char pair);
^
./wdg.h:312:30: error: unknown type name 'u_char'
extern void wdg_screen_color(u_char pair);
^
wdg.c:81:21: error: unknown type name 'u_char'
void wdg_init_color(u_char pair, u_char fg, u_char bg);
^
wdg.c:81:34: error: unknown type name 'u_char'
void wdg_init_color(u_char pair, u_char fg, u_char bg);
^
wdg.c:81:45: error: unknown type name 'u_char'
void wdg_init_color(u_char pair, u_char fg, u_char bg);
^
wdg.c:82:44: error: unknown type name 'u_char'
void wdg_set_color(wdg_t *wo, size_t part, u_char pair);
^
wdg.c:83:23: error: unknown type name 'u_char'
void wdg_screen_color(u_char pair);
^
wdg.c:756:44: error: unknown type name 'u_char'
void wdg_set_color(wdg_t *wo, size_t part, u_char pair)
^
wdg.c:783:21: error: unknown type name 'u_char'
void wdg_init_color(u_char pair, u_char fg, u_char bg)
^
wdg.c:783:34: error: unknown type name 'u_char'
void wdg_init_color(u_char pair, u_char fg, u_char bg)
^
wdg.c:783:45: error: unknown type name 'u_char'
void wdg_init_color(u_char pair, u_char fg, u_char bg)
^
wdg.c:791:23: error: unknown type name 'u_char'
void wdg_screen_color(u_char pair)
^
Makefile:387: recipe for target 'libwdg_a-wdg.o' failed
I used the following diff:
diff --git a/net/ettercap/Makefile b/net/ettercap/Makefile
index 92b06e1..ef2fefc 100644
--- a/net/ettercap/Makefile
+++ b/net/ettercap/Makefile
@@ -25,7 +25,7 @@ include $(INCLUDE_DIR)/nls.mk
define Package/ettercap
SECTION:=net
CATEGORY:=Network
- DEPENDS:=+libpcap +libnet1 +libopenssl +libpcre +libncurses +libltdl +libpthread +zlib
+ DEPENDS:=+libpcap +libnet-1.2.x +libopenssl +libpcre +libncurses +libltdl +libpthread +zlib
TITLE:=Ettercap is a suite for man in the middle attacks on LAN.
URL:=http://ettercap.sourceforge.net
endef
@@ -49,10 +49,9 @@ endef
CONFIGURE_ARGS += \
--with-libpcap="$(STAGING_DIR)/usr" \
- --with-libnet="$(STAGING_DIR)/usr/lib/libnet-1.1.x" \
+ --with-libnet="$(STAGING_DIR)/usr/lib/libnet-1.2.x" \
--with-openssl="$(STAGING_DIR)/usr" \
--with-libpcre="$(STAGING_DIR)/usr" \
- --with-iconv="$(ICONV_PREFIX)" \
--with-libncurses="$(STAGING_DIR)/usr" \
--disable-gtk \
--disable-debug \
`
Ok, I think that I fixed your issue by adding typedef unsigned char u_char; declaration to file: build_dir/target-mipsel_24kc_musl-1.1.16/ettercap-NG-0.7.3/include/config.h
An ettercap compilation then continued and seems like an assembled, but test in the end fail for some reason: