Beispiel #1
0
        private MetaSms GetMetaSms(ViterbiField field, List<MetaResult> metaResults)
        {
            string name = null;
            string number = null;
            string number2 = null;
            DateTime? timeStamp = null;
            string message = null;
            long startOffset = -1;

            FieldPaths path = new FieldPaths();
            for (int i = 0; i < field.Raw.Length; i++)
            {
                if (i == 0)
                {
                    path._path_beg_offset = metaResults[(int)field.OffsetFile].Field.OffsetFile;
                }
                if (i == field.Raw.Length - 1)
                {
                    path._path_end_offset = metaResults[(int)field.OffsetFile + i].Field.OffsetFile;
                }
                path._fields_in_path.Add(metaResults[(int)field.OffsetFile + i].Field.MachineName.ToString());

                //if (field.Raw[i] == (byte)MetaMachine.Text && name == null)
                //    name = metaResults[(int)field.OffsetFile + i].Field.FieldString;

                if (field.Raw[i] == (byte)MetaMachine.PhoneNumber && number == null)
                    number = metaResults[(int)field.OffsetFile + i].Field.FieldString;

                else if (field.Raw[i] == (byte)MetaMachine.PhoneNumber && number2 == null)
                    number2 = metaResults[(int)field.OffsetFile + i].Field.FieldString;

                else if (field.Raw[i] == (byte)MetaMachine.TimeStamp && timeStamp == null)
                    timeStamp = DateTime.Parse(metaResults[(int)field.OffsetFile + i].Field.FieldString);

                else if (field.Raw[i] == (byte)MetaMachine.Text && message == null)
                    message = metaResults[(int)field.OffsetFile + i].Field.FieldString;

                if (startOffset == -1)
                {
                    startOffset = metaResults[(int)field.OffsetFile + i].Field.OffsetFile;
                }
            }
            path.find_actual_path();
            fieldPaths.Add(path);

            var entry = new MetaSms()
            {
                Name = name,
                Number = number,
                Number2 = number2,
                SevenDigit = Utilities.GetLastSevenDigits(number),
                SevenDigit2 = Utilities.GetLastSevenDigits(number2),
                TimeStamp = timeStamp,
                Message = message,
                Offset = startOffset,
                MachineName = field.MachineName,
                ProximityOffset = startOffset
            };

            if (entry.Name == null)
                entry.Name = MetaField.DEFAULT_STRING;

            if (entry.Number == null)
                entry.Number = MetaField.DEFAULT_STRING;

            if (entry.SevenDigit == null)
                entry.SevenDigit = MetaField.DEFAULT_STRING;

            if (entry.Number2 == null)
                entry.Number2 = MetaField.DEFAULT_STRING;

            if (entry.SevenDigit2 == null)
                entry.SevenDigit2 = MetaField.DEFAULT_STRING;

            if (entry.Message == null)
                entry.Message = MetaField.DEFAULT_STRING;

            if (entry.TimeStamp == null)
                entry.TimeStamp = MetaField.DEFAULT_DATE;

            return entry;
        }
