Ejemplo n.º 1
0
 def Run(self):
   client_id = self.SetupClient(0)
   self.file_path = "fs/os/etc"
   self.Check(
       "GetFileDownloadCommand",
       args=vfs_plugin.ApiGetFileDownloadCommandArgs(
           client_id=client_id, file_path=self.file_path))
    def testVfsMethodsAreAccessChecked(self):
        args = api_vfs.ApiListFilesArgs(client_id=self.client_id)
        self.CheckMethodIsAccessChecked(self.router.ListFiles,
                                        "CheckClientAccess",
                                        args=args)

        args = api_vfs.ApiGetVfsFilesArchiveArgs(client_id=self.client_id)
        self.CheckMethodIsAccessChecked(self.router.GetVfsFilesArchive,
                                        "CheckClientAccess",
                                        args=args)

        args = api_vfs.ApiGetFileDetailsArgs(client_id=self.client_id)
        self.CheckMethodIsAccessChecked(self.router.GetFileDetails,
                                        "CheckClientAccess",
                                        args=args)

        args = api_vfs.ApiGetFileTextArgs(client_id=self.client_id)
        self.CheckMethodIsAccessChecked(self.router.GetFileText,
                                        "CheckClientAccess",
                                        args=args)

        args = api_vfs.ApiGetFileBlobArgs(client_id=self.client_id)
        self.CheckMethodIsAccessChecked(self.router.GetFileBlob,
                                        "CheckClientAccess",
                                        args=args)

        args = api_vfs.ApiGetFileVersionTimesArgs(client_id=self.client_id)
        self.CheckMethodIsAccessChecked(self.router.GetFileVersionTimes,
                                        "CheckClientAccess",
                                        args=args)

        args = api_vfs.ApiGetFileDownloadCommandArgs(client_id=self.client_id)
        self.CheckMethodIsAccessChecked(self.router.GetFileDownloadCommand,
                                        "CheckClientAccess",
                                        args=args)

        args = api_vfs.ApiCreateVfsRefreshOperationArgs(
            client_id=self.client_id)
        self.CheckMethodIsAccessChecked(self.router.CreateVfsRefreshOperation,
                                        "CheckClientAccess",
                                        args=args)

        args = api_vfs.ApiGetVfsTimelineArgs(client_id=self.client_id)
        self.CheckMethodIsAccessChecked(self.router.GetVfsTimeline,
                                        "CheckClientAccess",
                                        args=args)

        args = api_vfs.ApiGetVfsTimelineAsCsvArgs(client_id=self.client_id)
        self.CheckMethodIsAccessChecked(self.router.GetVfsTimelineAsCsv,
                                        "CheckClientAccess",
                                        args=args)

        args = api_vfs.ApiUpdateVfsFileContentArgs(client_id=self.client_id)
        self.CheckMethodIsAccessChecked(self.router.UpdateVfsFileContent,
                                        "CheckClientAccess",
                                        args=args)
Ejemplo n.º 3
0
Archivo: vfs_test.py Proyecto: avmi/grr
 def testRaisesIfFirstComponentNotInAllowlist(self):
   args = vfs_plugin.ApiGetFileDownloadCommandArgs(
       client_id=self.client_id, file_path="/analysis")
   with self.assertRaises(ValueError):
     self.handler.Handle(args, context=self.context)
Ejemplo n.º 4
0
Archivo: vfs_test.py Proyecto: avmi/grr
 def testRaisesOnRootPath(self):
   args = vfs_plugin.ApiGetFileDownloadCommandArgs(
       client_id=self.client_id, file_path="/")
   with self.assertRaises(ValueError):
     self.handler.Handle(args, context=self.context)
Ejemplo n.º 5
0
 def testRaisesOnEmptyPath(self):
   args = vfs_plugin.ApiGetFileDownloadCommandArgs(
       client_id=self.client_id, file_path="")
   with self.assertRaises(ValueError):
     self.handler.Handle(args, token=self.token)