diff --git a/bootstrap.d/44-nexmon_monitor_patch.sh b/bootstrap.d/44-nexmon_monitor_patch.sh index 5563518..fba0076 100644 --- a/bootstrap.d/44-nexmon_monitor_patch.sh +++ b/bootstrap.d/44-nexmon_monitor_patch.sh @@ -5,45 +5,62 @@ # Load utility functions . ./functions.sh +if [ "$ENABLE_NEXMON" = true ] ; then + + # Create temporary directory for nexmon sources + temp_dir=$(as_nobody mktemp -d) + + # Fetch nexmon sources + as_nobody git -C "${temp_dir}" clone "${NEXMON_URL}" + + # Copy downloaded nexmon sources + mv "${temp_dir}/nexmon" "${R}"/tmp/ + + # Set permissions of the nexmon sources + chown -R root:root "${R}"/tmp/nexmon + + # Remove temporary directory for nexmon sources + rm -fr "${temp_dir}" +fi # Build nexmon firmware outside the build system, if we can. -cd "${basedir}" -git clone https://github.com/seemoo-lab/nexmon.git "${basedir}"/nexmon --depth 1 -cd "${basedir}"/nexmon +cd "${R}"/tmp/nexmon # Disable statistics touch DISABLE_STATISTICS +# Setup Enviroment source setup_env.sh -ls -lah /usr/lib/x86_64-linux-gnu/libl.a -ls -lah /usr/lib/x86_64-linux-gnu/libfl.a +# Make nexmon make + +# Make ancient isl build cd buildtools/isl-0.10 -CC=$CCgcc +CC="$CROSS_COMPILE" ./configure make -sed -i -e 's/all:.*/all: $(RAM_FILE)/g' ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/Makefile -sed -i -e 's/all:.*/all: $(RAM_FILE)/g' ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/Makefile + +# build patches cd ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon # Make sure we use the cross compiler to build the firmware. # We use the x86 cross compiler because we're building on amd64 -unset CROSS_COMPILE +#unset CROSS_COMPILE #export CROSS_COMPILE=${NEXMON_ROOT}/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- make clean # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. -LD_LIBRARY_PATH=${NEXMON_ROOT}/buildtools/isl-0.10/.libs make ARCH=arm CC=${NEXMON_ROOT}/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- +LD_LIBRARY_PATH=${NEXMON_ROOT}/buildtools/isl-0.10/.libs make ARCH=arm CC="$CROSS_COMPILE" cd ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon make clean -LD_LIBRARY_PATH=${NEXMON_ROOT}/buildtools/isl-0.10/.libs make ARCH=arm CC=${NEXMON_ROOT}/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- +LD_LIBRARY_PATH=${NEXMON_ROOT}/buildtools/isl-0.10/.libs make ARCH=arm CC="$CROSS_COMPILE" # RPi0w->3B firmware mkdir -p "${basedir}"/kali-${architecture}/lib/firmware/brcm cp ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43430-sdio.nexmon.bin cp ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43430-sdio.bin -wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43430-sdio.txt -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43430-sdio.txt +#wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43430-sdio.txt -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43430-sdio.txt # RPi3B+ firmware cp ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.nexmon.bin cp ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.bin -wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.txt -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.txt +#wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.txt -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.txt # Make a backup copy of the rpi firmware in case people don't want to use the nexmon firmware. # The firmware used on the RPi is not the same firmware that is in the firmware-brcm package which is why we do this. -wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43430-sdio.bin -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43430-sdio.rpi.bin -wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.bin -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.rpi.bin +#wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43430-sdio.bin -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43430-sdio.rpi.bin +#wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.bin -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.rpi.bin # This is required for any wifi to work on the RPi 3B+ -wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.clm_blob -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.clm_blob +#wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.clm_blob -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.clm_blob diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 68d0052..043f228 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -151,9 +151,9 @@ UBOOTSRC_DIR=${UBOOTSRC_DIR:=""} ENABLE_UBOOTUSB=${ENABLE_UBOOTUSB=false} ENABLE_FBTURBO=${ENABLE_FBTURBO:=false} ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=false} +ENABLE_NEXMON=${ENABLE_NEXMON:="false"} VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""} FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""} -ENABLE_NEXMON=${ENABLE_NEXMON:=""} NEXMON_DIR=${NEXMON_DIR:=""} ENABLE_HARDNET=${ENABLE_HARDNET:=false} ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}