Final touch-ups

This commit is contained in:
q13x 2024-03-22 17:16:37 -07:00
parent 26275fa0d7
commit 9c98cbf581
8 changed files with 486 additions and 754 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -20,6 +20,16 @@ This assumes that you have [Node.js](https://nodejs.org/en) LTS or higher instal
4. Compile the TypeScript code into normal JavaScript code (`tsc`). 4. Compile the TypeScript code into normal JavaScript code (`tsc`).
5. Go into the `build` directory, and run `node index.js`. 5. Go into the `build` directory, and run `node index.js`.
### Important: For non-traditional runtime environments
For the most part, this proxy (and its dependencies) transpiles to pure JavaScript, and does not require anything more than a full implementation of the Node.js API (with the exception of node-gyp/native support). _Crypto support is required for the proxy to run._
**<u>If you are running the proxy through either Termux or CodeSandbox's on-device runtime:</u>**
1. Uninstall `sharp`, and ensure that `jimp` is installed.
2. Edit `config.ts` and set `adapter.useNatives` to `false`.
The above steps can solve any issues where the proxy immediately crashes with a segfault/illegal instruction error.
## Plugins ## Plugins
As of right now, there only exists one plugin: EagProxyAAS (read below for more information). As of right now, there only exists one plugin: EagProxyAAS (read below for more information).
@ -28,8 +38,6 @@ As of right now, there only exists one plugin: EagProxyAAS (read below for more
EagProxyAAS aims to allow any Eaglercraft client to connect to a normal 1.8.9 Minecraft server, provided that players own a legitimate Minecraft Java copy. EagProxyAAS aims to allow any Eaglercraft client to connect to a normal 1.8.9 Minecraft server, provided that players own a legitimate Minecraft Java copy.
_Demo server: `wss://eaglerproxy.q13x.com/` (not being hosted w/ Replit due to data transfer limits)_
#### I don't want to use this plugin! #### I don't want to use this plugin!
Remove all the folders in `src/plugins`. Remove all the folders in `src/plugins`.
@ -38,8 +46,6 @@ Remove all the folders in `src/plugins`.
**IMPORTANT:** Although the vanilla Eaglercraft client is a safe, modified copy of Minecraft AOT-compiled to JavaScript, I cannot guarantee that you **will not get flagged by all anticheats.** While gameplay and testing has shown to be relatively stable and free of anticheat flags, more testing is needed to derive a conclusion on whether or not using EaglerProxy with EagProxyAAS is safe. **IMPORTANT:** Although the vanilla Eaglercraft client is a safe, modified copy of Minecraft AOT-compiled to JavaScript, I cannot guarantee that you **will not get flagged by all anticheats.** While gameplay and testing has shown to be relatively stable and free of anticheat flags, more testing is needed to derive a conclusion on whether or not using EaglerProxy with EagProxyAAS is safe.
**ADVISORY FOR HYPIXEL PLAYERS:** This software falls under Hypixel's "disallowed modifications" category, as the proxy intercepts and changes how your client communicates to Hypixel's servers. **HYPIXEL WILL NOT UNBAN YOU IF YOU ARE FALSELY BANNED!** Modifying the plugin to remove this Hypixel check is not recommended. You are responsible for any action(s) that are taken against your Minecraft account!
EaglerProxy and EagProxyAAS: EaglerProxy and EagProxyAAS:
- is compatible with EaglercraftX and uses its handshake system, - is compatible with EaglercraftX and uses its handshake system,
@ -56,19 +62,6 @@ EaglerProxy and EagProxyAAS does NOT:
Remember, open source software is never 100% safe. Read what you run on your computer. Remember, open source software is never 100% safe. Read what you run on your computer.
##### Expectations
The built-in plugin serves as a demonstration of what can be done with plugins. Below is a list of what to expect from this demo.
- Expect server and world switching to take anywhere from 5 seconds to over 20.
- Not much can be done to resolve this issue. Issues related to this will likely be closed and marked as invalid.
- It is important that you refrain from moving your mouse and typing on your keyboard during this period. Doing so will increase your chance of timing out, or being unexpectedly kicked with the "End of stream" error.
- Expect the game to be unplayable (1-2 FPS at worst, maybe 30 FPS at best).
- This is not something fixable on my behalf, as Eaglercraft itself has a history of being slow and laggy. Despite improvments made to the game in attempt to increase performance, Eaglercraft still remains slow and barely playable.
- Try turning down your video settings to off/the lowest setting allowed. Unfullscreening and making your browser window smaller may result in higher FPS.
- Expect to be flagged by anticheats.
- While testing has shown the proxy and plugin to be relatively safe to play on, it is not guaranteed that you will not get flagged and banned on every single server out there.
### Plugin Development ### Plugin Development
### Disclaimer ### Disclaimer
@ -97,7 +90,9 @@ Below is a breakdown of everything inside of `metadata.json`:
As of right now, there exists no API reference. Please refer to the preinstalled plugin for details regarding API usage. As of right now, there exists no API reference. Please refer to the preinstalled plugin for details regarding API usage.
## Reporting Issues ## Reporting Issues
**NOTE:** Issues asking for help will be converted into discussions.
**NOTE:** Issues asking for help will be converted into discussions. You are expected to have **thoroughly** read all documentation prior to asking for help.
- Security-related bugs/issues: Directly contact me on Discord (check my profile). - Security-related bugs/issues: Directly contact me on Discord (check my profile).
- Non-security-related bugs/issues: Open a new issue, with the following: - Non-security-related bugs/issues: Open a new issue, with the following:
- Bug description - Bug description

1207
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,6 @@
"@types/ws": "8.5.4", "@types/ws": "8.5.4",
"chalk": "5.2.0", "chalk": "5.2.0",
"dotenv": "16.0.3", "dotenv": "16.0.3",
"jimp": "^0.22.12",
"minecraft-protocol": "^1.26.5", "minecraft-protocol": "^1.26.5",
"node-fetch": "3.3.1", "node-fetch": "3.3.1",
"parse-domain": "7.0.1", "parse-domain": "7.0.1",
@ -25,6 +24,7 @@
"prismarine-chunk": "1.33.0", "prismarine-chunk": "1.33.0",
"prismarine-registry": "1.6.0", "prismarine-registry": "1.6.0",
"semver": "^7.6.0", "semver": "^7.6.0",
"sharp": "^0.33.2",
"ws": "8.12.0" "ws": "8.12.0"
}, },
"type": "module" "type": "module"

