Skip to content

Commit

Permalink
Fixing a bug and more logging for profile downloading.
Browse files Browse the repository at this point in the history
  • Loading branch information
grrrrrrrrr committed Jul 20, 2017
1 parent a69303c commit e48e333
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion grr/client/comms.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ def GetRekallProfile(self, profile_name, version="v1.0"):
return None

pb = rdf_rekall_types.RekallProfile.protobuf()
json_format.Parse(response.data, pb)
json_format.Parse(response.data.lstrip(")]}'\n"), pb)
return rdf_rekall_types.RekallProfile.FromSerializedString(
pb.SerializeToString())

Expand Down
4 changes: 3 additions & 1 deletion grr/lib/front_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,12 @@ def _GetRekallProfileServer(self):
def GetRekallProfile(self, name, version="v1.0"):
server = self._GetRekallProfileServer()

logging.debug("Serving Rekall profile %s/%s", version, name)
try:
return server.GetProfileByName(name, version)
# TODO(user): We raise too many different exceptions in profile server.
except Exception: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except
logging.debug("Unable to serve profile %s/%s: %s", version, name, e)
return None


Expand Down
21 changes: 10 additions & 11 deletions grr/server/stats_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,15 @@ def RunOnce(self):
port = config.CONFIG["Monitoring.http_port"]
if port != 0:
logging.info("Starting monitoring server on port %d.", port)
# pylint: disable=g-import-not-at-top
from grr.lib.local import plugins as _
local_overrides = grr.lib.local
# pylint: enable=g-import-not-at-top
if "stats_server" in dir(local_overrides):
stats_server = local_overrides.stats_server.StatsServer(port)
logging.debug("Using local StatsServer from %s", local_overrides)
else:
stats_server = StatsServer(port)

stats_server.Start()
try:
# pylint: disable=g-import-not-at-top
from grr.lib.local import stats_server
# pylint: enable=g-import-not-at-top
server_obj = stats_server.StatsServer(port)
logging.debug("Using local StatsServer")
except ImportError:
server_obj = StatsServer(port)

server_obj.Start()
else:
logging.info("Monitoring server disabled.")
2 changes: 2 additions & 0 deletions grr/tools/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def ServeRekallProfile(self, path):
Args:
path: The path the client requested.
"""
logging.debug("Rekall profile request from IP %s for %s",
self.client_address[0], path)
remaining_path = path[len(self.rekall_profile_path):]
if not remaining_path.startswith("/"):
self.Send("Error serving profile.", status=500, ctype="text/plain")
Expand Down

0 comments on commit e48e333

Please sign in to comment.