Skip to content

Commit

Permalink
chore: update tlds
Browse files Browse the repository at this point in the history
  • Loading branch information
pubiqq committed Oct 24, 2024
1 parent c0815b1 commit cf27d09
Show file tree
Hide file tree
Showing 3 changed files with 1,458 additions and 477 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,30 @@
import jadx.core.utils.exceptions.JadxRuntimeException;

/**
* Provides a list of all top level domains with 3 characters and less,
* so we can exclude them from deobfuscation.
* Provides a list of all top level domains, so we can exclude them from deobfuscation.
*/
public class ExcludePackageWithTLDNames extends AbstractDeobfCondition {

/**
* Lazy load TLD set
*/
private static class TldHolder {
private static final Set<String> TLD_SET = loadTldFile();
private static final Set<String> TLD_SET = loadTldSet();
}

private static Set<String> loadTldFile() {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(TldHolder.class.getResourceAsStream("tld_3.txt")))) {
private static Set<String> loadTldSet() {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(TldHolder.class.getResourceAsStream("tlds.txt")))) {
return reader.lines()
.map(String::trim)
.filter(line -> !line.startsWith("#") && !line.isEmpty())
.collect(Collectors.toSet());
} catch (Exception e) {
throw new JadxRuntimeException("Failed to load top level domain list file: tld_3.txt", e);
throw new JadxRuntimeException("Failed to load top level domain list file: tlds.txt", e);
}
}

@Override
public Action check(PackageNode pkg) {
if (TldHolder.TLD_SET.contains(pkg.getName())) {
if (pkg.isRoot() && TldHolder.TLD_SET.contains(pkg.getName())) {
return Action.FORBID_RENAME;
}
return Action.NO_ACTION;
Expand Down
Loading

0 comments on commit cf27d09

Please sign in to comment.