Docker is a useful tool in my toolbox. I especially recommend the remnux contributions by Lenny Zeltser. Recently I needed a VM with an Ubuntu guest OS to run docker instances of container but the issue was that the pull had to go through a authenticated proxy.
Docker has given this scenario thought and this is what I did:
sudo mkdir /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/http-proxy.conf
sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf
In this file you put:
[Service]
Environment="HTTP_PROXY=http://user:password@proxyserver:port/"
Flush the changes:
sudo systemctl daemon-reload
Test if it worked:
sudo systemctl show --property=Environment docker
This should result in the proxy you entered
Restart docker
sudo systemctl restart docker
Thursday, April 20, 2017
Thursday, April 6, 2017
Dockerized recon-ng
OSINT is very important in what I do and thus I've spent some time getting familiarized with recon-ng in the past. Since I like my toys as much as the next IT guy I decided to run it in a container so that I can spin it up exactly how I like it in every environment.
The dockerfile
# Based on ubuntu
FROM ubuntu:16.04
Maintainer Erik Vanderhasselt
# Set environment variables
ENV DEBIAN_FRONTEND noninteractive
# Set the mirror to the country mirror
RUN sed -i 's/archive/be.archive/g' /etc/apt/sources.list
# Upgrade Ubuntu
RUN apt-get update
RUN apt-get install -f
RUN apt-get dist-upgrade -y
# Set the timezone
# bug in ubuntu 16.04:
# https://bugs.launchpad.net/ubuntu/+source/tzdata/+bug/1554806
RUN ln -fs /usr/share/zoneinfo/Europe/Brussels /etc/localtime
RUN dpkg-reconfigure -f noninteractive tzdata
# installation of git
RUN apt-get install -y git
# Clone the recon-ng from bitbucket
RUN git clone https://bitbucket.org/LaNMaSteR53/recon-ng.git
# Remove git
RUN apt-get remove -y git
# installation of python and pip
RUN apt-get install -y python
RUN apt-get install -y python-pip
WORKDIR /recon-ng
RUN pip install -r REQUIREMENTS
# Cleaning up
RUN apt-get autoremove -y
RUN apt-get clean -y
# Execute recon-ng framework
ENTRYPOINT ["./recon-ng"]
I am spinning this container up in Belgium thus that is why the mirror is the be mirror. If you work in another country it might be a good idea to change the value. This will make the downloads a bit faster.
To make the build a bit easier I wrote a small build script
#! /bin/bash
# creation of the output directory and subdirectories
mkdir -p output
# build of the docker script
DATE=`date +%y%m%d%H%M%S`
sudo docker build -t recon-ng:$DATE -t recon-ng:latest .
And since spinning it up requires the -v to simplify the output I wrote a little script
#! /bin/bash
# create the variables
IMAGE='recon-ng'
PATH_RECON=`pwd`
# creation of the output directory
mkdir -p output
# run the build
sudo docker run --rm -it -v $PATH_RECON/output/:/root/.recon-ng/ $IMAGE
Finally while I as at it I wrote a little script to archive the result so that I am sure I don't mix databases while working on different projects in parallel.
#! /bin/bash
# archive the output directory
sudo tar cvf recon-ng.tar output/
# delete the output directory
sudo rm -Rf output/
The dockerfile
# Based on ubuntu
FROM ubuntu:16.04
Maintainer Erik Vanderhasselt
# Set environment variables
ENV DEBIAN_FRONTEND noninteractive
# Set the mirror to the country mirror
RUN sed -i 's/archive/be.archive/g' /etc/apt/sources.list
# Upgrade Ubuntu
RUN apt-get update
RUN apt-get install -f
RUN apt-get dist-upgrade -y
# Set the timezone
# bug in ubuntu 16.04:
# https://bugs.launchpad.net/ubuntu/+source/tzdata/+bug/1554806
RUN ln -fs /usr/share/zoneinfo/Europe/Brussels /etc/localtime
RUN dpkg-reconfigure -f noninteractive tzdata
# installation of git
RUN apt-get install -y git
# Clone the recon-ng from bitbucket
RUN git clone https://bitbucket.org/LaNMaSteR53/recon-ng.git
# Remove git
RUN apt-get remove -y git
# installation of python and pip
RUN apt-get install -y python
RUN apt-get install -y python-pip
WORKDIR /recon-ng
RUN pip install -r REQUIREMENTS
# Cleaning up
RUN apt-get autoremove -y
RUN apt-get clean -y
# Execute recon-ng framework
ENTRYPOINT ["./recon-ng"]
I am spinning this container up in Belgium thus that is why the mirror is the be mirror. If you work in another country it might be a good idea to change the value. This will make the downloads a bit faster.
To make the build a bit easier I wrote a small build script
#! /bin/bash
# creation of the output directory and subdirectories
mkdir -p output
# build of the docker script
DATE=`date +%y%m%d%H%M%S`
sudo docker build -t recon-ng:$DATE -t recon-ng:latest .
And since spinning it up requires the -v to simplify the output I wrote a little script
#! /bin/bash
# create the variables
IMAGE='recon-ng'
PATH_RECON=`pwd`
# creation of the output directory
mkdir -p output
# run the build
sudo docker run --rm -it -v $PATH_RECON/output/:/root/.recon-ng/ $IMAGE
Finally while I as at it I wrote a little script to archive the result so that I am sure I don't mix databases while working on different projects in parallel.
#! /bin/bash
# archive the output directory
sudo tar cvf recon-ng.tar output/
# delete the output directory
sudo rm -Rf output/
Subscribe to:
Posts (Atom)