SolvedOooh boy.... Incorrect Portal Key w/ Proxy

Posts 112 of 12 · Page 1 of 1
Oooh boy.... Incorrect Portal Key w/ Proxy
@nilly @JustAnoobROTMG @IziLife @FainTMako

I've been making a C# proxy for release here, and all has been going mostly well except for the fact that it can't connect to dungeons!

Using any dungeon portal gets you disconnected with "Incorrect Portal Key", all others work fine. This happens with no plugins or anything running.

It seems im not the only one with this issue.
@flyrocket had this issue at one point with his proxy
@Alde. has it with some of his bots
@ossimc82 had it with his C# proxy, although, he managed to fix it on his end by disabling parsing of HELLO, but it doesn't work on anyone else machines for unknown reasons.

As far as I know, RR does not have this error.

What I've tried to fix the issue:
- Ensure that packet definitions for Hello and Reconnect match RR, Private server, etc
- Disable parsing of hello - just forward on the raw data.
- Disable parsing of useportal
- Only modify Name, Host, Port of reconnect and keep the rest of the raw data that was given to me at the end
- Ensure Key and KeyTime of hello match that of Reconnect
- Ensure hello is actually being properly sent before I get DCed with the error
- Bug everyone I know for help
- Cry

Some extra info:
I handle reconnects by changing the remote port and address of my proxy to that of the reconnect packet, and then change the reconnect packet host and port to localhost:2050.

I have been debugging this for a couple of days now, so now I made this thread...
Has anyone had this issue? How did you fix it?
Send help! Thanks :O
I think its because of BigEndians and LittleEndians, after some research I found out that you need to handle Endians in C#, thats why we need to reverse the bytes when we read the packet.
RR doesnt have this issue (I guess (Still dunno why odom got it then)) because the JVM uses only BigEndians and the rotmg server sends the bytes as LittleEndian, thats why we need to reverse them, but I tried multiple ways reversing them.
No Progress...
PS: please correct me if I am wrong
Maybe...
 
A Failure?

case ID_FAILURE:
{
$.echo(packet + " " + packet.errorId + " " + packet.errorDescription);
if (packet.errorId == 5) //Incorrect key, lets go to nexus instead
{
var recon = event.createPacket(ID_RECONNECT);
recon.name = "Bad Portal Key";
recon.host = "";
recon.port = 2050;
recon.gameId = -2;
event.sendToClient(recon);
}
break;
}
Quote Originally Posted by kola95 View Post
Maybe...
 
A Failure?

case ID_FAILURE:
{
$.echo(packet + " " + packet.errorId + " " + packet.errorDescription);
if (packet.errorId == 5) //Incorrect key, lets go to nexus instead
{
var recon = event.createPacket(ID_RECONNECT);
recon.name = "Bad Portal Key";
recon.host = "";
recon.port = 2050;
recon.gameId = -2;
event.sendToClient(recon);
}
break;
}
I'm not sure I understand what you're saying...
That would just send me back to the nexus?
Yes, if you are sending the correct byte array then it definitely would have to be the endianness of your situation.

Are you using a byte buffer when you read packets? If so everything should be fine when you flip your buffer.
@krazyshank


RECONNECT.key is a byte array

Since you can enter a realm that means an empty byte array will work


But when entering a dungeon your key will contains data, so something went wrong when you handle the packet


After few googling i found this: http://stackoverflow.com/questions/1...ray-to-c-sharp

Hope it will help
@IziLife @FainTMako
But the problem persists when I don't touch that data at all.
I don't read hello as a hello, I read it as raw data and pass it along as raw data, and I do the same with reconnect after Name, Host, Port.

- - - Updated - - -

I disabled all packets but HELLO and RECONNECT and I was able to join a dungeon.
I will get back to you all when I find out what autistic shit was fucking everything up for the past few days... ahah
000000000000000_0000000000000000
it was create success

this code is causing it and I don't know why
Code:
private void OnCreateSuccess(Client client, Packet createSuccessPacket)
 {
     // Restore the original connection info so new clients can connect normally
     _proxy.RemoteAddress = _originalHost;
     _proxy.Port = _originalPort;
}
Quote Originally Posted by krazyshank View Post
000000000000000_0000000000000000
it was create success

this code is causing it and I don't know why
Code:
private void OnCreateSuccess(Client client, Packet createSuccessPacket)
 {
     // Restore the original connection info so new clients can connect normally
     _proxy.RemoteAddress = _originalHost;
     _proxy.Port = _originalPort;
}
The very first packet you receive is MAPINFO, CREATE_SUCCESS comes after your send a CREATE/LOAD packet, so you might need to move that code ?
Quote Originally Posted by IziLife View Post
The very first packet you receive is MAPINFO, CREATE_SUCCESS comes after your send a CREATE/LOAD packet, so you might need to move that code ?
I was able to solve it by changing it back to default when a NEW client connects.
Gah I wish there were a "turn back now, all ye coding noobs who enter here". I've got enough confused jargon to impress my language instructor. Glad you got it fixed though!
Posts 112 of 12 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?