示例#1
0
        void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
        {
            uint objid = packet.ReadObjectIDRev();

            TORLog.Info("CharacterListRequest@" + objid);
            connection.SendPacket(new SMsg_CharacterListResponse(objid));
        }
示例#2
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"));
        }
示例#3
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());
 }
示例#4
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));
 }
示例#5
0
        public async Task DropTablesAsync()
        {
            try
            {
                if (AsyncConnection != null)
                {
                    await AsyncConnection.DropTableAsync <Vehicle>();

                    await AsyncConnection.DropTableAsync <VehicleBusRoute>();

                    await AsyncConnection.DropTableAsync <VehicleFeatureType>();

                    await AsyncConnection.DropTableAsync <VehicleStatusType>();

                    await AsyncConnection.DropTableAsync <VehicleType>();

                    await AsyncConnection.DropTableAsync <VehicleTypeVehicleFeatureType>();

                    await AsyncConnection.DropTableAsync <VehicleVehicleFeatureType>();

                    await AsyncConnection.DropTableAsync <LanguageType>();

                    await AsyncConnection.DropTableAsync <FeedbackType>();

                    await AsyncConnection.DropTableAsync <FeedbackTypeTranslation>();

                    await AsyncConnection.DropTableAsync <Feedback>();

                    await AsyncConnection.DropTableAsync <User>();

                    await AsyncConnection.DropTableAsync <Location>();

                    await AsyncConnection.DropTableAsync <ReservationRequest>();

                    await AsyncConnection.DropTableAsync <Barcode>();

                    await AsyncConnection.DropTableAsync <BarcodeScanLog>();

                    await AsyncConnection.DropTableAsync <BarcodeType>();

                    await AsyncConnection.DropTableAsync <BarcodeTypeTranslation>();

                    await AsyncConnection.DropTableAsync <BusRoute>();

                    await AsyncConnection.DropTableAsync <BusRouteStop>();

                    await AsyncConnection.DropTableAsync <BusRouteTranslation>();

                    await AsyncConnection.DropTableAsync <GeofenceActivity>();

                    await AsyncConnection.DropTableAsync <Queue>();
                }
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
                throw new InvalidOperationException($"Error creating sqlite database tables. {ex.Message}");
            }
        }
示例#6
0
        public override async Task Drop()
        {
            await AsyncConnection.DropTableAsync <Host>();

            await AsyncConnection.DropTableAsync <CommandSsh>();


            await SetSchemaVersion(0);
        }
示例#7
0
 public ExpertSyncConnector(string host, int port)
 {
     _host             = host;
     _port             = port;
     ac                = new AsyncConnection();
     ac.binaryMode     = true;
     ac.timeout        = _timeout;
     ac.bytesReceived += bytesReceived;
 }
示例#8
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());
     }
 }
示例#9
0
 /// <summary>
 /// Select the Accelerometer-records between 2 DateTime-objects.
 /// </summary>
 /// <param name="start">The start DateTime.</param>
 /// <param name="end">The end DateTime.</param>
 /// <returns>A collection of Accelerometer-records.</returns>
 public IEnumerable <Accelerometer> SelectBetweenDates(DateTime start, DateTime end)
 {
     return(PerformQuery(() =>
     {
         return AsyncConnection.Table <Accelerometer>()
         .Where(x => x.DateTime >= start && x.DateTime <= end)
         .ToListAsync();
     }));
 }
示例#10
0
 public User SelectByUsernameAndPassword(string username, string password)
 {
     return(PerformQuery(() =>
     {
         return AsyncConnection.Table <User>()
         .Where(x => x.Username.ToLower().Equals(username.ToLower()) && x.Password.Equals(password))
         .FirstOrDefaultAsync();
     }));
 }
示例#11
0
        private void login()
        {
            using (FLogin lf = new FLogin(Application.StartupPath + "\\clusters.txt"))
            {
                lf.tbCallsign.Text = settings.cs;
                lf.tbHost.Text     = settings.host;
                if (settings.port != 0)
                {
                    lf.tbPort.Text = settings.port.ToString();
                }
                if (lf.ShowDialog() == DialogResult.OK)
                {
                    string host     = lf.tbHost.Text;
                    int    port     = Convert.ToInt32(lf.tbPort.Text);
                    string callsign = lf.tbCallsign.Text;
                    if (!callsign.Equals(settings.cs))
                    {
                        settings.cs = callsign;
                    }
                    if (!host.Equals(settings.host))
                    {
                        settings.host = host;
                    }
                    if (port != settings.port)
                    {
                        settings.port = port;
                    }
                    writeConfig();

                    if (host == "test")
                    {
                        using (StreamReader sr = new StreamReader(Application.StartupPath + "\\test.txt"))
                            do
                            {
                                LineReceivedEventArgs e = new LineReceivedEventArgs();
                                e.line = sr.ReadLine();
                                lineReceived(this, e);
                            } while (sr.Peek() >= 0);
                    }
                    else
                    {
                        clusterCn = new AsyncConnection();
                        clusterCn.lineReceived += lineReceived;
                        if (clusterCn.connect(host, port))
                        {
                            clusterCn.sendCommand(callsign);
                            this.Text += " connected to " + host + ":" + port.ToString();
                        }
                    }
                }
            }
        }
