Finished colored output and optimized Increaser algorithm

This commit is contained in:
obvWolf
2023-11-04 13:30:06 -05:00
parent cd510e98de
commit aca66990b0
11 changed files with 413 additions and 184 deletions

View File

@@ -3,7 +3,7 @@ plugins {
} }
group 'me.trouper' group 'me.trouper'
version '0.0.1' version '0.0.2'
repositories { repositories {
mavenCentral() mavenCentral()

View File

@@ -1,21 +0,0 @@
package me.trouper.Data;
public class ANSI {
public static final String RESET = "\u001B[0m";
public static final String BLACK = "\u001B[30m";
public static final String RED = "\u001B[31m";
public static final String GREEN = "\u001B[32m";
public static final String YELLOW = "\u001B[33m";
public static final String BLUE = "\u001B[34m";
public static final String PURPLE = "\u001B[35m";
public static final String CYAN = "\u001B[36m";
public static final String WHITE = "\u001B[37m";
public static final String BLACK_BACKGROUND = "\u001B[40m";
public static final String RED_BACKGROUND = "\u001B[41m";
public static final String GREEN_BACKGROUND = "\u001B[42m";
public static final String YELLOW_BACKGROUND = "\u001B[43m";
public static final String BLUE_BACKGROUND = "\u001B[44m";
public static final String PURPLE_BACKGROUND = "\u001B[45m";
public static final String CYAN_BACKGROUND = "\u001B[46m";
public static final String WHITE_BACKGROUND = "\u001B[47m";
}

View File

@@ -0,0 +1,49 @@
package me.trouper.Data;
import java.util.HashMap;
import java.util.Map;
public class MC2Ansi {
public static Map<String, String> getColors() {
Map<String, String> minecraftToAnsi = new HashMap<>();
minecraftToAnsi.put("<&0>", "\u001B[0;30m");
minecraftToAnsi.put("<&1>", "\u001B[0;34m");
minecraftToAnsi.put("<&2>", "\u001B[0;32m");
minecraftToAnsi.put("<&3>", "\u001B[0;36m");
minecraftToAnsi.put("<&4>", "\u001B[0;31m");
minecraftToAnsi.put("<&5>", "\u001B[0;35m");
minecraftToAnsi.put("<&6>", "\u001B[0;33m");
minecraftToAnsi.put("<&7>", "\u001B[0;37m");
minecraftToAnsi.put("<&8>", "\u001B[1;30m");
minecraftToAnsi.put("<&9>", "\u001B[1;34m");
minecraftToAnsi.put("<&a>", "\u001B[1;32m");
minecraftToAnsi.put("<&b>", "\u001B[1;36m");
minecraftToAnsi.put("<&c>", "\u001B[1;31m");
minecraftToAnsi.put("<&d>", "\u001B[1;35m");
minecraftToAnsi.put("<&e>", "\u001B[1;33m");
minecraftToAnsi.put("<&f>", "\u001B[1;37m");
minecraftToAnsi.put("<&r>", "\u001B[0m");
return minecraftToAnsi;
}
public static Map<String, String> getBackgrounds() {
Map<String, String> minecraftToAnsiBG = new HashMap<>();
minecraftToAnsiBG.put("<&0h>", "\u001B[40m");
minecraftToAnsiBG.put("<&1h>", "\u001B[44m");
minecraftToAnsiBG.put("<&2h>", "\u001B[42m");
minecraftToAnsiBG.put("<&3h>", "\u001B[46m");
minecraftToAnsiBG.put("<&4h>", "\u001B[41m");
minecraftToAnsiBG.put("<&5h>", "\u001B[45m");
minecraftToAnsiBG.put("<&6h>", "\u001B[43m");
minecraftToAnsiBG.put("<&7h>", "\u001B[47m");
minecraftToAnsiBG.put("<&8h>", "\u001B[40;1m");
minecraftToAnsiBG.put("<&9h>", "\u001B[44;1m");
minecraftToAnsiBG.put("<&ah>", "\u001B[42;1m");
minecraftToAnsiBG.put("<&bh>", "\u001B[46;1m");
minecraftToAnsiBG.put("<&ch>", "\u001B[41;1m");
minecraftToAnsiBG.put("<&dh>", "\u001B[45;1m");
minecraftToAnsiBG.put("<&eh>", "\u001B[43;1m");
minecraftToAnsiBG.put("<&fh>", "\u001B[47;1m");
return minecraftToAnsiBG;
}
}

View File

@@ -5,30 +5,22 @@ import java.util.Random;
import static me.trouper.Functions.Eval.eval; import static me.trouper.Functions.Eval.eval;
public class Complexers { public class Complexers {
public static String divide(int i, boolean deep) { public static String divide(int i) {
Random random = new Random(); Random random = new Random();
int factor = random.nextInt(9)+1; int factor = random.nextInt(9)+1;
int doubled = i * factor; int doubled = i * factor;
String result; String result = "<&f>(<&r><&e>" + doubled + "<&b>/<&r><&e>" + factor + "<&f>)<&r>";
if (deep) {
result = "(" + Increasers.multiply(doubled,1,false) + "/" + Increasers.multiply(factor,1,false) + ")";
} else {
result = "(" + doubled + "/" + factor + ")";
}
if (eval(result) == i) { if (eval(result) == i) {
return result; return result;
} }
return "(" + i + ")"; return "(" + i + ")";
} }
public static String root(int i, boolean deep) { public static String root(int i) {
int squared = (int) Math.pow(i,2); int squared = (int) Math.pow(i,2);
String result; String result = "<&9>sqrt<&r><&f>(<&r><&e>" + squared + "<&f>)<&r>";
if (deep) {
result = "sqrt(" + Increasers.power(i,1,false) + ")";
} else {
result = "sqrt(" + squared + ")";
}
if (eval(result) == i){ if (eval(result) == i){
return result; return result;
} }

View File

@@ -1,11 +1,14 @@
package me.trouper.Functions; package me.trouper.Functions;
import me.trouper.Utils.Utils;
import net.objecthunter.exp4j.Expression; import net.objecthunter.exp4j.Expression;
import net.objecthunter.exp4j.ExpressionBuilder; import net.objecthunter.exp4j.ExpressionBuilder;
public class Eval { public class Eval {
public static double eval(String expression) { public static double eval(String expression) {
Expression exp = new ExpressionBuilder(expression).build(); final String cleaned = Utils.removeColors(expression);
Utils.verbose("Evaluating Expression: " + cleaned);
Expression exp = new ExpressionBuilder(cleaned).build();
return exp.evaluate(); return exp.evaluate();
} }
public static boolean isPerfectSquare(int num) { public static boolean isPerfectSquare(int num) {

View File

@@ -3,25 +3,17 @@ package me.trouper.Functions;
import static me.trouper.Functions.Eval.eval; import static me.trouper.Functions.Eval.eval;
public class Increasers { public class Increasers {
public static String multiply(int i, int factor, boolean deep) { public static String multiply(int i, int factor) {
String result; String result = "<&7>(<&r><&2>" + i + "<&b>*<&r><&2>" + factor + "<&7>)<&r>";
if (deep) {
result = "(" + Complexers.divide(i,false) + "/" + Complexers.divide(factor,false) + ")";
} else {
result = "(" + i + "*" + factor + ")";
}
if (eval(result) == i * factor) { if (eval(result) == i * factor) {
return result; return result;
} }
return "(" + i + ")"; return "(" + i + ")";
} }
public static String power(int i, int exp, boolean deep) { public static String power(int i, int exp) {
String result; String result = "<&7>(<&r><&2>" + i + "<&b>^<&r><&2>" + exp + "<&7>)<&r>";
if (deep) {
result = "(" + Complexers.root(i,false) + "^" + Complexers.root(exp,false) + ")";
} else {
result = "(" + i + "^" + exp + ")";
}
if (eval(result) == Math.pow(i,exp)) { if (eval(result) == Math.pow(i,exp)) {
return result; return result;
} }

View File

@@ -0,0 +1,123 @@
package me.trouper.Functions;
import java.util.Random;
import static me.trouper.Functions.Eval.*;
import static me.trouper.Functions.Eval.eval;
import static me.trouper.Utils.Utils.removeColors;
import static me.trouper.Utils.Utils.verbose;
public class Obf {
public static String obfInt(int target, boolean deep) {
if (deep) System.out.println("Deep Obfuscation is coming soon!");
StringBuilder expression = new StringBuilder();
Random random = new Random();
int initializer = random.nextInt(9)+1;
verbose("Initializing Expression: " + initializer);
expression.append("<&dh><&f>").append(initializer).append("<&r>");
int cubeCount = 0;
int factorCount = 0;
int addCount = 0;
int subCount = 0;
int rootCount = 0;
int divideCount = 0;
int perfectCount = 0;
int total = 0;
while (eval(expression.toString()) != target) {
total++;
int eval = (int) eval(expression.toString());
int ri = random.nextInt(9)+1;
int op = random.nextInt(2);
boolean mult = false;
if (!isInt(eval(expression.toString()))) {
System.out.println("Something went horribly wrong, Here is the relevant info." +
"\nEvaluation: " + eval(expression.toString()) +
"\nRandom Pick: " + ri +
"\nOperation: " + op +
"\nCaught at: \n" + removeColors(expression.toString()));
break;
}
verbose("Random: " + ri);
verbose("Current: " + eval(expression.toString()));
if (isPerfectSquare(eval) && eval != 1) {
perfectCount++;
verbose("PERFECT SQUARE TIME! (" + perfectCount+ ")");
expression.insert(0,"<&eh><&b>sqrt(<&r>").append("<&eh><&b>)<&r>");
eval = (int) eval(expression.toString());
}
if (target - eval > 4069) {
mult = true;
cubeCount++;
verbose("Large than (" + cubeCount + ")");
final String toAdd = Increasers.power(ri,3);
expression.append("<&b>+<&r><&a>").append(toAdd).append("<&r>");
} else if (target - eval > 1048) {
mult = true;
cubeCount++;
verbose("Large than (" + cubeCount + ")");
final String toAdd = Increasers.power(ri,2);
expression.append("<&b>+<&r><&a>").append(toAdd).append("<&r>");
} else if (target - eval > 128) {
factorCount++;
verbose("Big than (" + factorCount + ")");
final String toAdd = Increasers.multiply(ri,9);
expression.append("<&b>+<&r><&a>").append(toAdd).append("<&r>");
continue;
}
if (eval < target) {
addCount++;
if (op == 0) {
divideCount++;
} else {
rootCount++;
}
final String toAdd = (op == 0) ? Complexers.divide(ri) : Complexers.root(ri);
expression.append((mult) ? "<&b>*<&r>" : "<&b>+<&r><&e>").append(toAdd).append("<&r>");
verbose("Less than (" + addCount + ")");
}
if (eval > target) {
subCount++;
if (op == 0) {
divideCount++;
} else {
rootCount++;
}
final String toAdd = (op == 0) ? Complexers.divide(ri) : Complexers.root(ri);
/*
String colored = Utils.highlightReg(toAdd);
if (deep) {
colored = Utils.highlightDeep(toAdd);
}*/
expression.insert(0,"<&c>(<&r>").append("<&c>)<&r>");
expression.append("<&b>-<&r><&e>").append(toAdd).append("<&r>");
verbose("Greater than (" + subCount + ")");
}
}
verbose("Broke out of loop. Value: " + eval(expression.toString()));
verbose("Expression: " + expression);
verbose("Expression (Cleaned): " + removeColors(expression.toString()));
System.out.println("\n\n\n\nStatistics: " +
"\nCubes: " + cubeCount +
"\nFactors: " + factorCount +
"\nAdditions: " + addCount +
"\nSubtractions: " + subCount +
"\nRoots Taken: " + rootCount +
"\nDivisors: " + divideCount +
"\nPerfect Squares Found: " + perfectCount +
"\nTotal steps taken: " + total);
return expression.toString();
}
}

View File

@@ -1,18 +0,0 @@
package me.trouper.Functions;
import me.trouper.Main;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
public class Utils {
public static void copyToClip(String text) {
StringSelection parsed = new StringSelection(text);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(parsed,null);
}
public static void verbose(String text) {
if (Main.verbose) System.out.println(text);
}
}

View File

@@ -1,20 +1,19 @@
package me.trouper; package me.trouper;
import me.trouper.Data.ANSI; import me.trouper.Functions.Obf;
import me.trouper.Functions.Complexers; import me.trouper.Utils.Timer;
import me.trouper.Functions.Increasers; import me.trouper.Utils.Utils;
import me.trouper.Functions.Utils;
import java.util.Random;
import java.util.Scanner; import java.util.Scanner;
import static me.trouper.Functions.Eval.*; import static me.trouper.Functions.Eval.eval;
import static me.trouper.Functions.Utils.verbose; import static me.trouper.Utils.Utils.removeColors;
public class Main { public class Main {
public static boolean verbose; public static boolean verbose;
public static boolean deep; public static boolean deep;
private static final StringBuilder formattedExp = new StringBuilder(); public static boolean color;
public static boolean printHelp;
public static void main(String[] args) { public static void main(String[] args) {
Scanner scanner = new Scanner(System.in); Scanner scanner = new Scanner(System.in);
boolean doCopy = false; boolean doCopy = false;
@@ -22,25 +21,35 @@ public class Main {
for (String arg : args) { for (String arg : args) {
switch (arg) { switch (arg) {
case "--copy" -> doCopy = true; case "--copy", "-c" -> doCopy = true;
case "--verbose" -> verbose = true; case "--verbose", "-v" -> verbose = true;
case "--deep" -> deep = true; case "--deep", "-d" -> deep = true;
case "--color", "-rgb" -> color = true;
case "--help", "--h", "-h" -> printHelp = true;
} }
} }
if (printHelp) Utils.printHelp();
if (color) Utils.printColorKey();
while (true) { while (true) {
System.out.print("Enter Target Integer: "); System.out.print("Enter Target Integer: ");
if (scanner.hasNextInt()) { if (scanner.hasNextInt()) {
int target = scanner.nextInt(); int target = scanner.nextInt();
String expression = obfInt(target,deep); Timer obfTimer = Timer.start();
double output = eval(expression); String expression = Obf.obfInt(target, deep);
long obfTime = obfTimer.end().timePassed();
double output = eval(removeColors(expression));
System.out.println("\nTarget Integer: " + target); System.out.println("\nTarget Integer: " + target);
System.out.println("\nElapsed Time: " + obfTime + "ms");
if (output == target) { if (output == target) {
System.out.println(ANSI.GREEN_BACKGROUND + "Expression Verified Correct:" + ANSI.RESET + " \n" + formattedExp); System.out.println(Utils.activateColors("<&2h><&f>Expression Correct<&r>\n\n" + ((color) ? expression : removeColors(expression))));
if (doCopy) Utils.copyToClip(expression); if (doCopy) Utils.copyToClip(removeColors(expression));
} else { } else {
System.out.println(ANSI.RED_BACKGROUND + ANSI.BLACK + "!!!! INCORRECT !!!! \n" + ANSI.RESET + formattedExp); System.out.println(Utils.activateColors("<&ch><&0>!!!! INCORRECT !!!!<&r>\n\n" + ((color) ? expression : removeColors(expression))));
} }
} else { } else {
System.out.println("Exiting the program."); System.out.println("Exiting the program.");
@@ -50,103 +59,4 @@ public class Main {
scanner.close(); scanner.close();
} }
public static String obfInt(int target, boolean deep) {
if (deep) System.out.println("Deep Obfuscation is still in development!");
StringBuilder expression = new StringBuilder();
formattedExp.setLength(0);
Random random = new Random();
int initializer = random.nextInt(9)+1;
verbose("Initializing Expression: " + initializer);
expression.append(initializer);
formattedExp.append(ANSI.GREEN).append(initializer).append(ANSI.RESET);
int cubeCount = 0;
int factorCount = 0;
int addCount = 0;
int subCount = 0;
int rootCount = 0;
int divideCount = 0;
int perfectCount = 0;
int total = 0;
while (eval(expression.toString()) != target) {
total++;
int eval = (int) eval(expression.toString());
int ri = random.nextInt(9)+1;
int op = random.nextInt(2);
boolean mult = false;
if (!isInt(eval(expression.toString()))) {
System.out.println("Something went horribly wrong, Here is the relevant info." +
"\nEvaluation: " + eval(expression.toString()) +
"\nRandom Pick: " + ri +
"\nOperation: " + op +
"\nCaught at: \n" + expression);
break;
}
verbose("Random: " + ri);
verbose("Current: " + eval(expression.toString()));
if (isPerfectSquare(eval)) {
perfectCount++;
verbose("PERFECT SQUARE TIME! (" + perfectCount+ ")");
expression.insert(0,"sqrt(").append(")");
formattedExp.insert(0,ANSI.YELLOW_BACKGROUND + "sqrt(").append(")" + ANSI.RESET);
eval = (int) eval(expression.toString());
}
if (target - eval > 1000) {
mult = true;
cubeCount++;
verbose("Enormous than (" + cubeCount + ")");
expression.append("+").append(Increasers.power(ri,3,deep));
} else if (target - eval > 100) {
factorCount++;
verbose("Large than (" + factorCount + ")");
expression.append("+").append(Increasers.multiply(ri,10,deep));
continue;
}
if (eval < target) {
addCount++;
if (op == 0) {
divideCount++;
} else {
rootCount++;
}
expression.append((mult) ? "*" : "+").append((op == 0) ? Complexers.divide(ri,deep) : Complexers.root(ri,deep));
verbose("Less than (" + addCount + ")");
}
if (eval > target) {
subCount++;
if (op == 0) {
divideCount++;
} else {
rootCount++;
}
expression.insert(0,"(").append(")");
expression.append("-").append((op == 0) ? Complexers.divide(ri,deep) : Complexers.root(ri,deep));
verbose("Greater than (" + subCount + ")");
}
}
verbose("Broke out of loop. Value: " + eval(expression.toString()));
verbose("Expression: " + expression);
System.out.println("\n\n\n\nStatistics: " +
"\nCubes: " + cubeCount +
"\nFactors: " + factorCount +
"\nAdditions: " + addCount +
"\nSubtractions: " + subCount +
"\nRoots Taken: " + rootCount +
"\nDivisors: " + divideCount +
"\nPerfect Squares Found: " + perfectCount +
"\nTotal steps taken: " + total);
return expression.toString();
}
} }

View File

@@ -0,0 +1,93 @@
package me.trouper.Utils;
public class Timer {
/* Timer Curtosy of ImproperIssues
* https://your-mom-is-so-fat-we-couldnt-fit-her-in-this-doma.in/tugdkppa.png
* Yes, I got permission to use it this time! */
public static final long MILLIS_IN_SECOND = 1000L;
public static final long MILLIS_IN_MINUTE = MILLIS_IN_SECOND * 60L;
public static final long MILLIS_IN_HOUR = MILLIS_IN_MINUTE * 60L;
public static final long MILLIS_IN_DAY = MILLIS_IN_HOUR * 24L;
private long start;
private Timer() {
this.start = System.currentTimeMillis();
}
public static Timer start() {
return new Timer();
}
public static End zero() {
return new End(0);
}
public End end() {
return new End(start);
}
public static class End {
private final long start;
private final long end;
private End(long start) {
this.end = System.currentTimeMillis();
this.start = start;
}
public long timePassed() {
return end - start;
}
public String getStamp(boolean day, boolean hr, boolean min, boolean sec, boolean ms) {
long time = timePassed();
String stamp = "";
if (day) {
long l = (long)Math.floor((double)time / (double)MILLIS_IN_DAY);
time -= l * MILLIS_IN_DAY;
if (l > 0L) stamp += l + "d";
}
if (hr) {
long l = (long)Math.floor((double)time / (double)MILLIS_IN_HOUR);
time -= l * MILLIS_IN_HOUR;
if (l > 0L) stamp += " " + l + "hr";
}
if (min) {
long l = (long)Math.floor((double)time / (double)MILLIS_IN_MINUTE);
time -= l * MILLIS_IN_MINUTE;
if (l > 0L) stamp += " " + l + "min";
}
if (sec) {
long l = (long)Math.floor((double)time / (double)MILLIS_IN_SECOND);
time -= l * MILLIS_IN_SECOND;
if (l > 0L) stamp += " " + l + "sec";
}
if (ms) {
if (time > 0L) stamp += " " + time + "ms";
}
return stamp.trim();
}
public String getStampStandard() {
return getStamp(false, true, true, false, false);
}
public String getStampLogger() {
return getStamp(false, true, true, true, false);
}
public String getStampPrecise() {
return getStamp(false, false, true, true, true);
}
public String getStampFull() {
return getStamp(true, true, true, true, true);
}
}
}

View File

@@ -0,0 +1,106 @@
package me.trouper.Utils;
import me.trouper.Data.MC2Ansi;
import me.trouper.Main;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.util.Map;
public class Utils {
public static void copyToClip(String text) {
StringSelection parsed = new StringSelection(text);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(parsed,null);
}
public static void verbose(String text) {
if (Main.verbose) System.out.println(text);
}
public static String removeColors(String input) {
return input.replaceAll("<&[0-9a-fr]>|<&[0-9a-frh]h>", "");
}
public static String activateColors(String input) {
Map<String, String> minecraftToAnsi = MC2Ansi.getColors();
Map<String, String> minecraftBackgroundsToAnsi = MC2Ansi.getBackgrounds();
for (Map.Entry<String, String> entry : minecraftToAnsi.entrySet()) {
input = input.replace(entry.getKey(), entry.getValue());
}
for (Map.Entry<String, String> entry : minecraftBackgroundsToAnsi.entrySet()) {
input = input.replace(entry.getKey(), entry.getValue());
}
input += "\u001B[0m\u001B[49m";
return input;
}
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.exit(0);
}
public static void printColorKey() {
String colorKey = "\nColor Key: " +
"\n<&c>Red Parentheses:<&r> Gets Subtracted" +
"\n<&b><&eh>Blue/Yellow:<&r> Perfect Square" +
"\n<&a>Green:<&r> Increaser" +
"\n<&9>Blue:<&r> Operation" +
"\n<&e>Yellow:<&r> Complexer";
System.out.println(activateColors(colorKey));
}
/*
public static String highlightReg(String exp) {
final String result = exp
.replaceAll("\\(", ANSI.WHITE + "(" + ANSI.RESET)
.replaceAll("\\)", ANSI.WHITE + ")" + ANSI.RESET)
.replaceAll("\\*", ANSI.BLUE + "*" + ANSI.RESET)
.replaceAll("/", ANSI.BLUE + "/" + ANSI.RESET)
.replaceAll("\\+", ANSI.BLUE + "+" + ANSI.RESET)
.replaceAll("-", ANSI.BLUE + "-" + ANSI.RESET)
.replaceAll("\\^", ANSI.BLUE + "^" + ANSI.RESET)
.replaceAll("\\d+", ANSI.GREEN + "$0" + ANSI.RESET);
verbose("Attempting Ansi Highlight: " + result);
return result;
}
public static String highlightDeep(String exp) {
final String result = exp
.replaceAll("\\(", ANSI.CYAN + "*" + ANSI.RESET)
.replaceAll("\\)", ANSI.CYAN + "*" + ANSI.RESET)
.replaceAll("\\*", ANSI.BLUE + "*" + ANSI.RESET)
.replaceAll("/", ANSI.BLUE + "/" + ANSI.RESET)
.replaceAll("\\+", ANSI.BLUE + "+" + ANSI.RESET)
.replaceAll("-", ANSI.BLUE + "-" + ANSI.RESET)
.replaceAll("\\^", ANSI.BLUE + "^" + ANSI.RESET)
.replaceAll("\\d+", ANSI.PURPLE + "$0" + ANSI.RESET);
verbose("Attempting Ansi Highlight (Deep): " + result);
return result;
}
public static String fixAnsi(String input) {
Pattern pattern = Pattern.compile("(\\[\\d+m)");
Matcher matcher = pattern.matcher(input);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
// Check if the escape code was not properly closed (e.g., missing reset code)
if (input.substring(matcher.start()).indexOf(ANSI.RESET) < 0) {
String escapeCode = matcher.group(1);
// Re-escape the ANSI escape code
matcher.appendReplacement(sb, escapeCode);
}
}
matcher.appendTail(sb);
return sb.toString();
}*/
}