public DecodeResultsForm(IntPtr handle, PostProcessor postProcess, string filePath, PhoneInfo phoneInfo,
     Dec0de.UI.DecodeFilters.Filters filters)
 {
     try {
         this.stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
     } catch {
         stream = null;
     }
     this.processedData = postProcess;
     this.phoneInfo = phoneInfo;
     InitializeComponent();
     toolStripStatusLabelSummary.Text = "";
     DcUtils.SetWaitCursor(handle);
     CreateListviewItems(postProcess.callLogFields, postProcess.addressBookFields, postProcess.smsFields,
                         postProcess.imageBlocks, filters);
     InitDropdowns();
     radioClHideChecked.Checked = true;
     radioClRemoveChecked.Checked = true;
     radioClHighlightCriteria.Checked = true;
     radioAbHideChecked.Checked = true;
     radioAbRemoveChecked.Checked = true;
     radioAbHighlightCriteria.Checked = true;
     radioSmsHideChecked.Checked = true;
     radioSmsRemoveChecked.Checked = true;
     radioSmsHighlightCriteria.Checked = true;
     toolStripButtonImage.Enabled = false;
     PopulateViews();
     DcUtils.ResetWaitCursor();
 }
示例#2
0
 public GTC_CSV_Writer(List<MetaResult> metaResults, PostProcessor postProcess, string filePath)
 {
     _metaResults = metaResults;
     _postProcess = postProcess;
     _filePath = filePath;
     _fields_in_blocks = new Dictionary<int, List<ViterbiField>>();
     _fields_of_interest = new Dictionary<int, List<ViterbiField>>();
     Get_Fields_in_Blocks();
     Get_Fields_Of_Interest();
 }
示例#3
0
 /// <summary>
 /// Invoked by the decoding thread to indicate that it has completed.
 /// </summary>
 /// <param name="success">To indicate if the decoding process was successful.</param>
 /// <param name="postProcess">The results after post porcessing the results from record level Viterbi inference.</param>
 /// <param name="filePath">The path to the phone's memory file.</param>
 /// <param name="phoneInfo">Stores the manufacturer, model etc. information about the phone.</param>
 public void EndWork(bool success, PostProcessor postProcess, string filePath, PhoneInfo phoneInfo)
 {
     if (Terminating) return;
     if (MainForm.Program.InvokeRequired) {
         EndWorkCallback cb = new EndWorkCallback(EndWork);
         this.Invoke(cb, new object[] {success, postProcess, filePath, phoneInfo});
     } else {
         this.workerThread = null;
         if (success) {
             this.postProcess = postProcess;
             this.filePath = filePath;
             this.phoneInfo = phoneInfo;
             labelStatus9.Text = String.Format("Calls={0}, Addresses={1}, SMS={2}, Images={3}",
                                               postProcess.callLogFields.Count,
                                               postProcess.addressBookFields.Count,
                                               postProcess.smsFields.Count, postProcess.imageBlocks.Count);
         } else {
             this.postProcess = null;
             HideChecksAbdSteps();
         }
         EnableDisableFields();
     }
 }
