示例#1
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine(">> Loading configuration options...");
                if (!Config.Load(args))
                {
                    return;
                }

                if (Config.NoCmsg && Config.NoSmsg)
                {
                    Logger.WriteConsoleLine("Please give me something to do.");
                    Config.ShowHelp();
                    return;
                }

                if ((Config.BinDiff == string.Empty) != (Config.Opcode == string.Empty))
                {
                    Console.WriteLine("ERROR: -d and -o flags need to be both present to function!");
                    return;
                }

                if (Config.BinDiff != string.Empty && Config.Opcode != string.Empty)
                {
                    Console.WriteLine(">> Opening Diff...");
                    FuncDiff = new BinDiff(Config.BinDiff);
                    if (!FuncDiff.openConnection())
                    {
                        Console.WriteLine(">> Failed to open diff!");
                        return;
                    }

                    Console.WriteLine(">> Opening OpcodeTable...");
                    OpTable = new OpcodeTable(Config.Opcode);
                    if (!OpTable.openConnection())
                    {
                        Console.WriteLine(">> Failed to open OpcodeTable!");
                        return;
                    }
                }

                if (Logger.CreateOutputStream(Config.OutputFile))
                {
                    Logger.PrepOutputStram();
                }

                Console.WriteLine(">> Opening Wow client...");
                ClientStream = new BinaryReader(File.OpenRead(Config.Executable));
                if (!BaseStream.CanRead)
                {
                    return;
                }

                ClientBytes = File.ReadAllBytes(Config.Executable);
                Disasm      = new UnmanagedBuffer(ClientBytes);
                Environment = Emulator.Create(BaseStream);

                ClientBuild = new Dumpers.Build();
                Logger.WriteLine("Detected build {0}.{1}", ClientBuild.Version, ClientBuild.BuildNumber);
                switch (ClientBuild.isBuildSupported())
                {
                case Dumpers.BuildSupport.BUILD_UNKOWN:
                    Console.WriteLine("\nBuild not yet implemented!\nThere might be unexpected results running opcodedumper.");
                    break;

                case Dumpers.BuildSupport.BUILD_UNSUPPORTED:
                    Console.WriteLine("\nBuild unsupported!\nNameOffset has changed since this build. You can try using an old version.");
                    return;

                case Dumpers.BuildSupport.BUILD_SUPPORTED:
                    Console.WriteLine("Build Supported!");
                    break;
                }

                Console.WriteLine(">> Discovering JAM groups...");
                foreach (var pattern in ClientGroupPatterns) // Load jam groups...
                {
                    var offsets = ClientBytes.FindPattern(pattern, 0xFF);
                    if (offsets.Count == 0)
                    {
                        Console.WriteLine(@"Could not find group name "" {0}""", System.Text.Encoding.ASCII.GetString(pattern.Skip(1).ToArray()));
                        return;
                    }
                    else
                    {
                        Console.WriteLine(@"Found JAM Group "" {0}""", System.Text.Encoding.ASCII.GetString(pattern.Skip(1).ToArray()));
                        var dispatch = new JamDispatch((int)(offsets[0] + 1));
                        Dispatchers[dispatch.GetGroup()] = dispatch;
                    }
                }

                if (!Config.NoGhNames && !Opcodes.TryPopulate())
                {
                    return;
                }

                if (!Config.NoSmsg)
                {
                    Dumpers.SMSG.Dump();
                }

                if (!Config.NoCmsg)
                {
                    Dumpers.CMSG.Dump(Config.SpecificOpcodeValue);
                }

                if (Config.WPP)
                {
                    Dumpers.CMSG.dumpWPPFile("Opcodes.cs");
                }
            }
            catch (SystemException e)
            {
                Console.WriteLine("Caught level exception: \n{0}\n\nDid you use the correct command line arguments? Use -help to show usage.\nPress any key to exit...", e.Message);
                Console.ReadKey();
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine(">> Loading configuration options...");
            if (!Config.Load(args))
            {
                return;
            }

            if (Config.NoCmsg && Config.NoSmsg)
            {
                Logger.WriteConsoleLine("Please give me something to do.");
                Config.ShowHelp();
                return;
            }

            Logger.CreateOutputStream(Config.OutputFile);

            Console.WriteLine(">> Opening Wow client...");
            ClientStream = new BinaryReader(File.OpenRead(Config.Executable));
            if (!BaseStream.CanRead)
            {
                return;
            }

            ClientBytes = File.ReadAllBytes(Config.Executable);
            Disasm      = new UnmanagedBuffer(ClientBytes);
            Env         = Emulator.Create(BaseStream);

            if (!Config.NoSmsg)
            {
                Console.WriteLine(">> Discovering JAM groups...");
                foreach (var pattern in ClientGroupPatterns) // Load jam groups...
                {
                    var offsets = ClientBytes.FindPattern(pattern, 0xFF);
                    if (offsets.Count == 0)
                    {
                        Console.WriteLine(@"Could not find group name "" {0}""", System.Text.Encoding.ASCII.GetString(pattern.Skip(1).ToArray()));
                        return;
                    }
                    else
                    {
                        Console.WriteLine(@"Found JAM Group "" {0}""", System.Text.Encoding.ASCII.GetString(pattern.Skip(1).ToArray()));
                        Dispatchers.Add(new JamDispatch((int)(offsets[0] + 1)));
                    }
                }
            }

            if (!Config.NoGhNames && !Opcodes.TryPopulate())
            {
                return;
            }

            if (!Config.NoSmsg)
            {
                SMSG.Dump();
            }

            if (!Config.NoCmsg)
            {
                CMSG.Dump(Config.SpecificOpcodeValue);
            }
        }