Exemple #1
0
    def GetProfileByName(self,
                         profile_name,
                         version=constants.PROFILE_REPOSITORY_VERSION):
        try:
            url = "%s/%s/%s.gz" % (
                config_lib.CONFIG["Rekall.profile_repository"], version,
                profile_name)
            handle = urllib2.urlopen(url, timeout=10)

        except urllib2.HTTPError as e:
            if e.code == 404:
                logging.info("Got a 404 while downloading Rekall profile %s",
                             url)
                return None
            raise
        except urllib2.URLError as e:
            logging.info(
                "Got an URLError while downloading Rekall profile %s: %s", url,
                e.reason)
            raise

        profile_data = handle.read()
        if profile_data[:3] != "\x1F\x8B\x08":
            raise ValueError(
                "Downloaded file does not look like gzipped data: %s",
                profile_data[:100])
        return rdf_rekall_types.RekallProfile(name=profile_name,
                                              version=version,
                                              data=profile_data)
Exemple #2
0
    def GetProfileByName(
            self,
            profile_name,
            version=server_stubs.REKALL_PROFILE_REPOSITORY_VERSION):
        try:
            url = "%s/%s/%s.gz" % (config.CONFIG["Rekall.profile_repository"],
                                   version, profile_name)
            handle = urllib2.urlopen(url, timeout=10)
            profile_data = handle.read()
            if profile_data[:3] != "\x1F\x8B\x08":
                raise ValueError(
                    "Downloaded file does not look like gzipped data: %s",
                    profile_data[:100])
            compression = "GZIP"
        except urllib2.HTTPError as e:
            if e.code == 404:
                # Try to download without the .gz
                handle = urllib2.urlopen(url[:-3], timeout=10)
                profile_data = handle.read()
                compression = "NONE"
            else:
                raise
        except urllib2.URLError as e:
            logging.info(
                "Got an URLError while downloading Rekall profile %s: %s", url,
                e.reason)
            raise

        return rdf_rekall_types.RekallProfile(name=profile_name,
                                              version=version,
                                              compression=compression,
                                              data=profile_data)
Exemple #3
0
 def GetRekallProfile(self, name, version=None):
   profile_path = os.path.join(config.CONFIG["Test.data_dir"], "profiles",
                               version, "%s.gz" % name)
   try:
     fd = open(profile_path, "r")
   except IOError:
     return
   return rdf_rekall_types.RekallProfile(
       name=name, version=version, data=fd.read(), compression="GZIP")
Exemple #4
0
  def GetProfileByName(self, profile_name, version="v1.0"):
    try:
      profile_data = open(
          os.path.join(config.CONFIG["Test.data_dir"], "profiles", version,
                       profile_name + ".gz"), "rb").read()

      self.profiles_served += 1

      return rdf_rekall_types.RekallProfile(
          name=profile_name, version=version, data=profile_data)
    except IOError:
      return None