ServerMessage of new crypto

Results 1 to 13 of 13
  1. #1

    ServerMessage of new crypto

    PHP Code:
    package com.monster.messages;

    import com.monster.utils.HabboEncoding;

    /*
     * @author Daniel
     */

    public class ServerMessage {

        private static 
    StringBuilder a;
        private static 
    StringBuilder b;
        private static 
    int Header;
        
        public 
    ServerMessage(int header) {
            
    // Define vars and if of the packet
            
    Header header;
            
    = new StringBuilder();
            
    = new StringBuilder();
            
    a.append(HabboEncoding.EncodeInt16(Header));
        }

        public 
    void writeInt(int c) {
            
    // Define a int32 data
            
    a.append(HabboEncoding.EncodeInt32(c));
        }
        
        public 
    void writeShort(int c) {
            
    // Define a int16(short) data
            
    a.append(HabboEncoding.EncodeInt16(c));
        }

        public 
    void writeUFT(String c) {
            
    // Define a String data
            // First a int16 with the length of the String
            
    a.append(HabboEncoding.EncodeInt16(c.length()));
            
    // Then the String
            
    a.append(c);
        }

        public 
    void writeBoolean(boolean c) {
            
    // Define a boolean data
            
    a.append((char)(0));
        }

        public 
    String Packet() {
            
    // Define a complete packet
            // Length of the (id + packet)
            
    b.append(HabboEncoding.EncodeInt32(a.length()));
            
    // Id + packet
            
    b.append(a);
            return 
    b.toString();
        }
        

    HabboEncoding by LittleJ: New Habbo Crypto RELEASE 2 en Herramientas & Utilidades - Página 1

    Credits:
    - Goir
    - ItachiKM
    - LittleJ

    Enjoy!


  2. #2
    Member EliteRoyal is offline
    MemberRank
    Mar 2011 Join Date
    Santo Domingo,Location
    55Posts

    Re: ServerMessage of new crypto

    Awesome men!
    This is the type of aports that this community needs!

  3. #3
    j’aime ma famille dominic is offline
    MemberRank
    Aug 2012 Join Date
    ~/Location
    611Posts

    Re: ServerMessage of new crypto

    Quote Originally Posted by EliteRoyal View Post
    Awesome men!
    This is the type of aports that this community needs!
    Was already released somewhere.

  4. #4
    Zephyr Studios PRIZM is offline
    MemberRank
    Feb 2012 Join Date
    DenmarkLocation
    2,291Posts

    Re: ServerMessage of new crypto

    Quote Originally Posted by mikkelfriis View Post
    Was already released somewhere.
    Hey wizcsharp

  5. #5

    Re: ServerMessage of new crypto

    Quote Originally Posted by mikkelfriis View Post
    Was already released somewhere.
    But if you've created from scratch.

  6. #6
    Enthusiast Ard0x is offline
    MemberRank
    Aug 2012 Join Date
    OrléansLocation
    41Posts

    Re: ServerMessage of new crypto

    Thx .

  7. #7
    Member CobraSnip is offline
    MemberRank
    Apr 2011 Join Date
    BlackburnLocation
    60Posts

    Re: ServerMessage of new crypto

    This is a good release.

  8. #8
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,479Posts

    Re: ServerMessage of new crypto

    Since we're sharing our codez, might as well post mine. (These are for Java - without using any sort of IO)

    ServerMessage/Response

    PHP Code:

    import java
    .io.ByteArrayOutputStream;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.nio.charset.Charset;

    public class 
    Response
    {
        private 
    int Header;
        private 
    ByteArrayOutputStream lastByteStream;
        private 
    ByteArrayOutputStream packetByteStream;
        private 
    DataOutputStream packet;
        private 
    DataOutputStream last;

        public 
    Response() {
        }

        public 
    Response Initialize(int Header)
        {
            try
            {
                
    this.lastByteStream = new ByteArrayOutputStream();
                
    this.packetByteStream = new ByteArrayOutputStream();
                
    this.last = new DataOutputStream(lastByteStream);
                
    this.packet = new DataOutputStream(packetByteStream);
                
    this.Header Header;
            }
            catch (
    Exception e)
            {
                
    e.printStackTrace();
            }
            return 
    this;
        }

        public 
    Response AppendInt32(int obj)
        {
            try
            {
                
    packet.writeInt(obj);
            }
            catch (
    Exception e)
            {
                
    e.printStackTrace();
            }
            return 
    this;
        }

        public 
    Response AppendString(String str)
        {
            try
            {
                
    packet.writeShort(str.length());
                
    packet.writeBytes(str);
            }
            catch (
    Exception e)
            {
                
    e.printStackTrace();
            }
            return 
    this;
        }

        public 
    Response AppendString(Integer i)
        {
            
    this.AppendString("" i);
            
            return 
    this;
        }

        public 
    Response AppendBoolean(Boolean b)
        {
            try
            {
                
    packet.writeByte(0);
            }
            catch (
    Exception e)
            {
                
    e.printStackTrace();
            }
            return 
    this;
        }
        

        public 
    void AppendBody(ISerialize obj) {
            
    obj.SerializePacket(this);
            
        }

        public 
    byte[] toBytes()
        {
            try
            {
                
    byte[] data packetByteStream.toByteArray();

                
    last.writeInt(data.length 2);
                
    last.writeShort(Header);
                
    last.write(data);

                return 
    lastByteStream.toByteArray();
            }
            catch (
    Exception e)
            {
                
    e.printStackTrace();
            }
            return 
    null;

        }

        public 
    int getHeader() {

            return 
    Header;
        }

    ClientMessage/Request

    PHP Code:

    import java
    .io.DataInputStream;

    public class 
    Request implements Cloneable
    {
        private 
    Short Header;
        private 
    byte[] content;
        private 
    DataInputStream stream;

        public 
    Request(Short idDataInputStream streambyte[] content)
        {
            
    this.Header id;
            
    this.content content;
            
    this.stream stream;
        }


        public 
    Integer PopInt32()
        {
            
    int i 0;
            try
            {
                
    stream.readInt();
            }
            catch (
    Exception e)
            {
                
    e.printStackTrace();
            }
            return 
    i;
        }

        public 
    int popFixedInt()
        {
            
    int i 0;
            
    String s PopFixedString();

            
    Integer.parseInt(s);

            return 
    i;
        }


        public 
    String PopFixedString()
        {
            
    String i "";
            try
            {
                
    stream.readUTF();
            }
            catch (
    Exception e)
            {
                
    e.printStackTrace();
            }
            return 
    i;
        }

        public 
    Short GetHeader()
        {
            return 
    this.Header;
        }

        public 
    String getBodyString()
        {
            
    String str = new String(content);

            
    String consoleText str;

            for (
    int i 013i++) { 
                
    consoleText consoleText.replace(Character.toString((char)i), "{" "}");
            }

            return 
    consoleText;
        }

        public 
    int getCurrentLength()
        {
            
    int len 0;
            try
            {
                
    len stream.available();
            }
            catch (
    Exception e)
            {
                
    e.printStackTrace();
            }
            return 
    len;
        }


  9. #9
    Apprentice Goir is offline
    MemberRank
    Nov 2011 Join Date
    20Posts

    Re: ServerMessage of new crypto

    It's okay. But, this must used for Java.net or Java.nio because Netty has a special class for send bytes by Strings, Integers, Booleans...

  10. #10
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,479Posts

    Re: ServerMessage of new crypto

    Quote Originally Posted by Goir View Post
    It's okay. But, this must used for Java.net or Java.nio because Netty has a special class for send bytes by Strings, Integers, Booleans...
    So does Java in general.. DataInputStream and DataOutputStream.

  11. #11
    Evil Italian Overlowrd Droppy is offline
    [Internal Coder]Rank
    Feb 2012 Join Date
    /home/droppyLocation
    2,078Posts

    Re: ServerMessage of new crypto

    WOW! Very great Nasty!
    Good Work :D

  12. #12
    j’aime ma famille dominic is offline
    MemberRank
    Aug 2012 Join Date
    ~/Location
    611Posts

    Re: ServerMessage of new crypto

    Quote Originally Posted by Lasse View Post
    Hey wizcsharp
    Hello there.

  13. #13
    Alpha Member Zak© is offline
    MemberRank
    Oct 2007 Join Date
    2,693Posts

    Re: ServerMessage of new crypto

    Alex, and Mikkel this is the new ServerMessage, since the security was changed again.

    It's pretty much the same, but encoding is different.

    Code:
    public class HabboEncoding
    {
    	public static Byte[] EncodeInt16(int x)
    	{
    		return EncodeInt16((short)x);
    	}
    	public static Byte[] EncodeInt16(short x)
    	{
    		return new Byte[]{ (byte)(x >>> 8), (byte)x };
    	}
    	public static Byte[] EncodeInt32(int x)
    	{
    		return new Byte[]{ (byte)(x >>> 24), (byte)(x >>> 16), (byte)(x >>> 8), (byte)x };
    	}	
    	public static Byte[] EncodeString(String x)
    	{
    		Byte[] Output = new Byte[x.length() + 2];
    		int k = 0;
    		Byte[] EncodeInt16 = EncodeInt16(x.length());
    		
    		Output[k++] = EncodeInt16[0];
    		Output[k++] = EncodeInt16[1];
    		
    		for(byte c : x.getBytes())
    		{
    			Output[k++] = c;
    		}
    		
    		return Output;
    	}
    }



Advertisement