View File

@ -9,7 +9,7 @@ export const config: Config = {
bindHost: "0.0.0.0", bindHost: "0.0.0.0",
bindPort: 8080, bindPort: 8080,
maxConcurrentClients: 20, maxConcurrentClients: 20,
useNatives: false, useNatives: true,
skinServer: { skinServer: {
skinUrlWhitelist: undefined, skinUrlWhitelist: undefined,
cache: { cache: {

View File

@ -2,15 +2,8 @@ import { Constants } from "../Constants.js";
import { Enums } from "../Enums.js"; import { Enums } from "../Enums.js";
import { MineProtocol } from "../Protocol.js"; import { MineProtocol } from "../Protocol.js";
import { Util } from "../Util.js"; import { Util } from "../Util.js";
import sharp from "sharp";
import { Proxy } from "../Proxy.js";
import { Player } from "../Player.js"; import { Player } from "../Player.js";
import { CSChannelMessagePacket } from "../packets/channel/CSChannelMessage.js";
import { SCChannelMessagePacket } from "../packets/channel/SCChannelMessage.js";
import { Logger } from "../../logger.js";
import fetch from "node-fetch"; import fetch from "node-fetch";
import Jimp from "jimp";
import { ImageEditor } from "./ImageEditor.js";
import ExponentialBackoffRequestController from "../ratelimit/ExponentialBackoffRequestController.js"; import ExponentialBackoffRequestController from "../ratelimit/ExponentialBackoffRequestController.js";
// TODO: convert all functions to use MineProtocol's UUID manipulation functions // TODO: convert all functions to use MineProtocol's UUID manipulation functions
@ -72,7 +65,6 @@ export namespace EaglerSkins {
export async function skinUrlFromUuid(uuid: string): Promise<string> { export async function skinUrlFromUuid(uuid: string): Promise<string> {
const response = (await (await fetch(`https://sessionserver.mojang.com/session/minecraft/profile/${uuid}`)).json()) as unknown as MojangFetchProfileResponse; const response = (await (await fetch(`https://sessionserver.mojang.com/session/minecraft/profile/${uuid}`)).json()) as unknown as MojangFetchProfileResponse;
const parsed = JSON.parse(Buffer.from(response.properties[0].value, "base64").toString()) as unknown as MojangTextureResponse; const parsed = JSON.parse(Buffer.from(response.properties[0].value, "base64").toString()) as unknown as MojangTextureResponse;
console.log(parsed.textures.SKIN.url);
return parsed.textures.SKIN.url; return parsed.textures.SKIN.url;
} }
@ -143,7 +135,6 @@ export namespace EaglerSkins {
export function writeServerFetchSkinResultBuiltInPacket(uuid: string | Buffer, skinId: number): Buffer { export function writeServerFetchSkinResultBuiltInPacket(uuid: string | Buffer, skinId: number): Buffer {
uuid = typeof uuid == "string" ? Util.uuidStringToBuffer(uuid) : uuid; uuid = typeof uuid == "string" ? Util.uuidStringToBuffer(uuid) : uuid;
console.log(1);
return Buffer.concat([Buffer.from([Enums.EaglerSkinPacketId.SFetchSkinBuiltInRes]), uuid as Buffer, Buffer.from([skinId >> 24, skinId >> 16, skinId >> 8, skinId & 0xff])]); return Buffer.concat([Buffer.from([Enums.EaglerSkinPacketId.SFetchSkinBuiltInRes]), uuid as Buffer, Buffer.from([skinId >> 24, skinId >> 16, skinId >> 8, skinId & 0xff])]);
} }

View File

@ -2,11 +2,10 @@ import { Constants } from "../Constants.js";
import { Enums } from "../Enums.js"; import { Enums } from "../Enums.js";
import { MineProtocol } from "../Protocol.js"; import { MineProtocol } from "../Protocol.js";
import { Util } from "../Util.js"; import { Util } from "../Util.js";
import Jimp from "jimp";
import fs from "fs/promises"; import fs from "fs/promises";
// let Jimp: Jimp = null; let Jimp: Jimp = null;
// type Jimp = any; type Jimp = any;
let sharp: any = null; let sharp: any = null;
type Sharp = any; type Sharp = any;

View File

@ -83,7 +83,7 @@ export class SkinServer {
const parsedPacket_1 = EaglerSkins.readClientDownloadSkinRequestPacket(packet.data), const parsedPacket_1 = EaglerSkins.readClientDownloadSkinRequestPacket(packet.data),
url = new URL(parsedPacket_1.url).hostname; url = new URL(parsedPacket_1.url).hostname;
if (!this.allowedSkinDomains.some((domain) => Util.areDomainsEqual(domain, url))) { if (!this.allowedSkinDomains.some((domain) => Util.areDomainsEqual(domain, url))) {
this._logger.warn(`Player ${caller.username} tried to download a skin with a disallowed domain name(${url})!`); this._logger.warn(`Player ${caller.username} tried to download a skin with a disallowed domain name (${url})!`);
break; break;
} }
try { try {
@ -102,7 +102,7 @@ export class SkinServer {
}); });
} }
} else { } else {
skin = await EaglerSkins.downloadSkin(parsedPacket_1.url); skin = await EaglerSkins.safeDownloadSkin(parsedPacket_1.url, this.backoffController);
} }
const processed = this.usingNative ? await ImageEditor.toEaglerSkin(skin) : await ImageEditor.toEaglerSkinJS(skin), const processed = this.usingNative ? await ImageEditor.toEaglerSkin(skin) : await ImageEditor.toEaglerSkinJS(skin),