Thread: Connecting Galkon to Elvarg

Results 1 to 5 of 5
  1. #1 Connecting Galkon to Elvarg 
    Registered Member
    Join Date
    Oct 2017
    Posts
    11
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    So yeah I'm trying to get this [Only registered and activated users can see links. ] to connect to this [Only registered and activated users can see links. ]
    I have been playing around with the login block trying to match galkon's login block to elvarg's but im stuck on this error


    This is Elvarg's login block:
    Spoiler for Elvarg:
    Code:
    `		try {
    			if(name.length() < 3) {
    				firstLoginMessage = "";
    				secondLoginMessage = "Your username is too short.";
    				return;
    			}
    			if(password.length() < 3) {
    				firstLoginMessage = "";
    				secondLoginMessage = "Your password is too short.";
    				return;
    			}
    			if (!reconnecting) {
    				firstLoginMessage = "";
    				secondLoginMessage = "Connecting to server...";
    				drawLoginScreen();
    			}
    
    			outgoing = ByteBuffer.create(5000, false, null);
    			socketStream = new BufferedConnection(this,
    					openSocket(Configuration.SERVER_PORT + portOffset));
    
    
    			outgoing.putByte(14); //REQUEST
    			socketStream.queueBytes(1, outgoing.getBuffer());
    
    
    			int response = socketStream.read();
    
    			int copy = response;
    
    			//Our encryption for outgoing messages for this player's session
    			IsaacCipher cipher = null;
    
    			if (response == 0) {
    				socketStream.flushInputStream(incoming.payload, 8);
    				incoming.currentPosition = 0;
    				serverSeed = incoming.readLong(); // aka server session key
    				int seed[] = new int[4];
    				seed[0] = (int) (Math.random() * 99999999D);
    				seed[1] = (int) (Math.random() * 99999999D);
    				seed[2] = (int) (serverSeed >> 32);
    				seed[3] = (int) serverSeed;
    				outgoing.resetPosition();
    				outgoing.putByte(10);
    				outgoing.putInt(seed[0]);
    				outgoing.putInt(seed[1]);
    				outgoing.putInt(seed[2]);
    				outgoing.putInt(seed[3]);
    				outgoing.putInt(4 >> 1);
    				outgoing.putString(name);
    				outgoing.putString(password);
    				outgoing.encryptRSAContent();
    
    				login.currentPosition = 0;
    				login.writeByte(reconnecting ? 18 : 16);
    				login.writeByte(outgoing.getPosition() + 36 + 1 + 1 + 2); // size of the
    				// login block
    				login.writeByte(255);
    				login.writeShort(Configuration.CLIENT_VERSION); //Client version
    				login.writeByte(lowMemory ? 1 : 0); // low mem or not
    				login.writeBytes(outgoing.getBuffer(), outgoing.getPosition(), 0);              
    				cipher = new IsaacCipher(seed);
    				for (int index = 0; index < 4; index++)
    					seed[index] += 50;
    
    				encryption = new IsaacCipher(seed);
    				socketStream.queueBytes(login.currentPosition, login.payload);
    				response = socketStream.read();
    			}
    
    			outgoing = ByteBuffer.create(5000, true, cipher);`


    This is Galkon's current login block:
    Spoiler for Galkon:
    Code:
    		try
    		{
    			if(s.length() < 3) {
    				loginMessage1 = "";
    				loginMessage2 = "Your username is too short.";
    				return;
    			}
    			if(s1.length() < 3) {
    				loginMessage1 = "";
    				loginMessage2 = "Your password is too short.";
    				return;
    			}
    			if(!flag)
    			{
    				loginMessage1 = "";
    				loginMessage2 = "Connecting to server...";
    				drawLoginScreen(true);
    			}
    			socketStream = new RSSocket(this, openSocket(43594 + portOff));
    			long l = TextClass.longForName(s);
    			int i = (int)(l >> 16 & 31L);
    			stream.currentOffset = 0;
    			stream.writeWordBigEndian(14);
    			//stream.writeWordBigEndian(i);
    			socketStream.queueBytes(1, stream.buffer);
    			/*for(int j = 0; j < 8; j++)
    				socketStream.read();*/
    
    			int k = socketStream.read();
    			int i1 = k;
    			if(k == 0)
    			{
    				socketStream.flushInputStream(inStream.buffer, 8);
    				inStream.currentOffset = 0;
    				aLong1215 = inStream.readQWord();
    				int ai[] = new int[4];
    				ai[0] = (int)(Math.random() * 99999999D);
    				ai[1] = (int)(Math.random() * 99999999D);
    				ai[2] = (int)(aLong1215 >> 32);
    				ai[3] = (int)aLong1215;
    				stream.currentOffset = 0;
    				stream.writeWordBigEndian(10);
    				stream.writeDWord(ai[0]);
    				stream.writeDWord(ai[1]);
    				stream.writeDWord(ai[2]);
    				stream.writeDWord(ai[3]);
    				stream.writeDWord(signlink.uid);
    				stream.writeString(s);
    				stream.writeString(s1);
    				stream.doKeys();
    				login.currentOffset = 0;
    				login.writeWordBigEndian(flag ? 18 : 16);
    				login.writeWordBigEndian(stream.currentOffset + 36 + 1 + 1 + 2);
    				login.writeWordBigEndian(255);
    				login.writeWord(3);
    				login.writeWordBigEndian(lowMem ? 1 : 0);
    				/*for(int l1 = 0; l1 < 9; l1++)
    					login.writeDWord(expectedCRCs[l1]);*/
    
    				login.writeBytes(stream.buffer, stream.currentOffset, 0);
    				stream.encryption = new ISAACRandomGen(ai);
    				for(int j2 = 0; j2 < 4; j2++)
    					ai[j2] += 50;
    
    				encryption = new ISAACRandomGen(ai);
    				socketStream.queueBytes(login.currentOffset, login.buffer);
    				k = socketStream.read();
    			}
    			stream = Stream.create();
    			stream.encryption = encryption;
    Reply With Quote  
     

  2. #2  
    Registered Member Brainpower's Avatar
    Join Date
    Jan 2019
    Posts
    96
    Thanks given
    6
    Thanks received
    5
    Rep Power
    35
    Rip the RSA code from Elvarg, it's probably in the Stream class. Looks like this has to do with the public key mismatch.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2017
    Posts
    11
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Brainpower View Post
    Rip the RSA code from Elvarg, it's probably in the Stream class. Looks like this has to do with the public key mismatch.
    Already did that
    Reply With Quote  
     

  4. #4  
    Rune-Server Affiliate

    Join Date
    Oct 2010
    Posts
    2,845
    Thanks given
    1,191
    Thanks received
    1,589
    Rep Power
    5000
    why are you trying to do this? elvarg has custom networking and packets, you're going to run into a hundred problems after this one
    the client was based on galkon's anyway iirc lol
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    \_(ツ)_/


    Join Date
    Sep 2014
    Age
    22
    Posts
    2,531
    Thanks given
    1,488
    Thanks received
    1,490
    Rep Power
    5000
    Quote Originally Posted by Professor Oak View Post
    why are you trying to do this? elvarg has custom networking and packets, you're going to run into a hundred problems after this one
    the client was based on galkon's anyway iirc lol
    I was going to say, its a bit of a step backwards to do this.

    Dawntained - Autumn '19

    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Connecting client to elvarg 3.1
    By Jaybrav in forum Help
    Replies: 0
    Last Post: 11-20-2017, 03:01 AM
  2. Replies: 5
    Last Post: 03-15-2010, 05:29 AM
  3. Connecting MySQL to a 508 server?
    By deathschaos9 in forum Help
    Replies: 4
    Last Post: 11-27-2009, 09:43 PM
  4. Replies: 0
    Last Post: 08-06-2009, 03:53 PM
  5. Replies: 14
    Last Post: 07-19-2008, 07:31 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •