I thought it'd be nice to ensure we could represent any character in the
patterns. However, this isn't required (as the client only uses
alphabetical class, method and field names). Furthermore, the period
character is already unusable in class names due to the MemberRef string
parsing.
Signed-off-by: Graham <gpe@openrs2.dev>
These are useful for identifying the files in moparisthebest's archive,
as the file names include the CRC-32 value for cache busting.
I'm keeping the SHA-256 checksums - they provide further assurance as
it's very easy to generate a CRC-32 collision.
Signed-off-by: Graham <gpe@openrs2.dev>
While the jaggl jar isn't actually obfuscated, this change means we'll
support the @OriginalXXX annotations (which is useful for local
variables, whose names aren't retained). The unused method, visibility
and final transformers will also tidy up the code slightly.
The new class/member filtering infrastructure is used to retain the
names of every class, method and field.
Signed-off-by: Graham <gpe@openrs2.dev>
<init> methods do not override each other. This caused us to incorrectly
calculate visibility in some cases in the VisibilityTransformer.
Signed-off-by: Graham <gpe@openrs2.dev>
The new system will make it easier to port the deobfuscator to different
revisions.
There are two main changes:
- The addition of a Profile class, which contains a list of excluded
classes, methods and fields, and the maximum obfuscated name length.
It is passed to Transformers that require it with dependency
injection.
- New ClassFilter and MemberFilter infrastructure. The MemberFilter
class adds support for filtering fields and methods based on the
owner and descriptor, in addition to the name. This makes the filters
more precise than the previous system. It also supports globs, which
makes it easy to filter whole groups of classes, fields and methods
in one go.
The Profile class uses a ClassFilter and MemberFilters to
represent the list of excluded classes, methods and fields.
A separate benefit is the addition of a separate entry points filter
to the Profile class. Prior to this commit, many Transformers re-used
the excluded method filter to find entry points, which is less precise
(many of the excluded methods in 550 are not entry points).
Support for filtering methods by owner and descriptor in addition to
name allows the DEFAULT_PUBLIC_CTOR_CLASSES Set in VisibilityTransformer to
be combined with the entry points filter.
In the future it might be desirable to split the excluded method set
into three separate sets:
- One to represent methods that can't be renamed.
- One to represent methods whose signature can't be changed.
- One to represent methods that can't be removed.
Signed-off-by: Graham <gpe@openrs2.dev>
This allows users to compile and run the deobfuscator's output without
access to the nonfree repository. It will be particularly useful when
the deobfuscator can make use of the deob-map files.
Signed-off-by: Graham <gpe@openrs2.dev>
It returns a single NameMap combining all the maps in share/deob-map.
This will ultimately be fed into the RemapTransformer/TypedRemapper in
the deobfuscator.
Signed-off-by: Graham <gpe@openrs2.dev>
Our convention is one Guice module per subproject, where necessary.
Although this currently only includes YamlModule, it will include a
future DeobfuscatorMapModule.
Signed-off-by: Graham <gpe@openrs2.dev>
The Resource::compress method already holds entire files in memory at
once, as does the client-side loader. We might as well do the same on
the server-side.
Signed-off-by: Graham <gpe@openrs2.dev>
This will provide a few benefits:
- Some of the implementations can now be turned into objects, reducing
memory allocation.
- A single Resource.compressLibrary() method will be able to take a
LibraryWriter, reducing duplication.
Signed-off-by: Graham <gpe@openrs2.dev>
Some of these method names only make sense when accompanied with the
class name. I think most of these were mistakes in the Java -> Kotlin
port.
Signed-off-by: Graham <gpe@openrs2.dev>
This name is slightly more descriptive and consistent with loader.p12,
which also contains a private key.
I've also removed the public.key file. It isn't read by OpenRS2 and the
two files could get out of sync with each other, which would be
confusing.
It's easy to extract the public key with OpenSSL if necessary:
openssl pkey -in game.key -pubout -out public.key
Signed-off-by: Graham <gpe@openrs2.dev>
It uses multibindings to allow additional Jackson modules to be
registered across different Guice modules while using a single
ObjectMapper for the whole application.
Signed-off-by: Graham <gpe@openrs2.dev>