Dockerizing EmailHarvester

I was just hanging out on a Saturday night and I stumbled onto this tool called EmailHarvester. It runs on Python 3 and I still use Python 2.7 and didn’t want to deal with virutualenv and whatnot. I decided it might be a good time to learn how to Dockerize tools. This is nothing mind blowing or new but I haven’t done this before.

Creating the Dockerfile

First thing that needs to be done is to build a Dockerfile that will used to build the image:

Here is the break down line by line:

  1. Grabs the Docker image for Python3
  2. Adds the folder containing EmailHarvester
  3. Runs a command. In this case it was necessary to install the dependencies of the tool
  4. Tells the docker image what to do when ran

The important point was that I used ENTRYPOINT and not CMD. When you use ENTRYPOINT it allows you to pass arguments which I will show later in the article

For more information the documentation can be found here

Building the Docker image

To build the image runĀ  the following command:

docker build -t emailharvester .

Additionally you can add a label to the name (-t) by doing name:label. If you don’t add a label the default will be “latest”.

For more information the documentation can be found here

Running the Docker image

To run the Docker image do the following:

$ docker run -it emailharvester -d domain.com
[+] User-Agent in use: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1
[+] Searching everywhere
[+] Searching in ASK: 10 results
[+] Searching in ASK: 20 results
[+] Searching in ASK: 30 results
[+] Searching in ASK: 40 results
[+] Searching in ASK: 50 results

This runs the docker image in interactive mode and takes everything after the image name as an argument.

For more information the documentation can be found here

Conclusion

So there you go a Dockerized tool. This makes it really easy to deal with dependencies. For example you can send the image to a friend and they can run it with ease as long as they have Docker. It doesn’t matter what kind of system they are running. I think all tools should come with a Dockerfile to deal with dependency issues.

PentesterLab Pro Review

Recently I started a new job where a portion of my work was related to Application Security. I have done a number of web application assessments before, however it has always been my weakest area. I have read most of the usual web application testing resources which you can find listedĀ here. I have also submitted to bug bounty programs, so the only material I felt I could benefit from were labs. I needed something hands-on that covered a wide range of web vulnerabilities and real world web exploit scenarios.

PentesterLab is a set of exercises downloaded as ISO’s which include course material that can be worked through to expand one’s skillset. I personally started with the free material and even used the ISO’s to create tools. After completing a number of the ISO’s, I noticed some very intriguing material was released for the Pro edition. I decided that getting the Pro subscription was more than worth it, so I signed up.

Navigating the Site

Once I logged in, I was greeted with a straightforward interface and a clear path to further develop my skillset. I started with the Introduction Badge which familiarized me to the scoring system and a few web fundamentals. Much of the material wasn’t new to me, but it is an excellent building block for anyone new to web application penetration testing:

Essentials Badge

The Essentials Badge section is where I really started to improve my skills. This section contains 60 exercises covering the following topics:

  • Authorization issues
  • Code Execution
  • Command Execution
  • Directory Traversal
  • File Includes
  • LDAP Injection
  • MongoDB issues
  • Open Redirection
  • SQL Injection
  • SSRF [Server Side Request Forgery]
  • SSTI [Server Side Template Injection]
  • File Upload Vulnerabilites
  • XML Injection
  • XSS [Cross Side Scripting]

Anybody who does web application testing will tell you that this list of exercises is a great foundation for moving into web application penetration testing or just improving your bug hunting skills. By moving through these exercises, I was able to increase my understanding of web technologies, increase my ability to use tooling to solve challenges, and also get hands-on experience with a plethora of vulnerability types.

All of these exercises can be found in the Essentials Badge section and are are tracked and hosted online, which makes them accessible everywhere. I was able to login effortlessly at home or work to complete challenges:

Certificates of Completion

When you complete these challenges, you are issued a certificate of completion. These are both a nice trophy for yourself and something you can show to potential or current employers. These certificates are easily accessible in your account at all times:

After working through these exercises, you build a strong foundation to move on to the other exercises. These are longer, more challenging exercises that contain real-world exploit scenarios. These are ranked by difficulty, so you can guide your own learning and gradually build up your skills. New exercises are added frequently, making this a modern and challenging experience. Small hang ups can teach you the little details that are necessary in testing web apps.

A list of exercises can be found here

Final Thoughts

Overall, PentesterLab Pro is a great experience. I recently completed the Essentials Badge along with a few of the longer exercises. This has taught me quite a bit already. I can also say that I have used some of these techniques in my daily work. The price is also very reasonable compared to other training. If you want additional details about getting Pro you can go here