コード例 #1
0
 public void start()
 {
     Interceptor = new RustInterceptor(Settings.Default.Server_IP, Settings.Default.Server_PORT);
     Interceptor.AddPacketsToFilter(Packet.Rust.Entities, Packet.Rust.EntityDestroy, Packet.Rust.EntityPosition);
     //Interceptor.RegisterCommandCallback(OnCommand);
     Interceptor.RegisterCallback(internalOnPacket);
     Interceptor.Start();
     stopped = false;
     Console.WriteLine("Started");
 }
コード例 #2
0
 private void StartButton_Click(object sender, EventArgs e)
 {
     inty = new RustInterceptor(IPBox.Text, int.Parse(PortBox.Text));
     inty.ClientPackets   = false;
     inty.RememberPackets = false;
     inty.AddPacketsToFilter(Packet.Rust.Entities, Packet.Rust.EntityDestroy, Packet.Rust.EntityPosition);
     inty.RegisterCallback(PacketReceived);
     //inty.commandCallback = OnCommand;
     //inty.packetHandlerCallback = internalOnPacket;
     inty.Start();
 }
コード例 #3
0
ファイル: Overlay.cs プロジェクト: REALryz3n/Echolon-Public
        public static void ReadRustPackets(string ip, int port)
        {
            new External_ESP_base.Menu();
            RustInterceptor interceptor = new RustInterceptor(ip, port, 0x162e)
            {
                ClientPackets        = true,
                RememberPackets      = true,
                RememberFilteredOnly = false
            };

            interceptor.Start();
            while (interceptor.IsAlive)
            {
                Packet packet;
                proxyisAlive = true;
                interceptor.GetPacket(out packet);
                switch (((Packet.Rust)packet.packetID))
                {
                case Packet.Rust.EntityPosition:
                {
                    entityUpdate = Rust_Interceptor.Data.Entity.ParsePositions(packet);
                    ProtoBuf.Entity entity  = new ProtoBuf.Entity();
                    ProtoBuf.Entity entity2 = new ProtoBuf.Entity();
                    if (playerTable.ContainsKey(entityUpdate[0].UID))
                    {
                        entity = playerTable[entityUpdate[0].UID];
                        entity.baseEntity.pos            = entityUpdate[0].Position;
                        entity.baseEntity.rot            = entityUpdate[0].Rotation;
                        playerTable[entityUpdate[0].UID] = entity;
                    }
                    else if (angryAnimalTable.ContainsKey(entityUpdate[0].UID))
                    {
                        entity2 = angryAnimalTable[entityUpdate[0].UID];
                        entity2.baseEntity.pos = entityUpdate[0].Position;
                        entity2.baseEntity.rot = entityUpdate[0].Rotation;
                        angryAnimalTable[entityUpdate[0].UID] = entity2;
                    }
                    else if (niceAnimalTable.ContainsKey(entityUpdate[0].UID))
                    {
                        entity2 = niceAnimalTable[entityUpdate[0].UID];
                        entity2.baseEntity.pos = entityUpdate[0].Position;
                        entity2.baseEntity.rot = entityUpdate[0].Rotation;
                        niceAnimalTable[entityUpdate[0].UID] = entity2;
                    }
                    else if (entityTable.ContainsKey(entityUpdate[0].UID))
                    {
                        entity2 = entityTable[entityUpdate[0].UID];
                        entity2.baseEntity.pos           = entityUpdate[0].Position;
                        entity2.baseEntity.rot           = entityUpdate[0].Rotation;
                        entityTable[entityUpdate[0].UID] = entity2;
                    }
                    continue;
                }

                case Packet.Rust.Entities:
                {
                    Rust_Interceptor.Data.Entity.ParseEntity(packet, out Overlay.entity);
                    if (Overlay.entity.basePlayer != null)
                    {
                        if (Overlay.entity.basePlayer.metabolism != null)
                        {
                            playerTable[Overlay.entity.baseNetworkable.uid] = Overlay.entity;
                            localPlayer = Overlay.entity;
                        }
                        else
                        {
                            playerTable[Overlay.entity.baseNetworkable.uid] = Overlay.entity;
                        }
                    }
                    else if (rockIds.Contains <uint>(Overlay.entity.baseNetworkable.prefabID))
                    {
                        rockTable[Overlay.entity.baseNetworkable.uid] = Overlay.entity;
                    }
                    else if (Overlay.entity.baseNetworkable.prefabID == 0x4f1f0e9b)
                    {
                        tcTable[Overlay.entity.baseNetworkable.uid] = Overlay.entity;
                    }
                    else if (angryAnimalIds.Contains <uint>(Overlay.entity.baseNetworkable.prefabID))
                    {
                        angryAnimalTable[Overlay.entity.baseNetworkable.uid] = Overlay.entity;
                    }
                    else if (niceAnimalIds.Contains <uint>(Overlay.entity.baseNetworkable.prefabID))
                    {
                        niceAnimalTable[Overlay.entity.baseNetworkable.uid] = Overlay.entity;
                    }
                    else
                    {
                        entityTable[Overlay.entity.baseNetworkable.uid] = Overlay.entity;
                    }
                    continue;
                }

                case Packet.Rust.EntityDestroy:
                {
                    EntityDestroy destroy = new EntityDestroy(packet);
                    if (playerTable.ContainsKey(destroy.UID))
                    {
                        playerTable.Remove(destroy.UID);
                    }
                    else if (rockTable.ContainsKey(destroy.UID))
                    {
                        rockTable.Remove(destroy.UID);
                    }
                    continue;
                }
                }
            }
        }
