Can I decrypt a Firefox addon from XPI to XUL?

Is it possible to decrypt the firefox addon from the XPI binding format to the native XUL language?

I'm just trying to learn how to create an addon. So, I think that if I can decrypt the Firefox addon, then I can learn the addon architecture!

+5
source share
3 answers

Most of the code you want to see is in the chrome directory of the extension, usually in the jar file. All you need is a file extractor that can extract zip files. Once you extract the xpi (it’s just a zip file with the xpi extension), open the chrome subfolder and see what is there. If it is a jar file, extract its contents (.jar files are also only zip files with a different extension). From there, there is probably a content folder that should have most of xul, css, js, etc.

+2
source

XPI just puts the ZIP file, so you can simply extract its contents and read the files ...

+7
source

, xpi-unpack xpi-pack Ubuntu ( sudo apt-get install mozilla-devscripts); , .xpi, .jar .

!

Edit: note that you may have permission problems xpi-unpack; here is an example of the command line log I had:

user@PC:Desktop$ xpi-unpack colt.xpi colt-dir
Unpacking colt.xpi
Unpacking ./chrome/colt.jar
Unpacked xpi file.
user@PC:Desktop$ ls -la colt-dir/chrome/colt.jar\!/
total 16
drwxr-xr-x  4 user user 4096 2011-07-05 09:52 .
drwxr-xr-x  3 user user 4096 2011-07-05 09:52 ..
d---------  2 user user 4096 2010-09-12 05:15 content
d--------- 25 user user 4096 2011-01-08 17:08 locale

user@PC:Desktop$ stat -c '%n %a' colt-dir/chrome/colt.jar\!/
colt-dir/chrome/colt.jar!/ 755
user@PC:Desktop$ stat -c '%n %a' colt-dir/chrome/colt.jar\!/content/
colt-dir/chrome/colt.jar!/content/ 0

user@PC:Desktop$ sudo chmod -R 755 colt-dir/chrome/colt.jar\!/ 

user@PC:Desktop$ ls -la colt-dir/chrome/colt.jar\!/
total 16
drwxr-xr-x  4 user user 4096 2011-07-05 09:52 .
drwxr-xr-x  3 user user 4096 2011-07-05 09:52 ..
drwxr-xr-x  2 user user 4096 2010-09-12 05:15 content
drwxr-xr-x 25 user user 4096 2011-01-08 17:08 locale

EDIT2: in fact, it turns out that other files also lack permissions:

user@PC:Desktop$ ls -la colt-dir/
total 28
drwxr-xr-x 4 user user 4096 2011-07-05 09:52 .
drwxr-xr-x 5 user user 4096 2011-07-05 10:04 ..
drwxr-xr-x 3 user user 4096 2011-07-05 10:04 chrome
---------- 1 user user 1337 2011-06-23 00:05 chrome.manifest
drwxr-xr-x 3 user user 4096 2011-07-05 09:52 defaults
---------- 1 user user 1969 2011-06-23 00:05 install.rdf
---------- 1 user user 1275 2010-09-12 05:04 LICENSE.txt
user@PC:Desktop$ stat -c '%n %a' colt-dir/install.rdf 
colt-dir/install.rdf 0

... so best of all is chmod: sudo chmod -R 755 colt-dir/before trying to make changes and package (as in xpi-pack colt-dir colt-2.xpi)

+3
source

All Articles