Example #1
0
 void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
     connection.SendPacket(new SMsg_0x25ACBEF4());
     connection.SendPacket(new SMsg_0x35BEBAA5());
     connection.SendPacket(new SMsg_0x04CCE2BB());
     connection.SendPacket(new SMsg_0x4BD75535());
 }
Example #2
0
 void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
     //uint objid = packet.ReadObjectIDRev();
     //packet.ReadByte();
     //TORLog.Info("@unknown Object" + objid);
     //connection.SendPacket(new SMsg_CharacterSelectResponse(objid));
 }
Example #3
0
 public void WritePacket(Commons.Networking.AsyncConnection connection, Commons.Networking.ByteBuffer packet)
 {
     packet.WriteUInt(_id);
     packet.WriteInt(_name.Length);
     packet.WriteBytes(Encoding.UTF8.GetBytes(_name));
     packet.WriteInt(_responseid);
 }
Example #4
0
 public static void RequestServerSignature(AsyncConnection con, string objectName)
 {
     uint responseid = 0;
     string data1 = "";
     string data2 = "userentrypoint13";
     string sig = "";
     switch(objectName)
     {
         case "timesource":
             responseid = 0x010006;
             data1 = "timesource";
             sig = "462a9d1f";
             break;
         case "biomon":
             responseid = 0x02505e;
             data1 = "sp1u796[biomonserver:biomon]sylar501.biomon";
             sig = "389fc8f0:9adcb7e6";
             break;
         case "worldserver":
             responseid = 0x035059;
             data1 = "sp2u796[WorldServer:worldserver]sylar501.worldserver";
             sig = "51e518d9:92367cb3:29f2db17";
             break;
         case "gamesystemsserver":
             responseid = 0x05505a;
             data1 = "sp3u796[GameSystemsServer:gamesystemsserver]sylar501.gamesystemsserver";
             sig = "450a2825";
             break;
         case "chatgateway":
             responseid = 0x06505c;
             data1 = "sp4u796[ChatGateway:chatgateway]sylar501.chatgateway";
             sig = "900005df";
             break;
         case "auctionserver":
             responseid = 0x07505b;
             data1 = "sp5u796[AuctionServer:auctionserver]sylar501.auctionserver";
             sig = "9ce839f7";
             break;
         case "mailserver":
             responseid = 0x085058;
             data1 = "sp6u796[Mail:mailserver]sylar501.mailserver";
             sig = "9759aa23";
             break;
         case "trackingserver":
             responseid = 0x09505d;
             data1 = "sp7u796[TrackingServer:trackingserver]sylar501.trackingserver";
             sig = "c5b320c1:8cebf93e";
             break;
         case "areaserver":
             responseid = 0x046953;
             data1 = "sp8u796[AreaServer-ord_main-4611686019802843831-1-:areaserver]sylar501.areaserver";
             sig = "91ac5777:62060b0:29f2db17";
             break;
         default:
             TORLog.Error("Unknown server signature for " + objectName);
             return;
     }
     con.SendPacket(new SMsg_ServerSignatureResponse(responseid, data1, data2, sig));
 }
