From 3824dbb47c8eecd245cacc0aba0ef84bad47b42c Mon Sep 17 00:00:00 2001 From: Patrick Neumann Date: Mon, 6 Aug 2018 13:14:40 +0200 Subject: [PATCH] static dropbear for live digital forensics --- build_static_dropbear | 65 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 build_static_dropbear diff --git a/build_static_dropbear b/build_static_dropbear new file mode 100755 index 0000000..fc058cf --- /dev/null +++ b/build_static_dropbear @@ -0,0 +1,65 @@ +#!/bin/bash + +# Usage: ./build_static_dropbear +# or +# bash build_static_dropbear +# Description: Download newest stable dropbear release and +# compiles static binaries (client, server and scp) +# Author: Patrick Neumann (patrick@neumannsland.de) +# Platform: Debian or Raspbian GNU/Linux (tested: 9.5) +# Version: 1.0 +# Date: 06.07.2018 +# License: GPL3 +# Warranty: This program is distributed WITHOUT ANY WARRANTY + +# autodetect arch: +ARCH="$( /bin/uname --machine )" + +# autodetect release or do it manualy: +RELEASE="$( /usr/bin/curl --silent https://matt.ucc.asn.au/dropbear/dropbear.html \ + | /bin/grep --extended-regexp "Latest is [[:digit:]]{4}\.[[:digit:]]{1,3}" \ + | /bin/grep --extended-regexp --only-matching "[[:digit:]]{4}\.[[:digit:]]{1,3}" )" +#RELEASE="2018.76" +/usr/bin/test -n "${RELEASE}" || ( echo "Release detection failed - please edit script manually" ; exit 1 ) + +# dependencies (static libs): +if [ ! -f /usr/share/build-essential/list ] ; then /usr/bin/sudo /usr/bin/apt install build-essential --assume-yes ; fi +if [ ! -f /usr/lib/*-linux-gnu*/libc.a ] ; then /usr/bin/sudo /usr/bin/apt install libc6-dev --assume-yes ; fi +if [ ! -f /usr/lib/*-linux-gnu*/zlib.a ] ; then /usr/bin/sudo /usr/bin/apt install zlib1g-dev --assume-yes ; fi + +# downloading... +/usr/bin/wget https://matt.ucc.asn.au/dropbear/releases/dropbear-${RELEASE}.tar.bz2 + +# extracting... +/bin/tar xjf dropbear-${RELEASE}.tar.bz2 + +# compiling and stripping... +cd dropbear-${RELEASE} +./configure --enable-static \ + --disable-syslog \ + --disable-lastlog \ + --disable-utmp \ + --disable-utmpx \ + --disable-wtmp \ + --disable-wtmpx +/usr/bin/make PROGRAMS="dropbear dbclient scp" +/usr/bin/make strip + +# rename binary: +BINARY1="dbclient-${ARCH}-${RELEASE}" +/bin/mv dbclient "${BINARY1}" +BINARY2="scp-${ARCH}-${RELEASE}" +/bin/mv scp "${BINARY2}" +BINARY3="dropbear-${ARCH}-${RELEASE}" +/bin/mv dropbear "${BINARY3}" + +# final instructions: +echo +echo "Ready to copy:" +echo +echo " cp $PWD/${BINARY1} /media/POLICE/" +echo " cp $PWD/${BINARY2} /media/POLICE/" +echo " cp $PWD/${BINARY3} /media/POLICE/" +echo + +exit 0