コード例 #4
0
        //Oculta todos los elementos para poder tener un overlayForm
        public void start(String server, int port)
        {
            sniffer = RustInterceptor.getInstance(server, port);
            this.hideControls();
            pintor = DrawingUtils.getInstance();
            //Hilo que se encargara de ir limpiando las entidades que esten muy lejos o no merezca la pena espiar.
            cleaner = new Thread(
                () =>
            {
                do
                {
                    if (localPlayer != null)
                    {
                        List <KeyValuePair <String, Entity> > filas = this.listaUsuarios.ToList <KeyValuePair <String, Entity> >();
                        foreach (KeyValuePair <String, Entity> fila in filas)
                        {
                            if (fila.Value == null)
                            {
                                return;
                            }
                            Entity entidad = fila.Value;

                            float distance = UnityEngine.Vector2.Distance(
                                new UnityEngine.Vector2(entidad.Data.baseEntity.pos.x, entidad.Data.baseEntity.pos.z)
                                ,
                                new UnityEngine.Vector2(this.localPlayer.Data.baseEntity.pos.x, this.localPlayer.Data.baseEntity.pos.z));
                            if (distance > pintor.getController().getZoomValue() || entidad.Data.basePlayer.modelState.onground && !entidad.Data.basePlayer.modelState.sleeping)
                            {
                                this.listaUsuarios.TryRemove(fila.Key, out entidad);
                            }
                        }
                    }
                    Thread.Sleep(5 * 1000);
                } while (working);
            });

            cleaner.SetApartmentState(ApartmentState.MTA);
            cleaner.IsBackground   = true;
            cleaner.CurrentCulture = System.Globalization.CultureInfo.CurrentCulture;
            cleaner.Priority       = ThreadPriority.BelowNormal;
            cleaner.Name           = "OverlayCleanerThread";

            //Creo un Hilo que se encargara de hacer todo el curro
            worker = new Thread(
                () =>
            {
                targetProcess.EnableRaisingEvents = true;
                targetProcess.Exited += new EventHandler(     //En cuanto se cierre Rust, cerramos OVerlay
                    (object sender, EventArgs e) =>
                {
                    this.Stop();
                });

                //¿Porque ha dejado de funcionar de pronto?
                //Puede ser por el cambio de propiedades de int a float que hice en RECTANGULO
                //new WindowHook(targetProcess.MainWindowHandle, this); //De momento esta clase se ocupa directamente de redimensionar la ventana
                this.resizeForm(new RECTANGULO());


                sniffer.Start();
                while (this.localPlayer == null)     //Esperamos hasta que tengamos el localplayer
                {
                    Thread.Sleep(1000);
                    Console.WriteLine("No me he encontrado...Sigo buscandome");
                }
                Console.WriteLine("Me he encontrado");

                working = true;
                cleaner.Start();
                //cleaner.Join();
                do
                {
                    this.worldToScreen();
                    Thread.Sleep(100);
                } while (working);
            });

            worker.SetApartmentState(ApartmentState.MTA);
            worker.IsBackground   = true;
            worker.CurrentCulture = System.Globalization.CultureInfo.CurrentCulture;
            worker.Priority       = ThreadPriority.Highest;
            worker.Name           = "OverlayWorkerThread";

            worker.Start();
            //worker.Join();

            this.Show();
        }