# GoPhish Setup

## Installing GoPhish

```
## Installing go
----------------
apt-get update
apt-get install build-essential
wget https://golang.org/dl/go1.16.6.linux-amd64.tar.gz
tar xvf go1.16.6.linux-amd64.tar.gz
sudo chown -R root:root ./go
sudo mv go /usr/local

## Setting go paths
-------------------
sudo nano ~/.profile

## At the end of file write paste
export GOPATH=$HOME/work
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

## Refresh profile
source ~/.profile

## Install GoPhish
git clone https://github.com/gophish/gophish
cd gophish/
<Remove IOCs  X-Mailer from /gophish/models/smtp_test.go and 
rid from /gophish/models/campaign.go>
go build


Find a file named config.json change listen_url from 127.0.0.1:3333 to 0.0.0.0:3333


apt-get install certbot
certbot certonly -d phishdomain.tk --manual --preferred-challenges dns
<ADD the txt to the DNS server record in Cloud Flare>

Copy /etc/letsencrypt/live/[DOMIAN]/privkey.pem into a file like [DOMAIN].key 
and /etc/letsencrypt/live/[DOMAIN]/fullchain.pem into a file like [DOMAIN].crt

Then run 

sudo ./gophish

```

## Configure Evilginx2

```
A header by the name of evilginx gets added in case of a proxy request (/core/http_proxy.go

git clone https://github.com/kgretzky/evilginx2.git
cd evilginx2                                       
make           
sudo cp bin/evilginx /usr/bin
sudo cp -r phishlets/ /usr/share/evilginx/
sudo cp -r templates /usr/share/evilginx/

Next let us configure evilginx2 next and domain,IP and the redirect URL.

: config domain {domainname}
: config ip {server's ip}
: config redirect_url https://google.com
: phishlets hostname {phishlet's name} {domainname}

Next we need to check whether we need to set A or CNAME for any 
subdomains pertaining to the phishlet

: phishlets get-hosts linkedin
143.244.130.189 www.phishdomain.tk

So we create an A record for the subdomain

: phishlets enable linkedin
: lures create linkedin


```
