Last active
October 2, 2024 18:16
-
-
Save dunderhay/d5fcded54cc88a1b7e12599839b6badb to your computer and use it in GitHub Desktop.
bash script to install evilginx3 on a ubuntu linux host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
GO_VERSION="1.22.3" | |
GO_URL="https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | |
EXPECTED_CHECKSUM="8920ea521bad8f6b7bc377b4824982e011c19af27df88a815e3586ea895f1b36" | |
# Log output of script | |
exec > >(tee -i /home/ubuntu/install.log) | |
exec 2>&1 | |
echo "Updating package manager and installing necessary packages..." | |
sudo apt update && sudo apt upgrade -y | |
sudo apt install -y git make | |
# Set home and cache directories | |
export HOME=/home/ubuntu | |
export GOCACHE=$HOME/.cache | |
if ! go version | grep -q "${GO_VERSION}" ; then | |
echo "Downloading and installing Go..." | |
# Download the Go binary | |
curl -OL ${GO_URL} | |
# Verify the checksum | |
ACTUAL_CHECKSUM=$(sha256sum go${GO_VERSION}.linux-amd64.tar.gz | awk '{print $1}') | |
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then | |
echo "Checksum verification failed. Aborting installation." | |
exit 1 | |
fi | |
# Remove existing Go installation if it exists | |
if [ -d "/usr/local/go" ]; then | |
sudo rm -rf /usr/local/go | |
fi | |
# Extract the tarball | |
sudo tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz | |
# Remove the downloaded tarball | |
rm go${GO_VERSION}.linux-amd64.tar.gz | |
echo "Setting up Go environment..." | |
# Add Go to the PATH environment variable for ubuntu user | |
if ! grep -q 'export PATH=$PATH:/usr/local/go/bin' /home/ubuntu/.profile ; then | |
echo "export PATH=\$PATH:/usr/local/go/bin" >> /home/ubuntu/.profile | |
fi | |
# Add Go to the PATH environment variable for current script | |
export PATH=$PATH:/usr/local/go/bin | |
else | |
echo "Go version ${GO_VERSION} already installed, skipping installation." | |
fi | |
echo "Enabling byobu..." | |
byobu-enable | |
echo "Modifying systemd-resolved configuration..." | |
sudo sed -i 's/#DNSStubListener=yes/DNSStubListener=no/' /etc/systemd/resolved.conf | |
sudo systemctl restart systemd-resolved | |
echo "Cloning evilginx repository..." | |
if [ ! -d "/home/ubuntu/src-evilginx" ]; then | |
git clone https://github.com/kgretzky/evilginx2 /home/ubuntu/src-evilginx | |
fi | |
echo "Removing evilginx indicator (X-Evilginx header)..." | |
sed -i 's/req.Header.Set(p.getHomeDir(), o_host)/\/\/req.Header.Set(p.getHomeDir(), o_host)/' /home/ubuntu/src-evilginx/core/http_proxy.go | |
echo "Building evilginx repository..." | |
cd /home/ubuntu/src-evilginx | |
go build | |
make | |
echo "Setting up evilginx directory..." | |
mkdir -p /home/ubuntu/evilginx | |
cp /home/ubuntu/src-evilginx/build/evilginx /home/ubuntu/evilginx/ | |
cd /home/ubuntu/evilginx | |
mkdir -p phishlets redirectors | |
echo "Setting permissions to allow evilginx to bind to privileged ports..." | |
sudo setcap CAP_NET_BIND_SERVICE=+eip evilginx | |
echo "Removing the src-evilginx directory" | |
rm -rf /home/ubuntu/src-evilginx | |
echo "Done" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice