yaml.load(open(flags.FLAGS.file, "rb")) # Check it will parse. base_urn = aff4.ROOT_URN.Add("artifact_store") try: artifact.UploadArtifactYamlFile( open(flags.FLAGS.file, "rb").read(1000000), base_urn=base_urn, token=token, overwrite=flags.FLAGS.overwrite_artifact) except artifact_registry.ArtifactDefinitionError as e: print "Error %s. You may need to set --overwrite_artifact." % e elif flags.FLAGS.subparser_name == "delete_artifacts": artifact_list = flags.FLAGS.artifact if not artifact_list: raise ValueError("No artifact to delete given.") artifact_registry.DeleteArtifactsFromDatastore(artifact_list, token=token) print "Artifacts %s deleted." % artifact_list elif flags.FLAGS.subparser_name == "download_missing_rekall_profiles": print "Downloading missing Rekall profiles." s = rekall_profile_server.GRRRekallProfileServer() s.GetMissingProfiles() elif flags.FLAGS.subparser_name == "set_global_notification": notification = aff4_users.GlobalNotification( type=flags.FLAGS.type, header=flags.FLAGS.header, content=flags.FLAGS.content, link=flags.FLAGS.link) if flags.FLAGS.show_from: notification.show_from = rdfvalue.RDFDatetime(
def Handle(self, args, token=None): artifact_registry.DeleteArtifactsFromDatastore(set(args.names), token=token)