コード例 #1
0
    def testGetLinuxFlags(self):
        with temp.AutoTempFilePath() as temp_filepath:
            client_test_lib.Chattr(temp_filepath, attrs=["+c", "+d"])

            stat = utils.Stat(temp_filepath, follow_symlink=False)
            self.assertTrue(stat.IsRegular())
            self.assertTrue(stat.GetLinuxFlags() & self.FS_COMPR_FL)
            self.assertTrue(stat.GetLinuxFlags() & self.FS_NODUMP_FL)
            self.assertFalse(stat.GetLinuxFlags() & self.FS_IMMUTABLE_FL)
            self.assertEqual(stat.GetOsxFlags(), 0)
コード例 #2
0
ファイル: file_finder_test.py プロジェクト: marciopocebon/grr
    def testFileFinderStatExtFlags(self):
        with test_lib.AutoTempFilePath() as temp_filepath:
            client_test_lib.Chattr(temp_filepath, attrs=["+d"])

            action = rdf_file_finder.FileFinderAction.Stat()
            results = self.RunFlow(action=action, paths=[temp_filepath])
            self.assertEqual(len(results), 1)

            stat_entry = results[0].stat_entry
            self.assertTrue(stat_entry.st_flags_linux & self.FS_NODUMP_FL)
            self.assertFalse(stat_entry.st_flags_linux & self.FS_UNRM_FL)
コード例 #3
0
  def testStatExtFlags(self):
    with test_lib.AutoTempFilePath() as temp_filepath:
      client_test_lib.Chattr(temp_filepath, attrs=["+c"])

      action = rdf_file_finder.FileFinderAction.Stat()
      results = self._RunFileFinder([temp_filepath], action)
      self.assertEqual(len(results), 1)

      stat_entry = results[0].stat_entry
      self.assertTrue(stat_entry.st_flags_linux & self.EXT2_COMPR_FL)
      self.assertFalse(stat_entry.st_flags_linux & self.EXT2_IMMUTABLE_FL)
コード例 #4
0
ファイル: conditions_test.py プロジェクト: ehossam/grr
 def _Chattr(self, attrs):
   client_test_lib.Chattr(self.temp_filepath, attrs=attrs)