Esempio n. 1
0
    def testRead(self):
        """Tests the Read function."""
        test_file = self._GetTestFilePath([u"psort_test.proto.plaso"])
        zip_file_object = zipfile.ZipFile(test_file, "r", zipfile.ZIP_DEFLATED, allowZip64=True)

        stream_name = u"plaso_index.000003"
        offset_table = zip_file._SerializedDataOffsetTable(zip_file_object, stream_name)
        offset_table.Read()

        stream_name = u"bogus"
        offset_table = zip_file._SerializedDataOffsetTable(zip_file_object, stream_name)

        with self.assertRaises(IOError):
            offset_table.Read()
Esempio n. 2
0
  def testRead(self):
    """Tests the Read function."""
    test_file = self._GetTestFilePath([u'psort_test.json.plaso'])
    zip_file_object = zipfile.ZipFile(
        test_file, 'r', zipfile.ZIP_DEFLATED, allowZip64=True)

    stream_name = u'plaso_index.000002'
    offset_table = zip_file._SerializedDataOffsetTable(
        zip_file_object, stream_name)
    offset_table.Read()

    stream_name = u'bogus'
    offset_table = zip_file._SerializedDataOffsetTable(
        zip_file_object, stream_name)

    with self.assertRaises(IOError):
      offset_table.Read()
Esempio n. 3
0
  def testRead(self):
    """Tests the Read function."""
    test_file = self._GetTestFilePath([u'psort_test.json.plaso'])
    zip_file_object = zipfile.ZipFile(
        test_file, 'r', zipfile.ZIP_DEFLATED, allowZip64=True)

    stream_name = u'event_index.000002'
    offset_table = zip_file._SerializedDataOffsetTable(
        zip_file_object, stream_name)
    offset_table.Read()

    stream_name = u'bogus'
    offset_table = zip_file._SerializedDataOffsetTable(
        zip_file_object, stream_name)

    with self.assertRaises(IOError):
      offset_table.Read()
Esempio n. 4
0
    def testGetOffset(self):
        """Tests the GetOffset function."""
        test_file = self._GetTestFilePath([u"psort_test.proto.plaso"])
        zip_file_object = zipfile.ZipFile(test_file, "r", zipfile.ZIP_DEFLATED, allowZip64=True)

        stream_name = u"plaso_index.000003"
        offset_table = zip_file._SerializedDataOffsetTable(zip_file_object, stream_name)
        offset_table.Read()

        self.assertEqual(offset_table.GetOffset(0), 0)
        self.assertEqual(offset_table.GetOffset(1), 271)

        with self.assertRaises(IndexError):
            offset_table.GetOffset(2)

        self.assertEqual(offset_table.GetOffset(-1), 271)
        self.assertEqual(offset_table.GetOffset(-2), 0)

        with self.assertRaises(IndexError):
            offset_table.GetOffset(-3)
Esempio n. 5
0
  def testGetOffset(self):
    """Tests the GetOffset function."""
    test_file = self._GetTestFilePath([u'psort_test.json.plaso'])
    zip_file_object = zipfile.ZipFile(
        test_file, 'r', zipfile.ZIP_DEFLATED, allowZip64=True)

    stream_name = u'plaso_index.000002'
    offset_table = zip_file._SerializedDataOffsetTable(
        zip_file_object, stream_name)
    offset_table.Read()

    self.assertEqual(offset_table.GetOffset(0), 0)
    self.assertEqual(offset_table.GetOffset(1), 762)

    with self.assertRaises(IndexError):
      offset_table.GetOffset(99)

    self.assertEqual(offset_table.GetOffset(-1), 10902)
    self.assertEqual(offset_table.GetOffset(-2), 10110)

    with self.assertRaises(IndexError):
      offset_table.GetOffset(-99)
Esempio n. 6
0
  def testGetOffset(self):
    """Tests the GetOffset function."""
    test_file = self._GetTestFilePath([u'psort_test.json.plaso'])
    zip_file_object = zipfile.ZipFile(
        test_file, 'r', zipfile.ZIP_DEFLATED, allowZip64=True)

    stream_name = u'event_index.000002'
    offset_table = zip_file._SerializedDataOffsetTable(
        zip_file_object, stream_name)
    offset_table.Read()

    self.assertEqual(offset_table.GetOffset(0), 0)
    self.assertEqual(offset_table.GetOffset(1), 671)

    with self.assertRaises(IndexError):
      offset_table.GetOffset(99)

    self.assertEqual(offset_table.GetOffset(-1), 10051)
    self.assertEqual(offset_table.GetOffset(-2), 9383)

    with self.assertRaises(IndexError):
      offset_table.GetOffset(-99)