Example #1
0
        /// <summary>
        /// export hits to file so it can be imported by the IDA plugin
        /// </summary>
        /// <param name="fileName"></param>
        public void exportHitsToFile(string fileName, NCoverageExportOptions options)
        {
            try
            {
                FileStream fs = new FileStream(fileName, FileMode.Create);
                BinaryWriter bw = new BinaryWriter(fs);
                // write header
                bw.Write(options.UseColor);
                bw.Write(options.ExportMarkers);
                bw.Write(options.BlendColors);
                bw.Write(options.AppendHitCount);
                bw.Write(options.HitColor.R);
                bw.Write(options.HitColor.G);
                bw.Write(options.HitColor.B);

                foreach (Hit hit in hits_)
                {
                    bw.Write(hit.Address);
                    bw.Write(hit.Count);
                }
                bw.Close();
            }
            catch (Exception e)
            {
                throw new ModuleException(e.Message);
            }
        }
Example #2
0
        /// <summary>
        /// export hits to file so it can be imported by the IDA plugin
        /// </summary>
        /// <param name="fileName"></param>
        public void exportHitsToFile(string fileName, NCoverageExportOptions options)
        {
            try
            {
                FileStream   fs = new FileStream(fileName, FileMode.Create);
                BinaryWriter bw = new BinaryWriter(fs);
                // write header
                bw.Write(options.UseColor);
                bw.Write(options.ExportMarkers);
                bw.Write(options.BlendColors);
                bw.Write(options.AppendHitCount);
                bw.Write(options.HitColor.R);
                bw.Write(options.HitColor.G);
                bw.Write(options.HitColor.B);

                foreach (Hit hit in hits_)
                {
                    bw.Write(hit.Address);
                    bw.Write(hit.Count);
                }
                bw.Close();
            }
            catch (Exception e)
            {
                throw new ModuleException(e.Message);
            }
        }
Example #3
0
 /// <summary>
 /// export hits so it can be imported by the IDA plugin
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnExport_Click(object sender, EventArgs e)
 {
     try
     {
         if (lsvFinalSet.SelectedIndices.Count > 0)
         {
             int index = lsvFinalSet.SelectedIndices[0];
             DialogResult result = saveFileDialog.ShowDialog();
             if (result == DialogResult.OK)
             {
                 NCoverageExportOptions options = new NCoverageExportOptions(picColor.BackColor);
                 options.UseColor = chkColor.Checked;
                 codeCoverage_.FinalSet[index].exportHitsToFile(saveFileDialog.FileName, options);
                 log("Successfully exported " + codeCoverage_.FinalSet[index].Hits.Count + " hits to " + saveFileDialog.FileName);
             }
         }
         else log("Nothing exported. Select module!");
     }
     catch (System.Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }