How do I directly modify a Google Chrome Extension File? (.CRX)

I'm not sure in which languages those extensions are, I think the are written in Html, Javascript or JSON. As far as I know they are "compressed" in a .CRX file.

It is possible to directly modify the html, js, json of a Chrome Extension (or whatever language they use)?


Installed Chrome extension directories are listed below:

  1. Copy the folder of the extension you wish to modify. ( Named according to the extension ID, to find the ID of the extension, go to chrome://extensions/). Once copied, you have to remove the _metadata folder.

  2. From chrome://extensions in Developer mode select Load unpacked extension... and select your copied extension folder, if it contains a subfolder this is named by the version, select this version folder where there is a manifest file, this file is necessary for Chrome.

  3. Make your changes, then select reload and refresh the page for your extension to see your changes.


Chrome extension directories

Mac:

/Users/username/Library/Application Support/Google/Chrome/Default/Extensions

Windows 7:

C:\Users\username\AppData\Local\Google\Chrome\User Data\Default\Extensions

Windows XP:

C:\Documents and Settings\YourUserName\Local Settings\Application Data\Google\Chrome\User Data\Default

Ubuntu 14.04:

~/.config/google-chrome/Default/Extensions/

I searched it in Google and I found this:

The Google Chrome Extension file type is CRX. It is essentially a compression format. So if you want to see what is behind an extension, the scripts and the code, just change the file-type from “CRX” to “ZIP” .

Unzip the file and you will get all the info you need. This way you can see the guts, learn how to write an extension yourself, or modify it for your own needs.

Then you can pack it back up with Chrome’s internal tools which automatically create the file back into CRX. Installing it just requires a click.


A signed CRX file has a header that will cause most/all unzippers to barf. This is not the easiest way to go about it, but here's how to do it from a bash command line.

The basic idea is to find where the original unsigned zipfile begins, then copy the CRX file to a zip file but exclude the CRX header.

  1. hexdump -C the_extension.crx | more
  2. Look in the output for the start of the zip file, which are the ASCII bytes "PK". In the sample I tried, the PK was at offset 0x132. (From reading the CRX spec, I think this number will vary from file to file because of different signature lengths.) That number is what we'll use in the next step.
  3. dd if=the_extension.crx of=the_extension.zip bs=1 skip=0x132 (For the skip parameter, substitute the offset you found in the previous step.)
  4. Now unzip the .zip that you just created.
  5. Fiddle with the files in the unzipped directory, then either install the unsigned/unpacked extension into your Chrome installation, or else repackage it just as you would any other Chrome extension.

I'm sure that there is a more concise way to do this. Bash experts, please improve on my answer.


Note that some zip programs have trouble unzipping a CRX like sathish described - if this is the case, try using 7-Zip - http://www.7-zip.org/