lightbody / browsermob-proxy

A free utility to help web developers watch and manipulate network traffic from their AJAX applications.
http://bmp.lightbody.net
Apache License 2.0
2.13k stars 643 forks source link

HTTPS "not secure" with Chrome #799

Open PickHub opened 5 years ago

PickHub commented 5 years ago

When running the following code, everything works fine, except that left of the URL Chrome displays "Not Secure" on HTTPS sites. How do I get rid of that?

BrowserMobProxy proxy;
WebDriver driver;

proxy = new BrowserMobProxyServer();
proxy.start();

final Proxy seleniumProxy = ClientUtil.createSeleniumProxy( proxy );
final String hostIp = Inet4Address.getLocalHost().getHostAddress();
seleniumProxy.setHttpProxy( hostIp + ":" + proxy.getPort() );
seleniumProxy.setSslProxy( hostIp + ":" + proxy.getPort() );

final FirefoxOptions fOptions = new FirefoxOptions();
fOptions.setCapability( CapabilityType.PROXY, seleniumProxy );
driver = new FirefoxDriver( fOptions );

final Har har = proxy.newHar( "https://google.de/" );
driver.get( "https://google.de/" );

List<HarEntry> entries = proxy.getHar().getLog().getEntries();
for (int i = 0; i < entries.size(); i++) {
      System.out.println("Response status: " + entries.get(i).getResponse().getStatus());
}

final WebElement searchTextField = driver.findElement( By.name( "q" ) );
searchTextField.sendKeys( "foo" );
System.out.println( "### HAR after sendKeys: " + har );
searchTextField.submit();
System.out.println( "### HAR after submit: " + har );

proxy.stop();
driver.close();

I'm using ChromeDriver 2.44.609545 and browsermob-core 2.1.5.

andreabisello commented 5 years ago

have you tried fOption.setAcceptInsecureCerts(true) ?

PickHub commented 5 years ago

Yes, but the warning still appears.

endlesshh commented 4 years ago

ChromeOptions options = new ChromeOptions(); options.setCapability(CapabilityType.PROXY, seleniumProxy); options.addArguments("--ignore-certificate-errors");

--- this is chrome not FirefoxOptions , you can google

webloginwu commented 3 years ago

this python code works for me:

options = webdriver.ChromeOptions() options.add_extension('../lib/BlazeMeter.crx') options.add_argument('ignore-certificate-errors') options.add_argument("--proxy-server={0}".format(proxy.proxy)) #Configure chrome options driver = webdriver.Chrome("/opt/local/bin/chromedriver",options=options) proxy.new_har("frank")

zerowebcorp commented 2 years ago

You may need to import the CA root https://github.com/lightbody/browsermob-proxy#ssl-support

officemb commented 1 year ago

Silly question but where to import the certificate? With BrowserMob you get the by default the Impersonated Certificate LittleProxy MITM.

The validity period is correct but still the browser (when going to e.g. https://google.com) still mentions not secure

HiImHG commented 1 year ago

@officemb Go chrome://settings/security →【Advanced】→【Manage device certificates】→【Trusted Root Certification Authorities】→ 【import】