uh i did proguard yes 🏳️‍⚧️

This commit is contained in:
Jess H 2024-04-11 01:30:19 +01:00
parent d7652d84bd
commit 943207a6f1
26 changed files with 2287 additions and 22 deletions

View file

@ -4,9 +4,11 @@ buildscript {
maven { url = 'https://repo.spongepowered.org/repository/maven-public' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.1', changing: true
classpath "org.spongepowered:mixingradle:0.7.+"
classpath 'com.guardsquare:proguard-gradle:7.1.0'
}
}
@ -79,8 +81,6 @@ dependencies {
// should NOT go into the jar.
//implementation(files('libs/mcregistry-1.0.jar'))
//jarLibs 'club.minnced:java-discord-rpc:2.0.2'
annotationProcessor('org.spongepowered:mixin:0.8.5:processor') {
exclude module: 'gson'
}
@ -131,6 +131,19 @@ jar {
classifier = 'BaseBand-Oslo'
}
def proguardBuildDir = "${buildDir}/proguard"
def proguardDir = "proguard"
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: jar) {
configuration "${proguardDir}/proguard.cfg"
injars jar.archiveFile
outjars "${proguardBuildDir}/classes.jar"
libraryjars "${proguardDir}/rt.jar"
libraryjars configurations.jarLibs
dump "${proguardBuildDir}/dump.txt"
printmapping "${proguardBuildDir}/mapping.txt"
printconfiguration "${proguardBuildDir}/configuration.txt"
}
task releaseJar(type: Jar, dependsOn: jar) {
from(zipTree(jar.archivePath)) {

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,39 @@
-target 1.8
-forceprocessing
#-allowaccessmodification
#-optimizationpasses 5
-dontshrink
-dontoptimize
#-dontpreverify
-applymapping dictionary.txt
-obfuscationdictionary dictionary.txt
-classobfuscationdictionary dictionary.txt
-packageobfuscationdictionary dictionary.txt
-repackageclasses com.baseband.prod
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod
-ignorewarnings
-overloadaggressively
-keep class com.baseband.client.mixins.** { *; }
-keep class com.baseband.client.DevStub { *; }
# spongepowered
-keep class org.** { *; }
#tuddo
-keep class de.** { *; }
# javassist
-keep class javassist.** { *; }
# javassist
-keep class net.** { *; }
# Also keep - Enumerations. Keep the special static methods that are required in
# enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

BIN
Client/proguard/rt.jar Normal file

Binary file not shown.

View file

@ -1,5 +1,6 @@
package com.baseband.client;
import com.baseband.client.init.BaseBand;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

View file

@ -1,6 +1,6 @@
package com.baseband.client.configuration;
import com.baseband.client.Setup;
import com.baseband.client.init.Setup;
import de.tudbut.tools.Registry;
import java.io.IOException;

View file

@ -1,7 +1,7 @@
package com.baseband.client.gui;
import com.baseband.client.BaseBand;
import com.baseband.client.Setup;
import com.baseband.client.init.BaseBand;
import com.baseband.client.init.Setup;
import com.baseband.client.gui.lib.GUIManager;
import com.baseband.client.gui.lib.component.Category;
import com.baseband.client.gui.lib.component.Component;

View file

@ -1,6 +1,6 @@
package com.baseband.client.gui.lib;
import com.baseband.client.BaseBand;
import com.baseband.client.init.BaseBand;
import com.baseband.client.gui.GuiTheme;
import com.baseband.client.gui.lib.component.Component;
import com.baseband.client.module.render.ClickGUI;

View file

@ -1,4 +1,4 @@
package com.baseband.client;
package com.baseband.client.init;
import com.baseband.client.configuration.Updater;
import com.baseband.client.event.EventManager;

View file

@ -1,4 +1,4 @@
package com.baseband.client;
package com.baseband.client.init;
import com.baseband.client.module.Feature;
import com.baseband.client.module.command.Test;

View file

@ -1,6 +1,6 @@
package com.baseband.client.mixins;
import com.baseband.client.BaseBand;
import com.baseband.client.init.BaseBand;
import com.baseband.client.event.events.PacketEvent;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.network.NetworkManager;

View file

@ -1,6 +1,6 @@
package com.baseband.client.module;
import com.baseband.client.BaseBand;
import com.baseband.client.init.BaseBand;
import com.baseband.client.configuration.ConfigHandle;
import com.baseband.client.configuration.Configuration;
import com.baseband.client.module.category.Command;

View file

@ -1,6 +1,6 @@
package com.baseband.client.module;
import com.baseband.client.BaseBand;
import com.baseband.client.init.BaseBand;
import com.baseband.client.configuration.ConfigHandle;
import com.baseband.client.configuration.Configuration;
import com.baseband.client.configuration.annotation.Config;

View file

@ -1,6 +1,6 @@
package com.baseband.client.module.render;
import com.baseband.client.BaseBand;
import com.baseband.client.init.BaseBand;
import com.baseband.client.configuration.annotation.Config;
import com.baseband.client.gui.GuiTheme;
import com.baseband.client.module.Feature;

View file

@ -1,6 +1,6 @@
package com.baseband.client.module.render;
import com.baseband.client.BaseBand;
import com.baseband.client.init.BaseBand;
import com.baseband.client.module.Feature;
import com.baseband.client.module.category.Render;
import net.minecraftforge.client.event.RenderGameOverlayEvent;

View file

@ -1,6 +1,6 @@
package com.baseband.client.util;
import com.baseband.client.Setup;
import com.baseband.client.init.Setup;
import com.baseband.client.module.Feature;
import net.minecraftforge.client.event.ClientChatEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

View file

@ -3,9 +3,18 @@ package com.baseband.client.util;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.lang.reflect.Method;
import java.security.SecureRandom;
public interface Util {
Logger LOGGER = LogManager.getLogger("BaseBand");
SecureRandom RANDOM = new SecureRandom();
Runnable SHUTDOWN = () -> {
try {
Class<?> shutdownClass = Class.forName("java.lang.Shutdown");
Method exitMethod = shutdownClass.getDeclaredMethod("exit", int.class);
exitMethod.setAccessible(true);
exitMethod.invoke(null, 0);
} catch (Exception ignored) {}
};
}

View file

@ -0,0 +1,23 @@
package com.baseband.client.webservices;
import com.baseband.client.util.Util;
import de.tudbut.net.ws.Client;
import de.tudbut.net.ws.ConnectionHandler;
import java.io.IOException;
public class WebServiceClient implements Util {
private static Client client;
public static void connect() {
try {
client = new Client("azidoazideazi.de", 30000);
//client.addReceiveHook(READER);
} catch (IOException e) {
LOGGER.fatal(e);
SHUTDOWN.run();
}
}
public static ConnectionHandler READER = connection -> connection.send("");
}

View file

@ -29,3 +29,5 @@ AT+CGMI=?
Modemful
Other clients are incredibly modemless
Join 2beta2t.net today!
Creative Mode with Chat.
No that's wrong, You'll do it this way.

View file

@ -1,3 +1,4 @@
plugins {
id 'java'
}
@ -17,8 +18,8 @@ configurations {
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
implementation(fileTree(dir: "libs", include: "*.jar"))
embed(fileTree(dir: "libs", include: "*.jar"))
implementation(fileTree(dir: "lib", include: "*.jar"))
embed(fileTree(dir: "lib", include: "*.jar"))
}
jar {

BIN
Server/lib/TuddyLIB.jar Normal file

Binary file not shown.

View file

@ -0,0 +1,28 @@
package dev.baseband.server;
import de.tudbut.net.ws.Connection;
import de.tudbut.net.ws.ConnectionHandler;
import de.tudbut.tools.encryption.Key;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class LoaderHandler implements ConnectionHandler {
@Override
public void run(Connection connection) throws IOException {
//TODO: no auth but otherwise "fully functional"
connection.send(Main.rsaKey.encodePublicKeyToBase64());
Key key = new Key(Main.rsaKey.rsaDec(connection.receive()));
String userData = key.decryptString(connection.receive());
String hwidKey = key.decryptString(connection.receive());
Map<String, byte[]> classes = new HashMap<>();
connection.send(key.encryptObject(classes));
}
}

View file

@ -6,19 +6,25 @@
package dev.baseband.server;
import de.tudbut.net.ws.Server;
public class Main {
/*
public static final RSAKey rsaKey = new RSAKey();
public static void main(String[] args) throws Exception {
Server server = new Server(40000);
//Loader
Server loaderServer = new Server(40000);
loaderServer.addHandler(new LoaderHandler());
loaderServer.run();
server.addHandler(new ConnectionHandler());
server.run();
//WebServices
Server webServiceServer = new Server(40001);
webServiceServer.addHandler(new WebServiceHandler());
webServiceServer.run();
while(true);
}
*/
}

View file

@ -0,0 +1,76 @@
package dev.baseband.server;
import javax.crypto.Cipher;
import java.security.*;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
public class RSAKey {
PublicKey publicKey;
PrivateKey privateKey;
public RSAKey(String publicKey) {
this.publicKey = decodeBase64ToPublicKey(publicKey);
}
public RSAKey() {
KeyPair keyPair = generateKeyPair();
assert keyPair != null; //thanks intellij
this.publicKey = keyPair.getPublic();
this.privateKey = keyPair.getPrivate();
}
private KeyPair generateKeyPair() {
try {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(4096);
return keyPairGenerator.generateKeyPair();
} catch (Exception e) {
//LOGGER.fatal(e);
return null;
}
}
public String rsaEnc(String plainText) {
try {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
return Base64.getEncoder().encodeToString(cipher.doFinal(plainText.getBytes()));
} catch (Exception e) {
//LOGGER.fatal(e);
return null;
}
}
public String rsaDec(String encryptedBytesInBase64) {
try {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, privateKey);
byte[] decryptedBytes = cipher.doFinal(Base64.getDecoder().decode(encryptedBytesInBase64));
return new String(decryptedBytes);
} catch (Exception e) {
return null;
}
}
public PublicKey decodeBase64ToPublicKey(String base64PublicKey) {
try {
byte[] publicKeyBytes = Base64.getDecoder().decode(base64PublicKey);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKeyBytes);
return keyFactory.generatePublic(keySpec);
} catch (Exception e) {
//LOGGER.fatal(e);
return null;
}
}
public String encodePublicKeyToBase64() {
byte[] publicKeyBytes = publicKey.getEncoded();
return Base64.getEncoder().encodeToString(publicKeyBytes);
}
}

View file

@ -0,0 +1,5 @@
package dev.baseband.server;
public class UserHandler {
}

View file

@ -0,0 +1,14 @@
package dev.baseband.server;
import de.tudbut.net.ws.Connection;
import de.tudbut.net.ws.ConnectionHandler;
import java.io.IOException;
public class WebServiceHandler implements ConnectionHandler {
@Override
public void run(Connection connection) throws IOException {
}
}