Example #5
0
 public void WritePacket(Commons.Networking.AsyncConnection connection, Commons.Networking.ByteBuffer packet)
 {
     packet.WriteUInt(_id);
     packet.WriteString(_mapname);
     packet.WriteString(_mapid);
     packet.WriteBytes(new byte[] { 0x4A, 0x23, 0xFD, 0x46, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
     packet.WriteString("\\world\\areas\\" + _mapid + "\\area.dat");
 }
Example #6
0
        public void WritePacket(Commons.Networking.AsyncConnection connection, Commons.Networking.ByteBuffer packet)
        {
            packet.WriteUInt(_id);
            packet.WriteInt(5); // character count ?

            packet.WriteUInt(0x4e308655);

            WriteCharacterInfo(packet, new Character()
            {
                Name = "Zeus", Level = 99, Class = CharacterClass.SithInquisitor, AreaSpec = MapAreas.PCShip_PhantomX70B
            }, 0);
            WriteCharacterInfo(packet, new Character()
            {
                Name = "LilGreenShit", Level = 99, Class = CharacterClass.JediConsular, AreaSpec = MapAreas.IlumS
            }, 1);
            WriteCharacterInfo(packet, new Character()
            {
                Name = "SuperSayan501", Level = 51, Class = CharacterClass.Trooper, AreaSpec = MapAreas.BelsavisS
            }, 2);
            WriteCharacterInfo(packet, new Character()
            {
                Name = "Tampix", Level = 1, Class = CharacterClass.SithWarrior, AreaSpec = MapAreas.CoruscantR
            }, 3);
            if (Program.LastCreatedChar != null)
            {
                WriteCharacterInfo(packet, Program.LastCreatedChar, 4);
            }
            else
            {
                WriteCharacterInfo(packet, new Character()
                {
                    Name = "Bananaaaaa", Level = 8, Class = CharacterClass.BountyHunter, AreaSpec = MapAreas.PCShip_ThunderclapBT7
                }, 4);
            }

            string xml = "";

            xml += "<status><userdata><entitlement id=\"30\"    uniqueId=\"539043\"    date_created=\"1311840392836\"    date_consumed =\"\"    ";
            xml += "date_started=\"\" description=\"Early Game Access\" gameInfo=\"\" shard_name=\"he1012\" key=\"\" type=\"G\"/>";

            xml += "<entitlement id=\"39\"    uniqueId=\"15130593\"    date_created=\"1323871237000\"    date_consumed =\"\"    ";
            xml += "date_started=\"\" description=\"Head Start\" gameInfo=\"Created by Head Start Package\" shard_name=\"he1012\" key=\"\" type=\"G\"/>";

            xml += "<entitlement id=\"2013\"    uniqueId=\"19669424\"    date_created=\"1324371113907\"    date_consumed =\"\"    ";
            xml += "date_started=\"\" description=\"SWTOR_COLLECTORS_RETAIL\" gameInfo=\"{&quot;transactionalEmail&quot;: {&quot;templatePrefix&quot;:&quot;PurchaseConfirmation.CR&quot;}}\" shard_name=\"he1012\" key=\"\" type=\"G\"/>";

            xml += "<entitlement id=\"7\"    uniqueId=\"19669425\"    date_created=\"1324371113909\"    date_consumed =\"\"    ";
            xml += "date_started=\"\" description=\"Subcriber Shard Access\" gameInfo=\"\" shard_name=\"he1012\" key=\"\" type=\"G\"/>";

            xml += "<entitlement id=\"40\"    uniqueId=\"22765385\"    date_created=\"1324593971139\"    date_consumed =\"\"    ";
            xml += "date_started=\"\" description=\"Security Key Associated\" gameInfo=\"\" shard_name=\"he1012\" key=\"\" type=\"G\"/>";

            xml += "<entitlement id=\"71\"    uniqueId=\"29277571\"    date_created=\"1327348302784\"    date_consumed =\"\"    ";
            xml += "date_started=\"\" description=\"Early Founder\" gameInfo=\"\" shard_name=\"he1012\" key=\"\" type=\"G\"/></userdata></status>";

            packet.WriteString(xml);
            packet.WriteLong(0);
        }
Example #7
0
 public static void ClientSignatureResponse(AsyncConnection con, string objectName, uint id, string signature)
 {
     TORLog.Info("ClentSignatureResponse: " + objectName + "@" + id + " = " + signature);
     if (objectName == "OmegaServerProxyObjectName")
     {
         con.SendPacket(new SMsg_ServerSignatureResponse(0x5050, "u796", "userentrypoint13", "9cf74d45:1a6cc459:6fa57dc2"));
         con.SendPacket(new SMsg_XMLSettings());
     }
 }
Example #8
0
        public void ExecutePacket(Commons.Networking.AsyncConnection connection, Commons.Networking.ByteBuffer packet)
        {
            packet.ReadUInt();
            packet.ReadShort();
            string requestdeObjectName = packet.ReadString(); // OmegaServerProxyObjectName
            string signature           = packet.ReadString(); // b7a6bba3:8ab55405:d7b5d3e1:5bc541f9

            packet.ReadString();                              // Client
            uint objectId = packet.ReadUInt();

            SignatureService.ClientSignatureResponse(connection, requestdeObjectName, objectId, signature);
        }
Example #9
0
 void EndAccept(IAsyncResult ar)
 {
     Socket clientSocket = serverSocket.EndAccept(ar);
     AsyncConnection con = new AsyncConnection(clientSocket);
     if (ConnectionAccepted != null)
     {
         new Thread(new ThreadStart(() =>
             {
                 ConnectionAccepted(con);
             })).Start();
     }
     BeginAccept();
 }
Example #10
0
        void EndAccept(IAsyncResult ar)
        {
            Socket          clientSocket = serverSocket.EndAccept(ar);
            AsyncConnection con          = new AsyncConnection(clientSocket);

            if (ConnectionAccepted != null)
            {
                new Thread(new ThreadStart(() =>
                {
                    ConnectionAccepted(con);
                })).Start();
            }
            BeginAccept();
        }
Example #11
0
        public void ExecutePacket(AsyncConnection connection, ByteBuffer packet)
        {
            uint RequestedRootID = packet.ReadUInt(); // 0x50500000
            string cnx_type_1 = packet.ReadString(); // *
            string cnx_type_2 = packet.ReadString(); // timesource

            packet.ReadString(); // String.Empty
            packet.ReadString(); // String.Empty

            string cnx_type_3 = packet.ReadString(); // Application_TimeRequester

            packet.ReadString(); // String.Empty

            string objectId = packet.ReadString();

            SignatureService.RequestServerSignature(connection, cnx_type_2);
        }
Example #12
0
 void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
     uint objid = packet.ReadObjectIDRev();
     TORLog.Info("CharacterListRequest@" + objid);
     connection.SendPacket(new SMsg_CharacterListResponse(objid));
 }
Example #13
0
        void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
        {
            uint id = packet.ReadObjectIDRev();
            int namelen = packet.ReadInt();
            string name = "";
            for (int i = 0; i < namelen; i++)
            {
                name += (char)packet.ReadByte();
            }
            packet.ReadInt(); packet.ReadInt();
            packet.ReadInt();

            uint CHARSPEC1 = packet.ReadUInt();
            byte CHARSPEC2 = (byte)packet.ReadByte();

            packet.ReadBytes(36);

            uint CHARSPECAPP1 = packet.ReadUInt();
            uint CHARSPECAPP2 = packet.ReadUInt();
            uint CHARSPECAPP3 = packet.ReadUInt();
            ushort CHARSPECAPP4 = packet.ReadUShort();

            packet.ReadByte(); // separator

            byte[] classBytes = packet.ReadBytes(8);
            Array.Reverse(classBytes);
            ulong classNodeRefId = BitConverter.ToUInt64(classBytes, 0);

            Console.WriteLine("----- Creating Character -----");
            Console.WriteLine("Name = " + name);
            Console.WriteLine("Class ID = " + classNodeRefId);
            Console.WriteLine("App1 = " + CHARSPECAPP1);
            Console.WriteLine("App2 = " + CHARSPECAPP2);
            Console.WriteLine("App3 = " + CHARSPECAPP3);
            Console.WriteLine("App4 = " + CHARSPECAPP4);

            /*byte[] known_offs = new byte[] { 84, 88, 91, 92, 95, 96, 100, 104, 107, 108, 112 };
            long originalPositon = packet.Position;
            byte[] thispkt = packet.ReadBytes((int)(packet.Length - packet.Position));
            packet.Position = originalPositon;

            if (lastpacket != null)
            {

                for (byte i = 0; i < thispkt.Length; i++)
                {
                    if (lastpacket[i] != thispkt[i] && !known_offs.Contains<byte>(i))
                        Console.WriteLine("Data differs at " + i + " : " + lastpacket[i] + " => " + thispkt[i]);
                }
            }

            lastpacket = thispkt;*/

            Character c = new Character()
            {
                //APP1 = CHARSPECAPP1,
                //APP2 = CHARSPECAPP2,
                //APP3 = CHARSPECAPP3,
                //APP4 = CHARSPECAPP4,
                AreaSpec = TORBusiness.Data.MapAreas.PCShip_XSFreighter,
                Class = (CharacterClass)classNodeRefId,
                Level = 44,
                Name = name,
                spec2 = CHARSPEC1,
                spec3 = CHARSPEC2,
            };

            packet.ReadBytes(78);
            packet.ReadByte();
            byte appDataCount = (byte)packet.ReadByte();
            c.Appearance = new Tuple<byte, byte>[appDataCount];
            packet.ReadByte();
            Console.WriteLine("appearance entries: " + appDataCount);
            for (int i = 0; i < appDataCount; i++)
            {
                byte[] data = packet.ReadBytes(4);
                c.Appearance[i] = new Tuple<byte, byte>(data[0], data[3]);
                Console.WriteLine("Appearance = " + data[3]);
            }

            Program.LastCreatedChar = c;

            connection.SendPacket(new SMsg_CharacterCreateResponse(id, name, 0x07));
        }
Example #14
0
 public void WritePacket(Commons.Networking.AsyncConnection connection, Commons.Networking.ByteBuffer packet)
 {
     packet.WriteUInt(_id);
     packet.WriteUInt(1);
 }
Example #15
0
 void IServerPacket.WritePacket(Commons.Networking.AsyncConnection connection, Commons.Networking.ByteBuffer packet)
 {
     packet.WriteUInt(_id);
 }
Example #16
0
 void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
     uint objid = packet.ReadObjectIDRev();
     TORLog.Info("GetServerAddress@" + objid);
     //connection.SendPacket(new SMsg_ServerAddressResponse(objid, "swtor.privateserver.com"));
 }