示例#12
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"));
        }
示例#13
0
        public async Task DropTablesAsync()
        {
            try
            {
                if (AsyncConnection != null)
                {
                    await AsyncConnection.DropTableAsync <Location>();

                    await AsyncConnection.DropTableAsync <ReservationRequest>();
                }
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
                throw new InvalidOperationException($"Error creating sqlite database tables. {ex.Message}");
            }
        }
示例#14
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);
        }
示例#15
0
        public override async Task Initialize()
        {
            try
            {
                await AsyncConnection.CreateTableAsync <Host>();

                await AsyncConnection.CreateTableAsync <CommandSsh>();

                await Migrate();

                Tcs.TrySetResult(null);
            }
            catch (Exception e)
            {
                Tcs.TrySetException(e);
                throw;
            }
        }
示例#16
0
        public static void SendPacket(this AsyncConnection con, IServerPacket pkt)
        {
            byte opcode   = OpcodeManager.Instance.GetOpcode(pkt.GetType().Name);
            uint packetid = OpcodeManager.Instance.GetPacketID(pkt.GetType().Name);

            if (packetid == 0)
            {
                TORLog.Error("ERROR: No PacketID defined for " + pkt.GetType().Name);
                return;
            }
            ByteBuffer packet = new ByteBuffer(ByteOrder.LittleEndian);

            packet.WriteByte(opcode);
            packet.WriteInt(0);  // Length
            packet.WriteByte(0); // ChkByte
            packet.WriteUInt(packetid);
            pkt.WritePacket(con, packet);
            con.SendTORPacket(packet);
            TORLog.Network("PktSend @ " + con.GetHashCode() + " >> " + pkt.GetType().Name);
        }
示例#17
0
 public bool connect()
 {
     connection = new AsyncConnection();
     connection.connect(connectionParams.host, connectionParams.port);
     if (connection.connected)
     {
         connection.lineReceived += processReply;
         if (connectionParams.usartPort != -1)
         {
             sendCommand("PSW,SET," + connectionParams.password);
             sendCommand("EVT,ON");
             usartConnection = new AsyncConnection();
             usartConnection.connect(connectionParams.host, connectionParams.usartPort);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#18
0
        public async Task DropTablesAsync()
        {
            try
            {
                if (AsyncConnection != null)
                {
                    await AsyncConnection.DropTableAsync <Resource>();

                    await AsyncConnection.DropTableAsync <ResourceSchedule>();

                    await AsyncConnection.DropTableAsync <User>();

                    await AsyncConnection.DropTableAsync <Queue>();

                    await AsyncConnection.DropTableAsync <PendingResourceSchedule>();
                }
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException($"Error creating sqlite database tables. {ex.Message}");
            }
        }
示例#19
0
 public void listenWirelessGW()
 {
     sport?.Close();
     listenWirelessGWFl = true;
     if (wirelessGWCheckTimer == null)
     {
         wirelessGWCheckTimer = new System.Threading.Timer(obj => {
             if (listenWirelessGWFl)
             {
                 listenWirelessGW();
             }
         }, null, 10000, 10000);
     }
     foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
     {
         if (ni.NetworkInterfaceType.ToString().StartsWith("Wireless"))
         {
             GatewayIPAddressInformationCollection gws = ni.GetIPProperties().GatewayAddresses;
             if (gws?.Count > 0 && ni.OperationalStatus == OperationalStatus.Up)
             {
                 if (gpsShare == null)
                 {
                     gpsShare = new AsyncConnection();
                     gpsShare.connect(ni.GetIPProperties().GatewayAddresses[0].Address.ToString(), 50000, true);
                     gpsShare.reconnect       = true;
                     gpsShare.lineReceived   += GpsShare_lineReceived;
                     gpsShare.onDisconnected += GpsShare_onDisconnected;
                     gpsShare.onConnected    += GpsShare_onConnected;
                 }
             }
             else if (gpsShare != null)
             {
                 gpsShare.disconnect();
                 gpsShare = null;
             }
         }
     }
 }
示例#20
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;
                 *  }
                 * }*/
            }
        }
示例#21
0
 void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
 }
示例#22
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));
        }
示例#23
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));
        }
示例#24
0
 public void ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
     TORLog.Info(connection.GetHashCode() + " leaving the Shard Server.");
     connection.Close();
 }
示例#25
0
 public static void RequestClientSignature(AsyncConnection con, string objectName, uint id)
 {
     con.SendPacket(new SMsg_ClientSignatureRequest(objectName, id));
     TORLog.Info("RequestClientSignature: " + objectName + "@" + id);
 }