Beispiel #2
0
        private List<MetaCallLog> GetMetaCallLog(ViterbiField field, List<MetaResult> metaResults)
        {
            string name = null;
            string number = null;
            List<DateTime> timeStamps = new List<DateTime>();
            string type = null;
            long startOffset = -1;
            List<long> proximityOffsets = new List<long>();

            FieldPaths path = new FieldPaths();
            for (int i = 0; i < field.Raw.Length; i++)
            {
                if (i == 0)
                {
                    path._path_beg_offset = metaResults[(int)field.OffsetFile].Field.OffsetFile;
                }
                if (i == field.Raw.Length - 1)
                {
                    path._path_end_offset = metaResults[(int)field.OffsetFile + i].Field.OffsetFile;
                }
                path._fields_in_path.Add(metaResults[(int)field.OffsetFile + i].Field.MachineName.ToString());

                if (field.Raw[i] == (byte)MetaMachine.Text && name == null)
                    name = metaResults[(int)field.OffsetFile + i].Field.FieldString;

                else if (field.Raw[i] == (byte)MetaMachine.PhoneNumber && number == null)
                    number = metaResults[(int)field.OffsetFile + i].Field.FieldString;

                else if (field.Raw[i] == (byte)MetaMachine.TimeStamp)
                {
                    timeStamps.Add(DateTime.Parse(metaResults[(int)field.OffsetFile + i].Field.FieldString));
                    proximityOffsets.Add(metaResults[(int)field.OffsetFile + i].Field.OffsetFile);
                }
                else if (field.Raw[i] == (byte)MetaMachine.CallLogType && type == null)
                    type = metaResults[(int)field.OffsetFile + i].Field.FieldString;

                if (startOffset == -1)
                {
                    startOffset = metaResults[(int)field.OffsetFile + i].Field.OffsetFile;
                }
            }
            path.find_actual_path();
            fieldPaths.Add(path);

            var entries = new List<MetaCallLog>();

            for (int i = 0; i < timeStamps.Count; i++)
            {
                var entry = new MetaCallLog()
                {
                    Name = name,
                    Number = number,
                    SevenDigit = Utilities.GetLastSevenDigits(number),
                    TimeStamp = timeStamps[i],
                    Type = type,
                    Offset = startOffset,
                    MachineName = field.MachineName,
                    ProximityOffset = proximityOffsets[i]
                };

                if (entry.Name == null)
                    entry.Name = MetaField.DEFAULT_STRING;

                if (entry.Number == null)
                    entry.Number = MetaField.DEFAULT_STRING;

                if (entry.SevenDigit == null)
                    entry.SevenDigit = MetaField.DEFAULT_STRING;

                if (entry.Type == null)
                    entry.Type = MetaField.DEFAULT_STRING;

                if (entry.TimeStamp == null)
                    entry.TimeStamp = MetaField.DEFAULT_DATE;

                entries.Add(entry);

            }

            return entries;
        }
Beispiel #3
0
        private List<MetaCallLog> GetMetaCallLogNokia(ViterbiField field, List<MetaResult> metaResults)
        {
            string name = null;
            var numbers = new List<string>();
            List<DateTime> timeStamps = new List<DateTime>();
            string type = null;
            long startOffset = -1;
            List<long> proximityOffsets = new List<long>();

            var phoneIndex = new List<string>();
            var timeStampIndex = new List<string>();

            FieldPaths path = new FieldPaths();
            for (int i = 0; i < field.Raw.Length; i++)
            {
                if (i == 0)
                {
                    path._path_beg_offset = metaResults[(int)field.OffsetFile].Field.OffsetFile;
                }
                if (i == field.Raw.Length - 1)
                {
                    path._path_end_offset = metaResults[(int)field.OffsetFile + i].Field.OffsetFile;
                }
                path._fields_in_path.Add(metaResults[(int)field.OffsetFile + i].Field.MachineName.ToString());

                if (field.Raw[i] == (byte)MetaMachine.Text && name == null)
                    name = metaResults[(int)field.OffsetFile + i].Field.FieldString;

                //There should be a binary field in between.
                else if (field.Raw[i] == (byte)MetaMachine.CallLogNumberIndex && field.Raw[i + 2] == (byte)MetaMachine.PhoneNumber)
                {
                    phoneIndex.Add(metaResults[(int)field.OffsetFile + i].Field.FieldString);

                    numbers.Add(metaResults[(int)field.OffsetFile + i + 2].Field.FieldString);

                    i += 2;
                }
                else if (field.Raw[i] == (byte)MetaMachine.TimeStamp && field.Raw[i + 1] == (byte)MetaMachine.CallLogNumberIndex)
                {
                    timeStamps.Add(DateTime.Parse(metaResults[(int)field.OffsetFile + i].Field.FieldString));
                    timeStampIndex.Add(metaResults[(int)field.OffsetFile + i + 1].Field.FieldString);
                    proximityOffsets.Add(metaResults[(int)field.OffsetFile + i].Field.OffsetFile);
                    i++;
                }
                else if (field.Raw[i] == (byte)MetaMachine.CallLogType && type == null)
                    type = metaResults[(int)field.OffsetFile + i].Field.FieldString;

                if (startOffset == -1)
                {
                    startOffset = metaResults[(int)field.OffsetFile + i].Field.OffsetFile;
                }
            }
            path.find_actual_path();
            fieldPaths.Add(path);

            var entries = new List<MetaCallLog>();

            for (int i = 0; i < timeStamps.Count; i++)
            {
                int numberI = -1;
                //Get phone number
                for (int j = 0; j < phoneIndex.Count; j++)
                {
                    if (timeStampIndex[i] == phoneIndex[j])
                    {
                        numberI = j;
                        break;
                    }
                }

                string number = (numberI != -1) ? numbers[numberI] : "*NONE*";

                var entry = new MetaCallLog()
                {
                    Name = name,
                    Number = number,
                    SevenDigit = Utilities.GetLastSevenDigits(number),
                    TimeStamp = timeStamps[i],
                    Type = type,
                    Offset = startOffset,
                    MachineName = field.MachineName,
                    ProximityOffset = proximityOffsets[i]
                };

                if (entry.Name == null)
                    entry.Name = MetaField.DEFAULT_STRING;

                if (entry.Number == null)
                    entry.Number = MetaField.DEFAULT_STRING;

                if (entry.SevenDigit == null)
                    entry.SevenDigit = MetaField.DEFAULT_STRING;

                if (entry.Type == null)
                    entry.Type = MetaField.DEFAULT_STRING;

                if (entry.TimeStamp == null)
                    entry.TimeStamp = MetaField.DEFAULT_DATE;

                entries.Add(entry);

            }

            return entries;
        }
