CloudburstMC / ProxyPass

MITM proxy tool for Minecraft: Bedrock Edition
GNU Affero General Public License v3.0
131 stars 47 forks source link

Minecraft clients unable to connect to ProxyPass running locally #2

Closed hach-que closed 4 years ago

hach-que commented 5 years ago

I'm trying to get this to work so that I can intercept the skin data and chain data that the Minecraft client sends to a server (trying to use the protocol library to write a bot that can capture all the chat messages).

I'm running it with this configuration:

## Address proxy will bind to.
proxy:
  host: 127.0.0.1
  port: 19122
## Destination server which the client will connect to.
## You are only able to join offline mode servers
destination:
  host: 34.94.110.9
  port: 19132
## Pass packet buffers through to minimize processing (Disable to test protocol library for bugs)
pass-through: true
## Log packets for each session
log-packets: true

My server.properties has online-mode=false.

This is the output from running ProxyPass:

C:\Users\jrhod\Documents\Projects\ProxyPass>mvn clean package exec:java -Dexec.mainClass=com.nukkitx.proxypass.ProxyPass
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.nukkitx:proxypass:jar:1.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 80, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-shade-plugin is missing. @ line 93, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -----------------------< com.nukkitx:proxypass >------------------------
[INFO] Building ProxyPass 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ proxypass ---
[INFO] Deleting C:\Users\jrhod\Documents\Projects\ProxyPass\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ proxypass ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ proxypass ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to C:\Users\jrhod\Documents\Projects\ProxyPass\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ proxypass ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\jrhod\Documents\Projects\ProxyPass\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ proxypass ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ proxypass ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ proxypass ---
[INFO] Building jar: C:\Users\jrhod\Documents\Projects\ProxyPass\target\proxypass-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-shade-plugin:3.2.1:shade (default) @ proxypass ---
[INFO] Including com.nukkitx.protocol:bedrock-v354:jar:2.0.2 in the shaded jar.
[INFO] Including com.nukkitx.protocol:bedrock-common:jar:2.0.2 in the shaded jar.
[INFO] Including com.nukkitx.protocol:common:jar:2.0.2 in the shaded jar.
[INFO] Including com.nukkitx.network:common:jar:1.5.4 in the shaded jar.
[INFO] Including io.netty:netty-buffer:jar:4.1.36.Final in the shaded jar.
[INFO] Including io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.36.Final in the shaded jar.
[INFO] Including io.netty:netty-transport-native-unix-common:jar:4.1.36.Final in the shaded jar.
[INFO] Including io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.36.Final in the shaded jar.
[INFO] Including cn.nukkit:nukkit-natives:jar:1.0.1-SNAPSHOT in the shaded jar.
[INFO] Including com.nukkitx:nbt:jar:1.2.0 in the shaded jar.
[INFO] Including com.flowpowered:flow-math:jar:1.0.3 in the shaded jar.
[INFO] Including net.sf.trove4j:trove:jar:3.1.0-SNAPSHOT in the shaded jar.
[INFO] Including net.sf.trove4j:trove-generator:jar:3.1.0-SNAPSHOT in the shaded jar.
[INFO] Including com.nukkitx.network:raknet:jar:1.5.4 in the shaded jar.
[INFO] Including io.netty:netty-handler:jar:4.1.36.Final in the shaded jar.
[INFO] Including io.netty:netty-common:jar:4.1.36.Final in the shaded jar.
[INFO] Including io.netty:netty-transport:jar:4.1.36.Final in the shaded jar.
[INFO] Including io.netty:netty-resolver:jar:4.1.36.Final in the shaded jar.
[INFO] Including io.netty:netty-codec:jar:4.1.36.Final in the shaded jar.
[INFO] Including com.nimbusds:nimbus-jose-jwt:jar:4.41.2 in the shaded jar.
[INFO] Including com.github.stephenc.jcip:jcip-annotations:jar:1.0-1 in the shaded jar.
[INFO] Including net.minidev:json-smart:jar:2.3 in the shaded jar.
[INFO] Including net.minidev:accessors-smart:jar:1.2 in the shaded jar.
[INFO] Including com.fasterxml.jackson.core:jackson-databind:jar:2.9.6 in the shaded jar.
[INFO] Including com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0 in the shaded jar.
[INFO] Including com.fasterxml.jackson.core:jackson-core:jar:2.9.6 in the shaded jar.
[INFO] Including com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.9.6 in the shaded jar.
[INFO] Including org.yaml:snakeyaml:jar:1.18 in the shaded jar.
[INFO] Including com.nukkitx:common:jar:1.0.1-SNAPSHOT in the shaded jar.
[INFO] Including com.nukkitx:common-api:jar:1.0.1-SNAPSHOT in the shaded jar.
[INFO] Including com.google.guava:guava:jar:23.0 in the shaded jar.
[INFO] Including com.google.errorprone:error_prone_annotations:jar:2.0.18 in the shaded jar.
[INFO] Including com.google.j2objc:j2objc-annotations:jar:1.1 in the shaded jar.
[INFO] Including org.codehaus.mojo:animal-sniffer-annotations:jar:1.14 in the shaded jar.
[INFO] Including ch.jalu:injector:jar:0.3 in the shaded jar.
[INFO] Including javax.inject:javax.inject:jar:1 in the shaded jar.
[INFO] Including org.slf4j:slf4j-api:jar:1.7.21 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-api:jar:2.11.1 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-core:jar:2.11.1 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-slf4j-impl:jar:2.11.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm:jar:5.2 in the shaded jar.
[INFO] Including org.fusesource.jansi:jansi:jar:1.17.1 in the shaded jar.
[INFO] Including org.jline:jline-reader:jar:3.7.0 in the shaded jar.
[INFO] Including org.jline:jline-terminal:jar:3.7.0 in the shaded jar.
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing C:\Users\jrhod\Documents\Projects\ProxyPass\target\proxypass-1.0.0-SNAPSHOT.jar with C:\Users\jrhod\Documents\Projects\ProxyPass\target\proxypass-1.0.0-SNAPSHOT-shaded.jar
[INFO] Dependency-reduced POM written at: C:\Users\jrhod\Documents\Projects\ProxyPass\dependency-reduced-pom.xml
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:java (default-cli) @ proxypass ---
[21:49:19 DEBUG]: Using SLF4J as the default logging framework
[21:49:19 INFO ]: Loading configuration...
[21:49:19 INFO ]: Loading server...
[21:49:19 DEBUG]: -Dio.netty.eventLoopThreads: 16
[21:49:19 DEBUG]: -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
[21:49:19 DEBUG]: -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
[21:49:19 DEBUG]: -Dio.netty.noKeySetOptimization: false
[21:49:19 DEBUG]: -Dio.netty.selectorAutoRebuildThreshold: 512
[21:49:19 DEBUG]: Platform: Windows
[21:49:19 DEBUG]: -Dio.netty.noUnsafe: false
[21:49:19 DEBUG]: Java version: 8
[21:49:19 DEBUG]: sun.misc.Unsafe.theUnsafe: available
[21:49:19 DEBUG]: sun.misc.Unsafe.copyMemory: available
[21:49:19 DEBUG]: java.nio.Buffer.address: available
[21:49:19 DEBUG]: direct buffer constructor: available
[21:49:19 DEBUG]: java.nio.Bits.unaligned: available, true
[21:49:19 DEBUG]: jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable prior to Java9
[21:49:19 DEBUG]: java.nio.DirectByteBuffer.<init>(long, int): available
[21:49:19 DEBUG]: sun.misc.Unsafe: available
[21:49:19 DEBUG]: -Dio.netty.tmpdir: C:\Users\jrhod\AppData\Local\Temp (java.io.tmpdir)
[21:49:19 DEBUG]: -Dio.netty.bitMode: 64 (sun.arch.data.model)
[21:49:19 DEBUG]: -Dio.netty.maxDirectMemory: 3795845120 bytes
[21:49:19 DEBUG]: -Dio.netty.uninitializedArrayAllocationThreshold: -1
[21:49:19 DEBUG]: java.nio.ByteBuffer.cleaner(): available
[21:49:19 DEBUG]: -Dio.netty.noPreferDirect: false
[21:49:19 DEBUG]: org.jctools-core.MpscChunkedArrayQueue: available
[21:49:19 DEBUG]: -Dio.netty.leakDetection.level: simple
[21:49:19 DEBUG]: -Dio.netty.leakDetection.targetRecords: 4
[21:49:19 DEBUG]: -Dio.netty.allocator.numHeapArenas: 16
[21:49:19 DEBUG]: -Dio.netty.allocator.numDirectArenas: 16
[21:49:19 DEBUG]: -Dio.netty.allocator.pageSize: 8192
[21:49:19 DEBUG]: -Dio.netty.allocator.maxOrder: 11
[21:49:19 DEBUG]: -Dio.netty.allocator.chunkSize: 16777216
[21:49:19 DEBUG]: -Dio.netty.allocator.tinyCacheSize: 512
[21:49:19 DEBUG]: -Dio.netty.allocator.smallCacheSize: 256
[21:49:19 DEBUG]: -Dio.netty.allocator.normalCacheSize: 64
[21:49:19 DEBUG]: -Dio.netty.allocator.maxCachedBufferCapacity: 32768
[21:49:19 DEBUG]: -Dio.netty.allocator.cacheTrimInterval: 8192
[21:49:19 DEBUG]: -Dio.netty.allocator.cacheTrimIntervalMillis: 0
[21:49:19 DEBUG]: -Dio.netty.allocator.useCacheForAllThreads: true
[21:49:19 DEBUG]: -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
[21:49:19 DEBUG]: -Dio.netty.processId: 2812 (auto-detected)
[21:49:19 DEBUG]: -Djava.net.preferIPv4Stack: false
[21:49:19 DEBUG]: -Djava.net.preferIPv6Addresses: false
[21:49:20 DEBUG]: Loopback interface: lo (Software Loopback Interface 1, 127.0.0.1)
[21:49:20 DEBUG]: Failed to get SOMAXCONN from sysctl and file \proc\sys\net\core\somaxconn. Default: 200
[21:49:20 DEBUG]: -Dio.netty.machineId: 30:85:a9:ff:fe:a3:5d:09 (auto-detected)
[21:49:20 DEBUG]: -Dio.netty.allocator.type: pooled
[21:49:20 DEBUG]: -Dio.netty.threadLocalDirectBufferSize: 0
[21:49:20 DEBUG]: -Dio.netty.maxThreadLocalCharBufferSize: 16384
[21:49:20 INFO ]: RakNet server started on /127.0.0.1:19122

But Minecraft doesn't see the server, and it won't talk to it at all:

image

image

image

As an aside, I've been able to get my bot to connect to the Minecraft server, but it immediately gets disconnected because of invalid auth (hence trying to capture the skin and chain data from a real client). You can see the code I have here (the version I got connecting was basically this, but with empty strings sent for chain data and skin data in the LoginPacket). If there's alternate content I can provide for those values for offline mode servers that I can set that don't require all this signing / capturing chain/skin data, then that would also be useful.

SupremeMortal commented 5 years ago

Do you have loopback exemption enabled? UWP by default blocks all local connections to apps for security reasons. This should fix it: https://nukkitx.com/threads/fix-cannot-connect-to-servers-hosted-on-the-same-computer-with-windows-10-edition.41/