• author: IppSec

Customizing Your Hack the Box Paired Edition with Ansible: Part 3

In this video series, we are exploring how to customize Hack the Box Paired Edition with Ansible. In Part 3, we will focus on using Burp suite and Firefox to learn about the Jinja 2 templating language and how it can be applied to Ansible. By the end of this, you will have the knowledge to take your playbooks to the next level.

Using Jinja 2

Before diving into Burp suite and Firefox, it's important to understand Jinja 2. If you're familiar with templating through SSTI injections, you may already have some knowledge of Jinja 2. However, we will be using Jinja 2 legitimately in this context.

In our Playbook, we will create a task called "copying Please Subscribe J2." We will assign the ansible user ID as a variable. We can also create a list of variables, such as creating rev shells. We can then use a loop in Jinja 2 to create a comma-separated list of URLs.

Installing Firefox Extensions

To automate our Firefox install, we need to create a JSON file with our preferences and extensions. We will use a Jinja 2 template to populate our JSON file. First, we will create a list of Firefox extensions, such as dark reader and foxy proxy standard. We will then create a loop to print each item in the list and append a comma if it's not the last item. We will also add a URL to download the latest version of our extensions. Our Playbook will then use the JSON file to automate the Firefox install.

Customizing Firefox and Deploying Burp Suite

When it comes to web application testing, two essential tools are Firefox and Burp Suite. Firefox is a widely used browser that offers a lot of flexibility, and Burp Suite is a powerful platform for performing security testing. In this article, we will focus on customizing Firefox to meet specific requirements and deploying Burp Suite.

Customizing Firefox

Customizing Firefox involves adding specific extensions to meet one's needs. The extensions we will add in this article include Foxy Proxy, Dark Reader, and Wappalyzer.

Foxy Proxy

Foxy Proxy is an extension that allows users to manage and switch between multiple proxies quickly. To install it, we create a policy.json file and place it in the Firefox distribution folder, which can be done using the following steps:

  1. Open the main.yaml file and modify the destination to be user/share/firefox-esr/distribution.
  2. Add become: true to use the sudo command to run the Ansible playbook.
  3. Create a firefox.yaml file with the template for policy.json.
  4. Include the firefox.yaml file in main.yaml.
  5. Run the Ansible playbook using sudo ansible-playbook main.yaml.

Dark Reader

Another extension we will add is Dark Reader, which allows users to switch web pages to dark mode. To install it, we need to add it to the policy.json file created earlier and run the Ansible playbook again.


We will also add the Wappalyzer extension, which provides information on what technologies a website is using. The installation process for this extension is similar to that of Foxy Proxy and Dark Reader, wherein we need to add it to the policy.json file and run the Ansible playbook.

Deploying Burp Suite

To deploy Burp Suite, we will use a script called autoburp.py, which starts it up in headless mode to grab the CA certificate. This script will always respond "yes" to any prompts, including the license agreement. The steps to deploy Burp Suite are as follows:

  1. Download the autoburp.py script.
  2. Create a Bash script version of autoburp.py.
  3. Run the Bash script to start up Burp Suite in headless mode.
  4. Download the CA certificate from localhost:8080.

By customizing Firefox and deploying Burp Suite, we can create a powerful web application testing environment that meets our specific requirements.

Downloading and Using the Burp Suite SSL Certificate

When conducting web application penetration testing, Burp Suite is one of the must-have tools for security researchers. It allows for effective web traffic interception, analysis and modification.

To effectively intercept SSL traffic with Burp Suite, we need to download and install Burp's SSL certificate. In this section, we will discuss how to download and use the Burp Suite SSL certificate.

Starting Burp Suite in Headless Mode

First, we need to start Burp Suite in headless mode. This can be done by adding the following argument to the Burp Suite command: -Djava.awt.headless=true.

To automate this process, we can create a bash script that will start Burp Suite in headless mode. However, we need to make sure that Burp Suite has not been run before because it creates a user preference file that needs to be removed.

Downloading the Certificate

After starting Burp Suite in headless mode, we need to download the SSL certificate. This can be done by using the following cURL command:

curl http://localhost:8080/cert -o ca-cert.der

This command will download the certificate from http://localhost:8080/cert and save it as ca-cert.der in the current directory.

Copying the Certificate

Finally, we need to copy the downloaded certificate to the trusted CA certificate store on our system. In Linux, this can be done by copying the certificate file to /usr/local/share/ca-certificates/ directory and running the update-ca-certificates command.

To automate this step using Ansible, we can use the copy module and set the destination path to /usr/local/share/ca-certificates/.

By downloading and installing the Burp Suite SSL certificate, we can effectively intercept SSL traffic and analyze it using Burp Suite.

Automating Certificate Downloads with Ansible

In this article, we will discuss the process of automating the download and installation of certificates using Ansible. We will cover the steps involved in checking if the certificate already exists and downloading it only when required.

Downloading the certificate

