Firebreath 2.0 Instructions

244 views
Skip to first unread message

Hau5

unread,
Aug 22, 2017, 10:35:27 AM8/22/17
to firebreath-dev
I have struggled to do this since there is very little documentation so I decided to write up something short that can help people in the future. Here are the instructions to create a firebreath 2.0 plugin that works on firefox, chrome and IE:

Clone FireBreath 2.0 and then run git init command to update the boost module

Using cmd go to the direcotry that firebreath has been cloned in:
>cd FireBreath

Using cmd run the prep script for the visual studio that you have installed and the build you desire (64 bit is marked with x64 in the end of the name ie prep2013x64). I have visual studio 2013 with update 4 (Please note, visual studio 2013 without the update generates an error, you NEED to have the update for it to compile correctly):
> prep2013.cmd examples\EchoTestPlugin EchoPlugin

Open the project using EchoTestPlugin.sln

Hit the build button and wait. This takes a while to compile the first time you build it.

The first part to do is to is to register the npEchoTestPlugin.dll so that you can use it in internet explorer (without doing anything further) and in chrome and firefox by following the next steps.  All you need to do is head to the debug directory in cmd and then use the command "regsvr32 npEchoTestPlugin.dll" and you will get a message that you application has been successfuly register. You can now call the plugin from Internet explorer.

After you have built the dll you will need to register the two .json files (one for firefox and one for chrome). This step is essential and was one of the hardest things I had to figure out. Here are the two commands I used in cmd for this specific project:

For Chrome:

REG ADD "HKCU\Software\Google\Chrome\NativeMessagingHosts\org.firebreath.firewyrmhost" /ve /t REG_SZ /d "C:\Users\Administrator\FireBreath\EchoBuild\Debug\org.firebreath.firewyrmhost_chrome.json" /f

For FireFox

REG ADD "HKCU\Software\Mozilla\NativeMessagingHosts\org.firebreath.firewyrmhost" /ve /t REG_SZ /d "C:\Users\Administrator\FireBreath\EchoBuild\Debug\org.firebreath.firewyrmhost_mozilla.json" /f

A little explanation: Right after the ADD you only need to change the last part (org.firebreath.firewyrmhost) if you create a different plug in; This needs to be exactly like the the first part of the .json file name (org.firebreath.firewyrmhost_mozilla.json) to make things simple.  As for the last address before the /f, you will need to put the local location of the .json files on your pc.

Another VERY important minor modification you need to make the mozilla .json file (org.firebreath.firewyrmhost_mozilla.json)  that can be done before or after you register the file: You need to add id of the application in the allowed_extension, here is my file and you need to have yours the same as mine if you are trying to make the EchoPlugin work:

{
 "name": "org.firebreath.firewyrmhost",
 "description": "FireBreath FireWyrm Native Messaging Wyrmhole",
 "path": "C:/Users/Administrator/FireBreath/EchoBuild/Debug/FireWyrmNativeMessageHost.exe",
 "type": "stdio",
 "allowed_extensions": ["firewy...@firebreath.org"]
}

The format is very important here for the allowed_extensions, you need to first put the name of the plugin (firewyrmhost) then @ then the company (firebreath) and then the web extension (.org). To simplify things, you can look at the "name" section in the beginning and do it in reverse and just change the first . to @

    You need to do this because if you do not then the plugin in you install will not be able to call the c++ plugin         and you will get an error in the console that says: "host disconnected".

You will need to do a minor change to the manifest.json so that firefox add-on will install properly.  Inside you will find a line that says:

     "id": "",

You will need to change it to be exactly like you set the allowed_extensions in the org.firebreath.firewyrmhost_mozilla.json file so it will be like follows:

    "id": "firewy...@firebreath.org",

You will also need to change the "path" so that you point to the FireWyrmNativeMessageHost.exe in both the json files that are produced.

    **Side note: When trying to generate the project for 64bit, both the json files for mozella and firefox are not generated so     you will need to generate a 32 bit project and copy those files. They should work

You will now need to do a minor change to the background.js so that the firefox add on can work. Using an editor open background.js; a couple of lines down you will find this line:

    var mimeType = "<enter-mime-here>"; //ex: application/x-fbtestplugin

You will need to change it to the name of the app (in the case of the EchoPlugin it will be "application/x-echotestplugin" The new line will need to look like this:

    var mimeType = "application/x-echotestplugin";


Next you need to install the plugin into chrome. To do that you need to start chrome and go to "chrome://extensions/".

In chrome://extensions you need to first enable the "Developer mode" in the top right section.

After you have ticked that toggle you need to hit "Load unpacked extension" and head to the EchoBuild fold and select the NativeMessageExtension and press ok

The Plug in should now appear underneath. If you see an error that says "There were warnings when trying to install this extension: Unrecognized manifest key 'applications'."  do not worry as it will work regardless of it. I still havent figured out how to fix that but it didnt cause me any issues. You are now set on chrome and can run the Test.html that was posted by ... and here is the link...  (You need to click initialize plugin first) then try running the other buttons and inspect the results inside the console section in the "Inspect"

To install the addon into firefox run firefox and go to "about:debugging" and enable the "Enable add-on debugging" toggle. Then after you have enabled it, you will need click on "Load Temporary Add-on" and go the EchoBuild fold and select the NativeMessageExtension, you will find in there the background.js that you edited before. Select it and click ok. Then you should see the plug in installed in the Temporary Extension. Please note that this will install the add-on until you close firefox. So everytime you run firefox you will need to do that. This is not the case with chrome but you will be getting notifications to disable the debug in chrome.

You can now use the plugin in both chrome and firefox. Please note I have reached to the point were I can run the plugins in debug mode in both browsers. To run the plugin in release mode you need to do a couple of further steps which are described in firefox and chrome sites. I will do that soon but I havent done it. I am sure it will be an easy task as the hard part Tis now behind us.


Reply all
Reply to author
Forward
0 new messages