Exemple #1
0
        private static void AnalyzeFiles(IEnumerable <string> fileNames, Boolean withTracing, Boolean withDebugging)
        {
            foreach (var fileName in fileNames)
            {
                Console.WriteLine();
                Console.WriteLine("Interpreting file: " + fileName);
                FileStream fileStream;

                try
                {
                    fileStream = File.OpenRead(fileName);
                }
                catch (IOException e)
                {
                    Console.WriteLine(e.Message);
                    Environment.Exit(3);
                    return; // needed to hush up a false warning in mono
                }

                // TODO (matt_hargett): have a factory auto-detect the file type and return the right kind of IParsable
                // IParsable parser = new DumpFileParser(fileStream, Options.FunctionToAnalyze);
                IParsable parser = new ElfFileParser(fileStream);

                analyzer           = new Analyzer(parser);
                analyzer.OnReport += PrintReportItem;

                if (withTracing)
                {
                    analyzer.OnEmulationComplete += new DebuggerView(withDebugging).PrintInfo;
                }

                analyzer.Run();
            }
        }
        public void TearDown()
        {
            if (parser == null)
            {
                return;
            }

            parser.Dispose();
            parser = null;
        }
 public override void SetUp()
 {
     base.SetUp();
     var elfHeader = new Byte[] {0x7f, 0x45, 0x4c, 0x46};
     textData = new Byte[] {0x90};
     stream.Write(elfHeader, 0, elfHeader.Length);
     stream.Seek(0x2e0, SeekOrigin.Begin);
     stream.Write(textData, 0, textData.Length);
     parser = new ElfFileParser(stream);
 }
        public void TearDown()
        {
            if (parser == null)
            {
                return;
            }

            parser.Dispose();
            parser = null;
        }
        public override void SetUp()
        {
            base.SetUp();
            var elfHeader = new Byte[] { 0x7f, 0x45, 0x4c, 0x46 };

            textData = new Byte[] { 0x90 };
            stream.Write(elfHeader, 0, elfHeader.Length);
            stream.Seek(0x2e0, SeekOrigin.Begin);
            stream.Write(textData, 0, textData.Length);
            parser = new ElfFileParser(stream);
        }
Exemple #6
0
        private static void AnalyzeFiles(IEnumerable<string> fileNames, Boolean withTracing, Boolean withDebugging)
        {
            foreach (var fileName in fileNames)
            {
                Console.WriteLine();
                Console.WriteLine("Interpreting file: " + fileName);
                FileStream fileStream;

                try
                {
                    fileStream = File.OpenRead(fileName);
                }
                catch (IOException e)
                {
                    Console.WriteLine(e.Message);
                    Environment.Exit(3);
                    return; // needed to hush up a false warning in mono
                }

                // TODO (matt_hargett): have a factory auto-detect the file type and return the right kind of IParsable
                // IParsable parser = new DumpFileParser(fileStream, Options.FunctionToAnalyze);
                IParsable parser = new ElfFileParser(fileStream);

                analyzer = new Analyzer(parser);
                analyzer.OnReport += PrintReportItem;

                if (withTracing)
                {
                    analyzer.OnEmulationComplete += new DebuggerView(withDebugging).PrintInfo;
                }

                analyzer.Run();
            }
        }