The first step in automating the process of certificate installation is to download the required certificate. We start by creating a task to download the certificate. Here are the steps we take:

  1. Create a task to download the certificate using a URL.
  2. Add a when clause to the task, so that it only downloads the certificate if it does not already exist.
  3. Check if the certificate already exists by looking for the required files, namely, CA.der and earth directory.

After carrying out these steps, the task will only download the certificate when required and skip the process when it already exists.

Adding the certificate to Firefox

With the certificate downloaded, the next step is to configure Firefox to use it. Here are the steps we take:

  1. Create a template for Firefox settings.
  2. Add the required settings for the certificate according to the requirements.
  3. Run the playbook to configure Firefox.

With these steps, Firefox now has the required certificate installed and is configured to use it.

Configuring Burp Suite

The final step is to configure Burp Suite to use the certificate. Here are the steps we take:

  1. Set up a task to modify Burp Suite settings by adjusting font size and installing extensions.
  2. Create a template for the Burp Suite configuration using the J2 syntax.
  3. Create a variable to auto-load Jython and JRuby, which are required for Burp Suite extensions.
  4. Deploy the Burp Suite configuration using Ansible.

After carrying out these steps, Burp Suite will have the required certificate, and the configuration will be set up correctly.

Overall, automating the process of downloading and installing certificates using Ansible has numerous benefits, including reduced time and effort requirements and increased efficiency. With the steps outlined in this article, you can automate the process quickly and easily.

Building a Burp Suite Development Environment with Ansible

Are you looking to build a development environment for Burp Suite using Ansible? Look no further than this step-by-step guide on how to do just that.

Setting Up the Environment

First, we need to set up the environment variables that we'll be using. We'll need to create a folder to hold the main configuration, and then we'll need to establish some variables:

  • Create a main folder for the configuration. Navigate to Dev and then create the _build folder.
  • Establish environment variables:
    • For JRuby: use "extras_jars.Dot.jruby.jar".
    • For Jython: use "Burp_Suite_access_directory/extras_jars.Dot.jython.jar".
    • Set the extras directory to be at user/local/lib/burp suite.
    • Add SHA sums to ensure security.

Installing Dependencies

Next, let's install any dependencies that we might need. We do this by creating tasks for Ansible to perform. These tasks include:

  • Create the directory for burp_suite/extras.
  • Download the required JAR files.
  • Copy the template for Burp Suite Community Edition configuration.
  • Set up the Python environment for Jython and JRuby.

Troubleshooting and Testing

Of course, when setting up a development environment, we will need to troubleshoot and test our setup. Here are a few tips to help:

  • Should we encounter issues with Burp Suite downloading the certificate, try running the command again; it might be running in the background.
  • To ensure that Visual Studio Code gets installed, test from scratch.
  • To troubleshoot issues with a script download, establish a folder for the script then execute the script as a bash script.
  • Lastly, it's recommended to test Burp Suite to ensure that Jython and JRuby are installed correctly.

Setting up Burp Suite Certification with Ansible Playbook

When running Burp Suite on a new system, setting up the necessary certificates can be a tedious process. However, with Ansible Playbook, this task can be automated for a more efficient setup process.

Creating the bash script to download Burp Suite CA certificate

To begin setting up Burp Suite with Ansible Playbook, the first step is to create a bash script that will download the CA certificate. Here are the steps to create this script:

  1. Create a folder and files for the script. In this example, we will call it "get burp cert.sh".
  2. Copy and paste the following script into the file:
timeout 15
sleep 5
curl <burp-suite-certificate-download-url>
  1. Convert the file to a bash script.

Executing the bash script with Ansible Playbook

After creating the bash script to download the Burp Suite CA certificate, the next step is to execute it with Ansible Playbook. Here are the steps to execute the script:

  1. Create a new task for copying the Burp Suite script file from the local system to the target machine.
  2. Set the source as the "get burp cert.sh" file and the destination as "/tmp/get burp cert.sh".
  3. Change the permissions of the file to 744.
  4. Execute the script with "dev/shm/get burp cert.sh".

Fixing issues with the script and completing the setup process

While running the Ansible Playbook, there may be issues that arise with the bash script or setup process. Here are some tips for solving these issues:

  • Use Python instead of Ansible Playbook if there are difficulties with redirects and script execution.
  • Create a user preference directory to ensure the script has enough permissions to execute.
  • Kill the Java process to ensure a reliable execution of the script.
  • Increase the sleep time to at least 30 seconds to ensure a more reliable execution of the script.

By following these steps and tips, Burp Suite setup with Ansible Playbook can be a streamlined and efficient process, taking the hassle out of manually setting up the necessary certificates.By using jinja 2 and automating our firefox install, we can take our hack the box paired edition customization to the next level. with the knowledge gained in this video series, we can create more efficient and advanced playbooks in ansible.
With ansible and this step-by-step guide, building a burp suite development environment should be painless and straightforward. happy building!

Previous Post

"IPSec's HackTheBox Walkthrough: Escape"

Next Post

Customizing Parrot OS with Ansible: Installing Visual Studio Code and Plugins

About The auther

New Posts

Popular Post