Example #17
0
 public static void RequestClientSignature(AsyncConnection con, string objectName, uint id)
 {
     con.SendPacket(new SMsg_ClientSignatureRequest(objectName, id));
     TORLog.Info("RequestClientSignature: " + objectName + "@" + id);
 }
Example #18
0
 public void ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
     TORLog.Info(connection.GetHashCode() + " leaving the Shard Server.");
     connection.Close();
 }
Example #19
0
 void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
     uint objid = packet.ReadObjectIDRev();
     packet.ReadByte();
     uint charid = packet.ReadUInt();
     TORLog.Info("CharacterSelectRequest@" + objid + " - " + charid);
     connection.SendPacket(new SMsg_CharacterSelectResponse(objid));
     connection.SendPacket(new SMsg_CharacterCurrentMap(objid, "ord_main", "4611686019802843831"));
     connection.SendPacket(new SMsg_CharacterAreaEnter(objid));
     connection.SendPacket(new SMsg_CharacterAreaServerSpec(objid, "ord_main", "4611686019802843831"));
 }
Example #20
0
 void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
 }
Example #21
0
 public void WritePacket(Commons.Networking.AsyncConnection connection, Commons.Networking.ByteBuffer packet)
 {
     packet.WriteUInt(_id);
     packet.WriteString("AreaServer-" + _mapname + "-" + _mapid + "-1-:areaserver");
 }
