Capture HTTPS traffic from Java applications with Fiddler

Fiddler usually works out of the box, with a few exceptions. One of those exceptions is capturing traffic from a JVM.

To capture plain HTTP traffic from a JVM, you can configure Fiddler as the proxy by setting these VM args:

-DproxySet=true
-DproxyHost=127.0.0.1
-DproxyPort=8888

[Note: Fiddler proxies at port 8888 by default]

Capturing HTTPS traffic (of course, to view it unencrypted in Fiddler), is slightly more involved. Here’s how to do that.

1. Export Fiddler’s Root Certificate

Click on Tools -> Fiddler Options… to open the Fiddler Options dialog.

Fiddler Options Menu

 

Switch to the HTTPS tab, and click on Export Root Certificate to Desktop.

Fiddler Options Dialog - HTTPS Tab

This will generate the file: FiddlerRoot.cer on your Desktop.

2. Create a JVM Keystore using this certificate

This step will require Administrator privileges (since keytool doesn’t seem to work without elevating privileges). So, open command prompt as Administrator, by right clicking on the Command Prompt icon, and clicking on Run as administrator.

Run the following command (replacing <JAVA_HOME> with absolute path to the JDK/JRE that you’re interested in capturing traffic from):

<JDK_Home>\bin\keytool.exe -import -file C:\Users\<Username>\Desktop\FiddlerRoot.cer -keystore FiddlerKeystore -alias Fiddler

This will prompt you to enter a password. Remember the password, as it’s required for the next step.

Once a password is entered, this’ll create a file called FiddlerKeyStore. Remember the path to this file, as we’ll be using it in the next step. You can, of course, move it to a more convenient location and use that path.

3. Start the JVM with Fiddler as the proxy, and the Keystore you just created as a Trust Store

Essentially, we’re asking the JVM to use Fiddler as the proxy, and to trust the keys in the Keystore we just created. Here’re the VM args to configure your Keystore as the Trust Store:

-Djavax.net.ssl.trustStore=<path\to\FiddlerKeystore>
-Djavax.net.ssl.trustStorePassword=<Keystore Password>

 

So, in effect, these are the VM args you’ll need:

-DproxySet=true
-DproxyHost=127.0.0.1
-DproxyPort=8888
-Djavax.net.ssl.trustStore=<path\to\FiddlerKeystore>
-Djavax.net.ssl.trustStorePassword=<Keystore Password>

That’s about it. Now, launch Fiddler, and launch your JVM (your Java application). Fiddler will start showing all HTTPS (and HTTP) traffic from the JVM in plaintext.

Setting up VM args in an IDE

If you’re using IntelliJ or Eclipse for development, you can set VM args in the Run Configuration dialogs. Here’s what they look like with the VM args populated:

Here’s the IntelliJ Run Configuration dialog with the VM args populated:

IntelliJ Run Configuration with VM args

 

And here’s the Eclipse Run Configuration dialog with the VM args populated:

Eclipse Run Configuration with VM args

 

[PS: This post is based on one of my SO answers: http://stackoverflow.com/questions/8549749/how-to-capture-https-with-fiddler-in-java/8588914#8588914]

Tabby – the missing tab switcher for eclipse

My job for the past few years primarily involved developing eclipse based applications, and so, I’ve had to use eclipse full-time for quite some time.  My pet peeve with eclipse has always been it’s usability. It’s not particularly keyboard friendly (not the same as having a gazillion keyboard shortcuts, which eclipse has plenty of), and the UI is just plain clunky. One thing that particularly annoyed me at some point was, not being able to conveniently switch between open tabs (editors, views), like you can with most other IDEs and text editors. Before you say it, I know there’s a Ctrl+F6 that brings up a quick switcher for editor tabs, but come on, it’s not even close to what I’d like it to be. And no, reassigning it to Ctrl+Tab just doesn’t cut it.

So, I went ahead and wrote tab switcher for eclipse sometime last year. Never really released it though, since there was always that one little feature I could add before it was “done”, and I never had the time for it. Regardless, I’ve been using it for some time, and it works just the way I like it. If you ever missed having a decent tab switcher for eclipse, try this one out.

Screenshot

Tabby Screenshot

Tabby Screenshot

Default Key Bindings

  • Ctrl+Tab – Cycles through the list of open editors and views
  • Ctrl+Shift+Tab – Cycles through the list of open editors and views, in reverse
  • Esc – Switches focus to the last active editor. Useful when you’re navigating through views and would like to quickly get back to editing.

Installation

The update site for the plugin is currently hosted at: http://dharampal.in/projects/tabby/updatesite

To install:

  • Open eclipse
  • Go to Help -> Install New Software…
  • Copy the update site URL and paste it in the dialog that shows up
  • Follow the dialog to finish installation

You can also download the update site as an archive from here: http://dharampal.in/projects/tabby/tabby-1.0.1.zip [30KB]

You can grab the sources from GitHub here: https://github.com/CodeMangler/Tabby