示例#4
0
        /// <summary>
        /// This is where all of the work is done to extract information from
        /// the phone's binary file. 
        /// It calls methods for image block identification, removal, block hash filtering, field and record level Viterbi infrerence, postprocessing of results.
        /// </summary>
        private void Run()
        {
            bool success = false;
            PostProcessor postProcess = null;
            PhoneInfo phoneInfo = null;
            try
            {
                // Use the SHA1 of the binary file to identify it.
                _canAbort = true;
                StartStep(1);
                write("Calculating file SHA1");
                fileSha1 = DcUtils.CalculateFileSha1(this.filePath);
                if (_cancel) return;
                NextStep(1);
                // We scan the file to locate images. This is done independent
                // of block hashes.
                write("Extracting graphical images");
            #if LOADONLY || SKIPIMAGES
                ImageFiles imageFiles = new ImageFiles();
            #else
                ImageFiles imageFiles = ImageFiles.LocateImages(this.filePath);
                if (_cancel) return;
                _canAbort = false;
                write("Extracted {0} graphical images", imageFiles.ImageBlocks.Count);
            #endif
                NextStep(2);
                if (_cancel) return;
                // Load the block hashes into the DB (if they're not already
                // there).
                HashLoader.HashLoader hashloader = HashLoader.HashLoader.LoadHashesIntoDB(fileSha1, this.filePath, this.manufacturer,
                    this.model, this.note, this.doNotStoreHashes);
                if (_cancel || (hashloader == null)) return;
                int phoneId = hashloader.PhoneId;
            #if LOADONLY
                _cancel = true;
                return;
            #endif
                _canAbort = true;
                NextStep(3);
                if (_cancel) return;
                // Identify block hashes that are already in the DB, which we
                // will then filter out.
                FilterResult filterResult = RunBlockHashFilter(fileSha1, phoneId, hashloader.GetAndForgetStoredHashes());
                hashloader = null;
                NextStep(4);
                // Since images were located before block hash filter, forget
                // about any image that overlaps a filtered block hash.
                write("Filtering image locations");
                //filterResult = ImageFiles.FilterOutImages(filterResult, imageFiles);
                //Dump_Filtered_Blocks(filterResult, filePath);
                NextStep(5);
                // Finally, we're ready to use the Viterbi state machine.
                // Start by identifying fields.
                ViterbiResult viterbiResultFields = RunViterbi(filterResult, fileSha1);
                // Allow garbage collection.
                filterResult.UnfilteredBlocks.Clear();
                NextStep(6);
                List<MetaField> addressBookEntries = new List<MetaField>();
                List<MetaField> callLogs = new List<MetaField>();
                List<MetaField> sms = new List<MetaField>();
                // Second run of Viterbi, this time for records.
                //ViterbiResult viterbiResultRecord = RunMetaViterbi(viterbiResultFields,addressBookEntries,callLogs,sms);
                RunMetaViterbi(viterbiResultFields, addressBookEntries, callLogs, sms);
                viterbiResultFields = null;
                NextStep(7);
                // Perform post processing. This may remove some records.
                postProcess = new PostProcessor(callLogs, addressBookEntries, sms, imageFiles.ImageBlocks);
                success = PerformPostProcessing(postProcess);
                NextStep(8);

                GTC_CSV_Writer wr = new GTC_CSV_Writer(this.metaResults, postProcess, filePath);
                wr.Write_CSV();
                wr.Write_Field_Paths(this.fieldPaths);

                // Finished.
                phoneInfo = new PhoneInfo(manufacturer, model, note, doNotStoreHashes);
                write("Finished work");
                FinishedStep(9);
            }
            finally
            {
                if (_cancel)
                {
                    MainForm.Program.EndWork(false, null, null, null);
                }
                else
                {
                    MainForm.Program.EndWork(success, postProcess, this.filePath, phoneInfo);
                }
            }
        }
示例#5
0
 private bool PerformPostProcessing(PostProcessor postProcess)
 {
     try
     {
         write("Begin post-processing");
         // PostProcessor new_ref = new PostProcessor(callLogs, addressBookEntries, sms, imageFiles.ImageBlocks);
         // new_ref.Process();
         // postProcess.addressBookFields = new_ref.addressBookFields;
         // postProcess.callLogFields = new_ref.callLogFields;
         // postProcess.smsFields = new_ref.smsFields;
         postProcess.Process();
         return true;
     }
     catch (ThreadAbortException)
     {
         return false;
     }
     catch (Exception ex)
     {
         DisplayExceptionMessages(ex, "Post Processing");
         return false;
     }
 }
示例#6
0
 /// <summary>
 /// Called when the user wants to open a memory file.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripButtonOpen_Click(object sender, EventArgs e)
 {
     GetMemFileDlg dlg = new GetMemFileDlg();
     if (dlg.ShowDialog() != DialogResult.OK) {
         return;
     }
     this.filePath = dlg.FilePath;
     this.phoneInfo = new PhoneInfo(dlg.Manufacturer, dlg.Model, dlg.Note, dlg.DoNotStoreHashes);
     this.postProcess = null;
     HideChecksAbdSteps();
     EnableDisableFields();
 }
示例#7
0
 /// <summary>
 /// Called to initiate decoding. This is done in a separate thread.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="manufacturer"></param>
 /// <param name="model"></param>
 /// <param name="note"></param>
 /// <param name="noStore"></param>
 private void StartWork(string path, string manufacturer, string model, string note, bool noStore)
 {
     this.postProcess = null;
     this.filePath = null;
     this.phoneInfo = null;
     this.workerThread = new WorkerThread(path, manufacturer, model, note, noStore);
     EnableDisableFields();
     InitializeSteps();
     this.workerThread.Start();
 }