Skip to content

Commit

Permalink
feat(obfuscator): added background analytics to *exclusively* track o…
Browse files Browse the repository at this point in the history
…nly the amount of users, nothing else!
  • Loading branch information
terminalsin committed Jul 23, 2022
1 parent 1bc95cc commit c92f1aa
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static void main(String[] args) {
new File(System.getProperty("java.home"), "lib/rt.jar"),
false,
false,
false,
false
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public class ObfuscateCommand implements Callable<Integer> {
)
private boolean fuckit;

@CommandLine.Option(
names = {"-notrack", "--notrack"},
description = "If you do not wish to be part of analytics!"
)
private boolean notrack;

@Override
public Integer call() {
/* Total number of processors or cores available to the JVM */
Expand Down Expand Up @@ -157,6 +163,7 @@ public Integer call() {
.phantom(phantom)
.jmod(MiscUtil.getJavaVersion() > 8)
.fuckit(fuckit)
.analytics(!notrack)
.build();

final Skidfuscator skidfuscator = new Skidfuscator(skidInstance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class SkidfuscatorSession {
private boolean jmod;
private boolean fuckit;

private boolean analytics;

/**
*
* @return the input
Expand Down Expand Up @@ -84,4 +86,8 @@ public boolean isJmod() {
public boolean isFuckIt() {
return fuckit;
}

public boolean isAnalytics() {
return analytics;
}
}
5 changes: 5 additions & 0 deletions dev.skidfuscator.obfuscator/obfuscator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
<artifactId>progressbar</artifactId>
<version>0.9.3</version>
</dependency>
<dependency>
<groupId>com.github.matomo-org</groupId>
<artifactId>matomo-java-tracker</artifactId>
<version>v1.7</version>
</dependency>
<dependency>
<groupId>com.github.Col-E</groupId>
<artifactId>jphantom</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import dev.skidfuscator.obfuscator.transform.impl.number.NumberTransformer;
import dev.skidfuscator.obfuscator.transform.impl.string.StringTransformer;
import dev.skidfuscator.obfuscator.util.MapleJarUtil;
import dev.skidfuscator.obfuscator.util.MiscUtil;
import dev.skidfuscator.obfuscator.util.ProgressUtil;
import dev.skidfuscator.obfuscator.util.misc.Counter;
import dev.skidfuscator.obfuscator.util.misc.TimedLogger;
Expand All @@ -58,13 +59,17 @@
import org.mapleir.deob.dataflow.LiveDataFlowAnalysisImpl;
import org.mapleir.ir.cfg.ControlFlowGraph;
import org.objectweb.asm.Opcodes;
import org.piwik.java.tracking.CustomVariable;
import org.piwik.java.tracking.PiwikRequest;
import org.piwik.java.tracking.PiwikTracker;
import org.topdank.byteengineer.commons.data.JarClassData;
import org.topdank.byteio.in.AbstractJarDownloader;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
import java.util.*;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -107,6 +112,33 @@ public Skidfuscator(SkidfuscatorSession session) {
public void run() {
LOGGER.post("Beginning Skidfuscator Community...");

if (session.isAnalytics()) {
try {
final PiwikTracker tracker = new PiwikTracker(
"https://analytics.skidfuscator.dev/matomo.php"
);

final PiwikRequest request = new PiwikRequest(
1,
null
);

final URL url = new URL("https://app.skidfuscator.dev");
request.setActionUrl(url);
request.setActionName("skidfuscator/launch");


request.setEventAction("launch");
request.setEventCategory("skidfuscator/community");
request.setEventName("Java");
request.setEventValue(MiscUtil.getJavaVersion());

tracker.sendRequestAsync(request);
} catch (Exception e){
//e.printStackTrace();
}
}

/*
* Initializes a null skid directory. This skid directory is used as a
* cache or a temporary directory, most often for silly things such as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ void handle(final RunMethodTransformEvent event) {
Integer[] keysT = keyMap.get(parentNode);

if (keysT == null) {
final int size = RandomUtil.nextInt(128);
final int size = RandomUtil.nextInt(127) + 1;
keysT = new Integer[size];
for (int i = 0; i < size; i++) {
keysT[i] = RandomUtil.nextInt(128);
keysT[i] = RandomUtil.nextInt(127) + 1;
}

keyMap.put(parentNode, keysT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public void test2() throws Exception {
.output(output)
.runtime(new File(System.getProperty("java.home"), "lib/rt.jar"))
.phantom(true)
.analytics(false)
.build();

final Skidfuscator skidfuscator = new Skidfuscator(session);
Expand Down

0 comments on commit c92f1aa

Please sign in to comment.