{"action":"created","issue":{"url":"https://api.github.com/repos/google/grr/issues/155","labels_url":"https://api.github.com/repos/google/grr/issues/155/labels{/name}","comments_url":"https://api.github.com/repos/google/grr/issues/155/comments","events_url":"https://api.github.com/repos/google/grr/issues/155/events","html_url":"https://github.com/google/grr/issues/155","id":68983356,"number":155,"title":"Download individual files from hunt","user":{"login":"pidydx","id":8451350,"avatar_url":"https://avatars.githubusercontent.com/u/8451350?v=3","gravatar_id":"","url":"https://api.github.com/users/pidydx","html_url":"https://github.com/pidydx","followers_url":"https://api.github.com/users/pidydx/followers","following_url":"https://api.github.com/users/pidydx/following{/other_user}","gists_url":"https://api.github.com/users/pidydx/gists{/gist_id}","starred_url":"https://api.github.com/users/pidydx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pidydx/subscriptions","organizations_url":"https://api.github.com/users/pidydx/orgs","repos_url":"https://api.github.com/users/pidydx/repos","events_url":"https://api.github.com/users/pidydx/events{/privacy}","received_events_url":"https://api.github.com/users/pidydx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/google/grr/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-04-16T18:31:32Z","updated_at":"2015-11-18T00:18:18Z","closed_at":null,"body":"Is there a way (or can a way be added) to download individual files from a hunt without needing separate client approvals for each client?  Right now I use the API to get the aff4path of the file and then use a post request similar to the individual download file buttons to get files, but this requires approvals for each client involved.\r\n\r\nIdeally these files could be downloaded through the hunt instead of needing to repeatedly regenerate the tar.gz file and download the entire set.  "},"comment":{"url":"https://api.github.com/repos/google/grr/issues/comments/157552764","html_url":"https://github.com/google/grr/issues/155#issuecomment-157552764","issue_url":"https://api.github.com/repos/google/grr/issues/155","id":157552764,"user":{"login":"destijl","id":1291767,"avatar_url":"https://avatars.githubusercontent.com/u/1291767?v=3","gravatar_id":"","url":"https://api.github.com/users/destijl","html_url":"https://github.com/destijl","followers_url":"https://api.github.com/users/destijl/followers","following_url":"https://api.github.com/users/destijl/following{/other_user}","gists_url":"https://api.github.com/users/destijl/gists{/gist_id}","starred_url":"https://api.github.com/users/destijl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/destijl/subscriptions","organizations_url":"https://api.github.com/users/destijl/orgs","repos_url":"https://api.github.com/users/destijl/repos","events_url":"https://api.github.com/users/destijl/events{/privacy}","received_events_url":"https://api.github.com/users/destijl/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T00:18:18Z","updated_at":"2015-11-18T00:18:18Z","body":"Here you go:\r\n\r\n```\r\nimport os\r\n\r\noutdir = \"/usr/local/out\"\r\npaths = []\r\nfor line in open(\"aff4_paths.txt\"):\r\n  paths.append(line.strip())\r\n\r\nfor fileobj in aff4.FACTORY.MultiOpen(paths):\r\n  path = os.path.join(outdir, str(fileobj.urn).replace(\"aff4:/\",\"\"))\r\n  folder = os.path.dirname(path)\r\n  if not os.path.exists(folder):\r\n    os.makedirs(folder)\r\n\r\n  if not os.path.exists(path):\r\n    with open(path, mode=\"w\") as out:\r\n      print \"writing %s\" % path\r\n      out.write(fileobj.read(999999999))\r\n\r\n```\r\n"}}