Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.

Commit

Permalink
Install experimental arm64 & arm32 powershell for Empire
Browse files Browse the repository at this point in the history
Let's download and install the experimental arm packages manually before
installing Empire.

We also have to set the following environmental variable

POWERSHELL_TELEMETRY_OPTOUT=1

in "/etc/profile.d/powershell.sh" & "/etc/bash.bashrc" to opt out of
Microsofts telemetry program (DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY
has been retired by MS)
  • Loading branch information
Re4son committed Feb 24, 2019
1 parent 657b1c6 commit 00cd426
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions nethunter-fs/stages/stage3
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,46 @@ dpkg-divert --remove --rename /usr/sbin/invoke-rc.d
EOF
# End of third-stage script

# Let's do a little bit of magic from outside the chroot
if [ "$build_size" = full ]; then
# We should run git clone outside chroot because it has issues with machine-code translation
git clone https://github.com/Proxmark/proxmark3.git "$rootfs/opt/proxmark3"
git clone https://github.com/adaptivethreat/Empire.git "$rootfs/opt/Empire"

# powershell for arm64 is not yet available in Microsofts repos so let's install it manually
if [ $build_arch == "arm64" ]; then
mkdir -p $rootfs/opt/microsoft/powershell
wget -P $rootfs/opt/microsoft/powershell https://github.com/PowerShell/PowerShell/releases/download/v6.2.0-preview.4/powershell-6.2.0-preview.4-linux-arm64.tar.gz
tar -xzf $rootfs/opt/microsoft/powershell/powershell-6.2.0-preview.4-linux-arm64.tar.gz -C $rootfs/opt/microsoft/powershell
rm $rootfs/opt/microsoft/powershell/powershell-6.2.0-preview.4-linux-arm64.tar.gz
fi
if [ $build_arch == "armhf" ]; then
mkdir -p $rootfs/opt/microsoft/powershell
wget -P $rootfs/opt/microsoft/powershell https://github.com/PowerShell/PowerShell/releases/download/v6.2.0-preview.4/powershell-6.2.0-preview.4-linux-arm32.tar.gz
tar -xzf $rootfs/opt/microsoft/powershell/powershell-6.2.0-preview.4-linux-arm32.tar.gz -C $rootfs/opt/microsoft/powershell
rm $rootfs/opt/microsoft/powershell/powershell-6.2.0-preview.4-linux-arm32.tar.gz
fi
# Microsoft no longer supports deletion of the file DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY to disable telemetry
# We have to set this environment variable instead
cat << EOF > "$rootfs/etc/profile.d/powershell.sh"
# Microsoft no longer supports deletion of the file DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY to disable telemetry
# We have to set this environment variable instead
export POWERSHELL_TELEMETRY_OPTOUT=1
EOF

cat << EOF >> "$rootfs/etc/bash.bashrc"
# Microsoft no longer supports deletion of the file DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY to disable telemetry
# We have to set this environment variable instead
export POWERSHELL_TELEMETRY_OPTOUT=1
EOF

# The installation of Empire will still throw a few errors in relation to not being able to install powershell and that it cannot disable telemetry but that is not
# to worry about anymore as we have taken care of it ourselves now

# End of doing a little magic from outside the chroot

cat << EOF >> "$rootfs/third-stage"
# Enable PHP in Apache
Expand All @@ -66,9 +101,9 @@ fi
if cd /opt/Empire/setup; then
# Lets patch install.sh to build xar for our target architecture
if [ $build_arch == "arm64" ]; then
sed "install.sh" -i -e "s/(cd xar-1.5.2 \&\& \./configure)/(cd xar-1.5.2 \&\& \./configure --build=armv8l-unkown-linux-gnu)/"
sed "install.sh" -i -e "s/(cd xar-1.5.2 \&\& \.\/configure)/(cd xar-1.5.2 \&\& \.\/configure --build=armv8l-unkown-linux-gnu)/"
elif [ $build_arch == "armhf" ]; then
sed "install.sh" -i -e "s/(cd xar-1.5.2 \&\& \./configure)/(cd xar-1.5.2 \&\& \./configure --build=armv7l-unkown-linux-gnu)/"
sed "install.sh" -i -e "s/(cd xar-1.5.2 \&\& \.\/configure)/(cd xar-1.5.2 \&\& \.\/configure --build=armv7l-unkown-linux-gnu)/"
fi
chmod +x install.sh
printf "\n" | ./install.sh
Expand Down

0 comments on commit 00cd426

Please sign in to comment.