net.continuumsecurity.web.drivers.BurpFirefoxDriver.java Source code

Java tutorial

Introduction

Here is the source code for net.continuumsecurity.web.drivers.BurpFirefoxDriver.java

Source

/*******************************************************************************
 *    BDD-Security, application security testing framework
 * 
 * Copyright (C) `2012 Stephen de Vries`
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see `<http://www.gnu.org/licenses/>`.
 ******************************************************************************/
package net.continuumsecurity.web.drivers;

import net.continuumsecurity.Config;

import org.openqa.selenium.Proxy;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;

public class BurpFirefoxDriver extends FirefoxDriverFacade implements BurpDriver {

    public BurpFirefoxDriver() {
        log.debug("Constructing BurpFirefoxDriver");
        //DesiredCapabilities capabilities = new DesiredCapabilities();
        //capabilities.setCapability(CapabilityType.PROXY, getBurpProxy());
        FirefoxProfile ffProfile = new FirefoxProfile();
        ffProfile.setPreference("permissions.default.image", 2);
        ffProfile.setProxyPreferences(getBurpProxy());
        ffDriver = new FirefoxDriver(ffProfile);
    }

    public Proxy getBurpProxy() {
        Proxy proxy = new Proxy();
        proxy.setProxyType(Proxy.ProxyType.MANUAL);
        String proxyStr = String.format("%s:%d", Config.getBurpHost(), Config.getBurpPort());
        proxy.setHttpProxy(proxyStr);
        proxy.setSslProxy(proxyStr);

        return proxy;
    }

}