Starting to make a complexer toggler and picker

This commit is contained in:
obvWolf
2023-11-06 01:28:34 -06:00
parent 5e619ee22b
commit b909e44e30
7 changed files with 47 additions and 12 deletions

1
.idea/misc.xml generated
View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ASMSmaliIdeaPluginConfiguration">
<asm skipDebug="true" skipFrames="true" skipCode="false" expandFrames="false" />

View File

@@ -3,7 +3,7 @@ plugins {
}
group 'me.trouper'
version '0.0.3'
version '0.0.4'
repositories {
mavenCentral()
@@ -11,6 +11,7 @@ repositories {
dependencies {
implementation 'net.objecthunter:exp4j:0.4.8'
implementation 'com.ezylang:EvalEx:3.0.5'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}

View File

@@ -9,6 +9,12 @@ import static me.trouper.Functions.Eval.eval;
import static me.trouper.Functions.Eval.isPerfectSquare;
public class Complexers {
/* Complexer Toggles */
public static boolean divide;
public static boolean power;
public static boolean root;
public static boolean mrDividend;
public static boolean mrDivisor;
/**
* Safe to use with D mode
@@ -86,7 +92,10 @@ public class Complexers {
int dividend = random.nextInt(9)+i+10;
int divisor = Utils.moduRootDivisor(dividend,i);
String result = "<&r><&f>(<&e>" + dividend + "<&b>%<&e>" + divisor + "<&f>)<&r>";
Utils.verbose("<&dh><&b>mRootDivisor has been ran!<&r>" +
if (deep) {
result = "<&r><&f>(<&e>" + dividend + "<&b>%<&e>" + divisor + "<&f>)<&r>";
}
Utils.verbose("<&dh><&b>mRootDivisor has ran!<&r>" +
"\nWanted: " + i +
"\nDivisor: " + divisor +
"\nDividend: " + dividend +
@@ -115,5 +124,6 @@ public class Complexers {
"\nResult: " + result);
if (eval(result) != i) Utils.verbose("<&ch>Failed to mRootDividend<&r> " + i + ", Attempted: " + result + "=" + eval(result));
return (eval(result) == i) ? result : "(" + i + ")";
}
}

View File

@@ -1,5 +1,8 @@
package me.trouper.Functions;
import com.ezylang.evalex.EvaluationException;
import com.ezylang.evalex.data.EvaluationValue;
import com.ezylang.evalex.parser.ParseException;
import me.trouper.Utils.Utils;
import net.objecthunter.exp4j.Expression;
import net.objecthunter.exp4j.ExpressionBuilder;
@@ -21,4 +24,9 @@ public class Eval {
public static boolean isInt(double number) {
return (number == Math.floor(number)) && !Double.isInfinite(number);
}
public static double evalM(String exp) throws EvaluationException, ParseException {
com.ezylang.evalex.Expression expression = new com.ezylang.evalex.Expression(exp);
EvaluationValue result = expression.evaluate();
return result.getNumberValue().doubleValue();
}
}

View File

@@ -171,4 +171,8 @@ public class Obf {
return (eval(toAdd) == target) ? toAdd : "(" + target + ")";
}
public static String pickComplexer() {
return "e";
}
}

View File

@@ -1,5 +1,6 @@
package me.trouper;
import me.trouper.Functions.Complexers;
import me.trouper.Functions.Obf;
import me.trouper.Utils.Timer;
import me.trouper.Utils.Utils;
@@ -7,6 +8,7 @@ import me.trouper.Utils.Utils;
import java.util.Scanner;
import static me.trouper.Functions.Eval.eval;
import static me.trouper.Functions.Eval.evalM;
import static me.trouper.Utils.Utils.removeColors;
public class Main {
@@ -14,6 +16,7 @@ public class Main {
public static boolean deep;
public static boolean color;
public static boolean printHelp;
/* Statistics */
public static int expCount = 0;
public static int factorCount = 0;
@@ -44,6 +47,11 @@ public class Main {
boolean doCopy = false;
String mode = "N";
Complexers.divide = true;
Complexers.power = true;
Complexers.root = true;
Complexers.mrDividend = true;
Complexers.mrDivisor = true;
for (String arg : args) {
switch (arg) {
@@ -58,6 +66,8 @@ public class Main {
}
}
if (mode.equals("TEST")) {
while (true) {
System.out.print("Enter an expression (or 'exit' to exit): ");
@@ -68,7 +78,7 @@ public class Main {
}
try {
double result = eval(userInput);
double result = evalM(userInput);
System.out.println("Result: " + result);
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());

View File

@@ -39,14 +39,17 @@ public class Utils {
}
public static void printHelp() {
System.out.println("Usage: java -jar Countroll-<version>.jar [options]");
System.out.println("Options:");
System.out.println(" --copy, -c Copy the generated expression to the clipboard");
System.out.println(" --verbose, -v Enable verbose mode");
System.out.println(" --deep, -d Enable deep obfuscation (under development)");
System.out.println(" --color, -rgb Enable colored output");
System.out.println(" --help, --h, -h Show this help message");
System.out.println("Note: When using multiple options, separate them with spaces.");
System.out.println("""
Usage: java -jar Countroll-<version>.jar [options]
Options: values are formated as such: -m=d or -t=root
--copy, -c Copy the generated expression to the clipboard
--verbose, -v Enable verbose mode
--deep, -d Enable deep obfuscation (under development)
--color, -rgb Enable colored output
--help, --h, -h Show this help message
--mode, -m Toggle the mode Values (Long): [duckgroup, numselli] Values (Brief): [d, n]
--toggle, -t Toggle off Complexer Values: [divide, power, root, mrDividend, mrDivisor]
Note: When using multiple options, separate them with spaces.""");
System.exit(0);
}
public static void printColorKey() {