Exemplo n.º 1
0
# pylint: disable=unused-import
# Make sure we load the client plugins
from grr_response_client import client_plugins
# pylint: enable=unused-import

from grr_response_client import client_startup
from grr_response_client import comms
from grr_response_client import vfs
from grr_response_core import config
from grr_response_core.config import contexts
from grr_response_core.lib import flags
from grr_response_core.lib.rdfvalues import crypto as rdf_crypto
from grr_response_core.lib.rdfvalues import paths as rdf_paths

flags.DEFINE_integer("nrclients", 1, "Number of clients to start")

flags.DEFINE_string(
    "cert_file", "", "Path to a file that stores all certificates for"
    "the client pool.")

flags.DEFINE_bool("enroll_only", False,
                  "If specified, the script will enroll all clients and exit.")

flags.DEFINE_bool(
    "fast_poll", False,
    "If specified, every client in the pool will work in the "
    "fast poll mode. This is useful for benchmarks, as in fast "
    "poll mode the timeouts are predictable and benchmarks "
    "results are more stable.")
Exemplo n.º 2
0
from grr_response_server import server_plugins
# pylint: enable=g-bad-import-order

from grr_api_client import api
from grr_api_client import api_shell_lib
from grr_response_core import config
from grr_response_core.config import contexts
from grr_response_core.config import server as config_server
from grr_response_core.lib import flags
from grr_response_server import access_control
from grr_response_server import fleetspeak_connector
from grr_response_server import server_startup
from grr_response_server.bin import api_shell_raw_access_lib

flags.DEFINE_integer(
    "page_size", 1000,
    "Page size used when paging through collections of items. Default is 1000."
)

flags.DEFINE_string(
    "username", None, "Username to use when making raw API calls. If not "
    "specified, USER environment variable value will be used.")

flags.DEFINE_string(
    "exec_code", None,
    "If present, no IPython shell is started but the code given in "
    "the flag is run instead (comparable to the -c option of "
    "IPython). The code will be able to use a predefined "
    "global 'grrapi' object.")

flags.DEFINE_string(
    "exec_file", None,
Exemplo n.º 3
0
flags.DEFINE_string("aff4path", "/",
                    "Path in AFF4 to use as the root of the filesystem.")

flags.DEFINE_string("mountpoint", None,
                    "Path to point at which the system should be mounted.")

flags.DEFINE_bool(
    "background", False,
    "Whether or not to run the filesystem in the background,"
    " not viewing debug information.")

flags.DEFINE_float("timeout", 30,
                   "How long to poll a flow for before giving up.")

flags.DEFINE_integer(
    "max_age_before_refresh", 60 * 5,
    "Measured in seconds. Do a client-side update if it's"
    " been this long since we last did one.")

flags.DEFINE_bool(
    "ignore_cache", False, "Disables cache completely. Takes priority over"
    " refresh_policy.")

flags.DEFINE_enum("refresh_policy",
                  "if_older_than_max_age",
                  ["if_older_than_max_age", "always", "never"],
                  "How to refresh the cache. Options are: always (on every"
                  " client-side access), never, or, by default,"
                  " if_older_than_max_age (if last accessed > max_age seconds"
                  " ago).",
                  type=str)
Exemplo n.º 4
0
# pylint: disable=unused-import,g-bad-import-order
from grr_response_server import server_plugins
# pylint: enable=unused-import,g-bad-import-order

from grr_response_core.lib import flags
from grr_response_core.lib import utils
from grr_response_core.lib.util import csv
from grr_response_server import aff4
from grr_response_server import data_store
from grr_response_server import server_startup

from grr_response_server.aff4_objects import filestore

flags.DEFINE_string("filename", "", "File with hashes.")
flags.DEFINE_integer("start", None, "Start row in the file.")


def _ImportRow(store, row, product_code_list, op_system_code_list):
    sha1 = row[0].lower()
    md5 = row[1].lower()
    crc = int(row[2].lower(), 16)
    file_name = utils.SmartUnicode(row[3])
    file_size = int(row[4])
    special_code = row[7]
    store.AddHash(sha1, md5, crc, file_name, file_size, product_code_list,
                  op_system_code_list, special_code)


def ImportFile(store, filename, start):
    """Import hashes from 'filename' into 'store'."""
Exemplo n.º 5
0
"""Base classes and routines used by all end to end tests."""
from __future__ import absolute_import
from __future__ import division

import abc
import io
import logging
import time

from absl.testing import absltest
from future.utils import with_metaclass

from grr_api_client import errors
from grr_response_core.lib import flags

flags.DEFINE_integer("flow_timeout_secs", 650,
                     "How long to wait for flows to finish.")

flags.DEFINE_integer(
    "flow_results_sla_secs", 60,
    "How long to wait for flow results to be available after a flow completes."
)


class Error(Exception):
    """Base class for end-to-end tests exceptions."""


def GetClientTestTargets(grr_api=None,
                         client_ids=None,
                         hostnames=None,
                         checkin_duration_threshold=3600):