Esempio n. 1
0
        public static void DumpAddresses()
        {
            int TostringRefLocation = scanner.scan_xrefs("tostring")[0];
            int GetTopAddr          = util.prevCall(util.prevCall(TostringRefLocation, true));

            Functions.Add("gettop", GetTopAddr);
            CallingConventions.Add("gettop", util.convs[util.getConvention(GetTopAddr)]);
            Console2.Info("Dumper.DumpAddresses", "Added gettop.");

            int GetFieldAddr = util.nextCall(TostringRefLocation);
            // This will get added when scanning lol

            int Index2AdrAddr = util.nextCall(GetFieldAddr);

            Functions.Add("index2adr", Index2AdrAddr);
            CallingConventions.Add("index2adr", util.convs[util.getConvention(Index2AdrAddr)]);
            Console2.Info("Dumper.DumpAddresses", "Added index2adr.");

            int RetcheckAddr = util.prevCall(util.getEpilogue(GetFieldAddr));

            Functions.Add("retcheck", RetcheckAddr);
            CallingConventions.Add("retcheck", util.convs[util.getConvention(RetcheckAddr)]);
            Console2.Info("Dumper.DumpAddresses", "Added retcheck.");

            Console2.Info("Dumper.DumpAddresses", "Scanning index2adr cross references...");
            List <int> Index2AdrAddrs = scanner.scan_xrefs(Index2AdrAddr);

            for (int Idx = 1; Idx < Assets.Index2AdrXRs.Count; Idx++)
            {
                string Name = Assets.Index2AdrXRs[Idx];
                if (!Functions.ContainsKey(Name))
                {
                    int Prologue = util.getPrologue(Index2AdrAddrs[Idx - 1]);
                    Functions.Add(Assets.Index2AdrXRs[Idx], Prologue);
                    CallingConventions.Add(Assets.Index2AdrXRs[Idx], util.convs[util.getConvention(Prologue)]);
                    Console2.Info("Dumper.DumpAddresses", $"Added {Name}.");
                }
            }

            Console2.Info("Dumper.DumpAddresses", "Scanning retcheck cross references...");
            List <int> RetcheckAddrs = scanner.scan_xrefs(RetcheckAddr);

            for (int Idx = 1; Idx < Assets.RetcheckXRs.Count; Idx++)
            {
                string Name = Assets.RetcheckXRs[Idx];
                //Console.WriteLine("rtc: " + Name);
                if (!Functions.ContainsKey(Name))
                {
                    int Prologue = util.getPrologue(RetcheckAddrs[Idx - 1]);
                    Functions.Add(Assets.RetcheckXRs[Idx], Prologue);
                    CallingConventions.Add(Assets.RetcheckXRs[Idx], util.convs[util.getConvention(Prologue)]);
                    Console2.Info("Dumper.DumpAddresses", $"Added {Name}.");
                }
            }

            int DeserializeAddr = util.getPrologue(scanner.scan_xrefs(": bytecode version mismatch")[0]);

            Functions.Add("deserialize", DeserializeAddr);
            CallingConventions.Add("deserialize", util.convs[util.getConvention(DeserializeAddr)]);
            Console2.Info("Dumper.DumpAddresses", "Added deserialize.");

            int PrintAddr = util.nextCall(scanner.scan_xrefs("Video recording started")[0]);

            Functions.Add("print", PrintAddr);
            CallingConventions.Add("print", util.convs[util.getConvention(PrintAddr)]);
            Console2.Info("Dumper.DumpAddresses", "Added print.");

            int SandboxThreadAddr = util.getPrologue(scanner.scan_xrefs("__index")[2]);

            Functions.Add("sandboxthread", SandboxThreadAddr);
            CallingConventions.Add("sandboxthread", util.convs[util.getConvention(SandboxThreadAddr)]);
            Console2.Info("Dumper.DumpAddresses", "Added sandboxthread.");
        }