Example #22
0
        public static void ProcessPacket(byte[] data, AsyncConnection connection)
        {
            AsyncConnectionData acd = (connection.AsyncState as AsyncConnectionData);
            ByteBuffer buffer = new ByteBuffer(ByteOrder.LittleEndian, data, 6, data.Length - 6); // 1 opcode 4 len 1 chk
            if (connection.State == 1)
            {
                buffer.ReadInt();
                string rsaBytes = Encoding.UTF8.GetString(buffer.ReadBytes(1024));
                byte[] rsa = new byte[512];
                for (int i = 0; i < rsaBytes.Length; i += 2)
                {
                    rsa[i / 2] = byte.Parse(rsaBytes.Substring(i, 2), NumberStyles.HexNumber);
                }
                uint resultSize = 0;
                IntPtr ptr = TRSADecrypt(rsa, 512, ref resultSize);
                byte[] decrypted = new byte[resultSize];
                Marshal.Copy(ptr, decrypted, 0, (int)resultSize);
                Console.WriteLine("Decrypted Size = " + resultSize);
                Console.WriteLine(Utility.HexDump(decrypted));

                // set salsa keys
                ByteBuffer packetbuffer = new ByteBuffer(ByteOrder.LittleEndian, decrypted);
                string username = packetbuffer.ReadString();
                string hash = packetbuffer.ReadString();

                byte[] key1 = packetbuffer.ReadBytes(32);
                byte[] key2 = packetbuffer.ReadBytes(32); // decrypts client
                byte[] iv1 = packetbuffer.ReadBytes(8);
                byte[] iv2 = packetbuffer.ReadBytes(8); // decrypts client

                connection.CipheredStream.EnableEncryption(key2, iv2, key1, iv1);

                connection.SetState(2); // State 2 = Ready to decrypt
            }
            else
            {
                switch(data.Length)
                {
                    case 14: // discarded client packet
                        break;
                    case 45:
                        byte[] response_45 = new byte[]
                            {
                                0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0xAF, 0xC5, 0x31, 0x67, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x63, 0x61,
                                0x73, 0x74, 0x6C, 0x65, 0x68, 0x69, 0x6C, 0x6C, 0x74, 0x65, 0x73, 0x74, 0x00, 0x09, 0x00, 0x00,
                                0x00, 0x61, 0x66, 0x63, 0x31, 0x62, 0x62, 0x35, 0x61, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x6C, 0x6F,
                                0x67, 0x69, 0x6E, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
                                0x00, 0x00,
                            };
                        connection.SendRegularPacket(response_45);
                        break;
                    case 126: //omega packet
                        ByteBuffer pkt_omega = new ByteBuffer(ByteOrder.LittleEndian);
                        pkt_omega.WriteBytes(new byte[] {
                            0x00, 0x60, // Length
                            0x00, 0x00, 0x00, 0x60, // Length
                            0x84, 0xD0, 0xF2, 0x90, // PacketID (with client hack)
                            0x04, 0x00, 0x00, 0x00 // ObjectCode
                        });
                        pkt_omega.WriteString("swtor-game-lab-1.swtor.com:20063"); // Server Address
                        pkt_omega.WriteString("WIKRQEOYULPBIEHHADRWAAPNVRYGQHMNRXGHBUIV"); // Some key ?

                        Console.WriteLine(Utility.HexDump(pkt_omega.ToArray()));

                        connection.SendRegularPacket(pkt_omega.ToArray());
                        break;
                    default:
                        Console.WriteLine("recv packet, size = " + data.Length);
                        Console.WriteLine(Utility.HexDump(data));
                        break;
                }

                /*List<byte[]> packets = acd.Crypter.ProcessServerFromClient(data);

                foreach (byte[] packet in packets)
                {
                    ByteBuffer pkt = new ByteBuffer(ByteOrder.BigEndian, packet);
                    short opcode = pkt.ReadShort();
                    int length = pkt.ReadInt();

                    switch (opcode)
                    {
                        case 45:
                            // Client Selecting a Shard Server
                            Console.WriteLine(connection.GetHashCode() + " selecting shard.");
                            MemoryStream response_45 = new MemoryStream(new byte[]
                            {
                                0x00, 0x48, 0x0, 0x00, 0x00, 0x48, 0xAF, 0xC5, 0x31, 0x67, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x63, 0x61,
                                0x73, 0x74, 0x6C, 0x65, 0x68, 0x69, 0x6C, 0x6C, 0x74, 0x65, 0x73, 0x74, 0x00, 0x09, 0x00, 0x00,
                                0x00, 0x61, 0x66, 0x63, 0x31, 0x62, 0x62, 0x35, 0x61, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x6C, 0x6F,
                                0x67, 0x69, 0x6E, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
                                0x00, 0x00,
                            });
                            SendPacket(connection, response_45);
                            break;
                        default:
                            Console.WriteLine("PKTRECV Opcode = " + opcode + " Size = " + length);
                            Console.WriteLine("Hex Dump = " + Utility.ToHexString(pkt, true));
                            Console.WriteLine("String Dump = " + Encoding.UTF8.GetString(pkt.ToArray()));
                            break;
                    }
                }*/
            }
        }