Beispiel #4
0
        private List<MetaAddressBookEntry> GetMetaAddressBookEntry(ViterbiField field, List<MetaResult> metaResults)
        {
            string name = null;
            List<string> numbers = new List<string>();
            long startOffset = long.MaxValue;
            List<long> proximityOffsets = new List<long>();

            FieldPaths path = new FieldPaths();
            for (int i = 0; i < field.Raw.Length; i++)
            {
                if (i == 0)
                {
                    path._path_beg_offset = metaResults[(int)field.OffsetFile].Field.OffsetFile;
                }
                if (i == field.Raw.Length - 1)
                {
                    path._path_end_offset = metaResults[(int)field.OffsetFile + i].Field.OffsetFile;
                }
                path._fields_in_path.Add(metaResults[(int)field.OffsetFile + i].Field.MachineName.ToString());

                if (field.Raw[i] == (byte)MetaMachine.Text && name == null)
                    name = metaResults[(int)field.OffsetFile + i].Field.FieldString;
                else if (field.Raw[i] == (byte)MetaMachine.Text)
                    name += " " + metaResults[(int)field.OffsetFile + i].Field.FieldString;
                else if (field.Raw[i] == (byte)MetaMachine.PhoneNumber)
                {
                    numbers.Add(metaResults[(int)field.OffsetFile + i].Field.FieldString);
                    proximityOffsets.Add(metaResults[(int)field.OffsetFile + i].Field.OffsetFile);
                }
                if (i == 0)
                {
                    startOffset = Math.Min(startOffset, metaResults[(int)field.OffsetFile + i].Field.OffsetFile);
                }
            }
            path.find_actual_path();
            fieldPaths.Add(path);

            var entries = new List<MetaAddressBookEntry>();

            for (int i = 0; i < numbers.Count; i++)
            {

                var entry = new MetaAddressBookEntry
                {
                    Name = name,
                    Number = numbers[i],
                    SevenDigit = Utilities.GetLastSevenDigits(numbers[i]),
                    Offset = startOffset,
                    MachineName = field.MachineName,
                    ProximityOffset = proximityOffsets[i]
                };

                if (entry.Name == null)
                    entry.Name = MetaField.DEFAULT_STRING;

                if (entry.Number == null)
                    entry.Number = MetaField.DEFAULT_STRING;

                if (entry.SevenDigit == null)
                    entry.SevenDigit = MetaField.DEFAULT_STRING;

                entries.Add(entry);

            }

            return entries;
        }