crxtool-core

Library for Chrome extension file analysis

License

License

GroupId

GroupId

com.github.mike10004
ArtifactId

ArtifactId

crxtool-core
Last Version

Last Version

0.16
Release Date

Release Date

Type

Type

jar
Description

Description

crxtool-core
Library for Chrome extension file analysis

Download crxtool-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.mike10004/crxtool-core/ -->
<dependency>
    <groupId>com.github.mike10004</groupId>
    <artifactId>crxtool-core</artifactId>
    <version>0.16</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.mike10004/crxtool-core/
implementation 'com.github.mike10004:crxtool-core:0.16'
// https://jarcasting.com/artifacts/com.github.mike10004/crxtool-core/
implementation ("com.github.mike10004:crxtool-core:0.16")
'com.github.mike10004:crxtool-core:jar:0.16'
<dependency org="com.github.mike10004" name="crxtool-core" rev="0.16">
  <artifact name="crxtool-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.mike10004', module='crxtool-core', version='0.16')
)
libraryDependencies += "com.github.mike10004" % "crxtool-core" % "0.16"
[com.github.mike10004/crxtool-core "0.16"]

Dependencies

compile (3)

Group / Artifact Type Version
com.google.code.findbugs : jsr305 Optional jar 3.0.1
com.google.protobuf : protobuf-java jar 3.10.0
com.google.guava : guava jar 28.1-jre

test (11)

Group / Artifact Type Version
junit : junit jar 4.12
commons-io : commons-io jar 2.6
commons-codec : commons-codec jar 1.10
org.seleniumhq.selenium : selenium-chrome-driver jar 3.141.59
org.seleniumhq.selenium : selenium-support jar 3.141.59
com.github.mike10004 : xvfb-testing jar 0.19
org.slf4j : slf4j-jdk14 jar 1.7.25
com.github.mike10004 : nanohttpd-server jar 0.14
com.github.mike10004 : crxtool-testing jar 0.16
io.github.bonigarcia : webdrivermanager jar 3.7.1
org.bouncycastle : bcprov-jdk15on jar 1.64

Project Modules

There are no modules declared in this project.

Travis build status AppVeyor build status Maven Central

crxtool

Library for packing and unpacking Chrome extension .crx files.

Core Library

Maven Coordinates

<dependency>
    <groupId>com.github.mike10004</groupId>
    <artifactId>crxtool-core</artifactId>
    <version>0.15</version>
</dependency>

Usage

Unpacking

try (InputStream in = new FileInputStream("my_extension.crx") {
    CrxMetadata metadata = CrxParser.getDefault().parseMetadata(in);
    System.out.println("id = " + metadata.getId());
    // handle remainder of stream as a zip archive
    try (ZipInputStream zin = new ZipInputStream(in)) {
        // ...
    }
}

Packing

Path extensionDir = new File("manifest-parent-dir").toPath();
java.security.KeyPairGenerator keyGen = java.security.KeyPairGenerator.getInstance("RSA");
java.security.SecureRandom random = new java.security.SecureRandom();
keyGen.initialize(1024, random);
java.security.KeyPair keyPair = keyGen.generateKeyPair();
try (OutputStream out = new FileOutputStream("new_extension.crx")) {
    CrxPacker.getDefault().packExtension(extensionDir, keyPair, out);
}

Maven Plugin

Maven Coordinates

<plugin>
    <groupId>com.github.mike10004</groupId>
    <artifactId>crxtool-maven-plugin</artifactId>
    <version>0.15</version>
</plugin>

Usage

Place extension source files in src/main/extension.

<build>
    <plugins>
        <plugin>
            <groupId>com.github.mike10004</groupId>
            <artifactId>crxtool-maven-plugin</artifactId>
            <version>0.15</version>
            <executions>
                <execution>
                    <id>pack</id>
                    <goals>
                        <goal>pack-extension</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>3.0.0</version>
            <executions>
                <execution>
                    <id>attach-artifact</id>
                    <goals>
                        <goal>attach-artifact</goal>
                    </goals>
                    <configuration>
                        <artifacts>
                            <artifact>
                                <file>${project.build.directory}/${project.artifactId}-${project.version}.crx</file>
                                <type>crx</type>
                            </artifact>
                        </artifacts>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Credits

The extension ID construction is probably from this Stack Overflow answer. The make-page-red example extension file in the test resources is from developer.chrome.com.

Versions

Version
0.16
0.15
0.14
0.12
0.11
0.10
0.9
0.8
0.7
0.6
0.5