예제 #1
0
파일: magics.py 프로젝트: skirankumar/grr
def grr_head(line):
    """Reads the first bytes of a specified file.

  Args:
    line: A string representing arguments passed to the magic command.

  Returns:
    Specified number of the first bytes of the file.

  Raises:
    NoClientSelectedError: Client is not selected to perform this operation.
  """
    args = grr_head.parser.parse_args(shlex.split(line))
    return magics_impl.grr_head_impl(path=args.path,
                                     bytes=args.bytes,
                                     offset=args.offset,
                                     cached=args.cached)
예제 #2
0
 def testNoClientSelected(self):
     with self.assertRaises(magics_impl.NoClientSelectedError):
         magics_impl.grr_head_impl('foo')