Skip to content

Instantly share code, notes, and snippets.

@staaldraad
Last active June 6, 2018 14:20
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save staaldraad/510966898862fecce423 to your computer and use it in GitHub Desktop.
Save staaldraad/510966898862fecce423 to your computer and use it in GitHub Desktop.
Use Docker to run @sensepost Mana like a hipster

Pwning like a hipster

This uses the @sensepost MANA Toolkit found at Github/sensepost/mana

The docker container will allow you to run MANA attacks without having to install the toolkit on your local machine or firing up a Kali/Ubuntu VM. This is obviously not the ideal way of running the toolkit if you are going to be cracking passphrases on the fly.

Build the MANA image:

$ docker build -t mana .

Configure local environment

Ensure that the NetworkManager does not try and "manage" our Physical device (Alpha card ect.) On Fedora:

$ sudo vim /etc/NetworkManager/NetworkManager.conf

Your config should look something like this:

[main]
plugins=ifcfg-rh,keyfile
[keyfile]
unmanaged-devices=mac:00:11:22:33:44:00;mac:00:c0:ca:81:f3:8d;

The file should contain both the initial mac address (real address) and the one that will be assigned by MANA/macchanger

Then restart the NetworkManager service:

$ sudo service NetworkManager restart

Start the mana container

To start:

$ sudo docker run -i -t -p 53:53 --privileged --net=host mana /bin/bash

Now you can edit the /usr/share/mana-toolkit/run-mana/* scripts as usual. If you don't want the NetworkManager to interfere and control the upstream connection, simply stop the NetworkManager service OUTSIDE of the docker container.

privileged is required to interact with the wlan driver

use -p to pass through any ports required. From what I've seen it isn't required

Note:

This is also a nice way to run Metasploit, isolates it from your environment and you don't have to fight with ruby breaking other apps on your system. To build a Metasploit container, reuse the above Dockerfile, simply remove everything from RUN echo "[+] Installing Mana toolkit"

The following does the trick nicely:

$ docker run -i -t -p 4545:4545 -p 4546:4546 -p 4547:4547 -p 4548:4548 metasploit /bin/bash

# Mana-toolkit from @sensepost
#
# VERSION 0.1
FROM ubuntu
MAINTAINER Etienne Stalmans, etienne@sensepost.com
RUN apt-get update && apt-get install -y \
unzip \
wget \
rfkill \
iptables \
curl \
git
RUN apt-get install -y \
build-essential \
libreadline-dev \
libssl-dev \
libpq5 \
libpq-dev \
libreadline5 \
libsqlite3-dev \
libpcap-dev \
openjdk-7-jre \
autoconf \
postgresql \
zlib1g-dev \
libxml2-dev \
libxslt1-dev \
libyaml-dev \
zlib1g-dev
RUN echo "[+] Setting up Metasploit" && cd
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN curl -L https://get.rvm.io | bash -s stable
#RUN source /usr/local/rvm/scripts/rvm
RUN echo "source /usr/local/rvm/scripts/rvm" >> ~/.bashrc
ENV PATH /usr/local/rvm/bin:$PATH
RUN rvm install 2.1.5 && rvm use 2.1.5 --default
ENV PATH /usr/local/rvm/gems/ruby-2.1.5/bin:/usr/local/rvm/gems/ruby-2.1.5@global/bin:/usr/local/rvm/rubies/ruby-2.1.5/bin:/usr/local/rvm/bin/:$PATH
RUN gem install bundler
RUN cd /opt && mkdir metasploit && cd metasploit && git clone https://github.com/rapid7/metasploit-framework.git
RUN cd /opt/metasploit/metasploit-framework && bundle install && ./msfupdate
RUN echo "[+] Installing the Mana toolkit"
RUN cd ~ && git clone https://github.com/sensepost/mana.git
RUN apt-get install -y \
libnl-dev \
isc-dhcp-server \
tinyproxy \
libssl-dev \
apache2 \
macchanger \
python-dnspython \
python-pcapy \
dsniff \
stunnel4
RUN echo "deb http://http.kali.org/kali kali main non-free contrib" > /etc/apt/sources.list.d/mana-kali.list
RUN gpg --keyserver pgp.mit.edu --recv-keys ED444FF07D8D0BF6 && gpg --armor --export ED444FF07D8D0BF6 | apt-key add -
RUN apt-get update && apt-get install -y sslsplit python-scapy
RUN cp /etc/apparmor.d/usr.sbin.dhcpd /etc/apparmor.d/disable/
RUN cd ~/mana && make && make install
RUN echo "[+] set full msfconsole path, otherwise issues "
RUN cd /usr/share/mana-toolkit/run-mana && sed -i.bak 's/msfconsole/\/opt\/metasploit\/metasploit-framework\/msfconsole/' *
RUN echo "[+] All done, I think, run one of the run-mana/start-*.sh scripts now"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment