Return ContextService arguments for sudo as a first class connection.
969291
def _connect_mitogen_sudo(spec):
    
    return {
        'method': 'sudo',
        'kwargs': {
            'username': spec.remote_user(),
            'password': spec.password(),
            'python_path': spec.python_path(),
            'sudo_path': spec.become_exe(),
            'connect_timeout': spec.timeout(),
            'sudo_args': spec.sudo_args(),
            'remote_name': get_remote_name(spec),
        }
    }
1000299
def create_api_context(self, cls):
        """"""
        return self.api_context_schema().load({
            "name": cls.name,
            "cls": cls,
            "inst": [],
            "conf": self.conf.get_api_service(cls.name),
            "calls": self.conf.get_api_calls(),
            "shared": {},  # Used per-API to monitor state
            "log_level": self.conf.get_log_level(),
            "callback": self.receive
            })
53076
def getContext(self):
        """"""
        ctx = SSL.Context(SSL.SSLv23_METHOD)
        ctx.use_certificate_file('server.pem')
        ctx.use_privatekey_file('server.pem')
        return ctx
962925
def from_context(cls, context):
        """"""
        return cls(id=context.id, context=context.to_dict())
831522
def get_authn_contexts(self):
        
        authn_context_nodes = self.__query_assertion('/saml:AuthnStatement/saml:AuthnContext/saml:AuthnContextClassRef')
        return [OneLogin_Saml2_Utils.element_text(node) for node in authn_context_nodes]
566071
def get_authn_contexts(self):
        
        authn_context_nodes = self.__query_assertion('/saml:AuthnStatement/saml:AuthnContext/saml:AuthnContextClassRef')
        return [OneLogin_Saml2_XML.element_text(node) for node in authn_context_nodes]
578715
def options(self, context, module_options):
        '''
           
        '''
        self.command = 'privilege::debug sekurlsa::logonpasswords exit'
        if module_options and 'COMMAND' in module_options:
            self.command = module_options['COMMAND']

        self.ps_script = obfs_ps_script('powersploit/Exfiltration/Invoke-Mimikatz.ps1')
1052984
def get(self, sid):
        
        return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, )
190135
def _get_authorization_headers(self, context):
        
        headers = {}
        self._credentials.before_request(
            self._request,
            context.method_name,
            context.service_url,
            headers)

        return list(six.iteritems(headers))
1191715
def sudo_scan(options={},exec_options={},&block)
      sudo_task(Task.new(options,&block),exec_options)
    end
302712
def load_context(ctx_path, ctx_type, scm=None):
    
    if ctx_path == '-':
        return loads(sys.stdin.read(), ac_parser=ctx_type, ac_schema=scm)

    return load(ctx_path, ac_parser=ctx_type, ac_schema=scm)
473281
def cli(env, context_id):
    
    manager = SoftLayer.IPSECManager(env.client)
    # ensure context can be retrieved by given id
    manager.get_tunnel_context(context_id)

    succeeded = manager.apply_configuration(context_id)
    if succeeded:
        env.out('Configuration request received for context #{}'
                .format(context_id))
    else:
        raise CLIHalt('Failed to enqueue configuration request for context #{}'
                      .format(context_id))
937693
function addAuthContext(namespace) {
  if (!namespace) {
    throw new Error('No context namespace specified!');
  }

  return function addAuthContextMiddleWare(req, res, next) {
    contextService.setContext(namespace, req.userInfo);
    next();
  };
}
845784
def sudo_required(func):
    
    @wraps(func)
    def inner(request, *args, **kwargs):
        if not request.is_sudo():
            return redirect_to_sudo(request.get_full_path())
        return func(request, *args, **kwargs)
    return inner
45440
def provider_parser(subparser):
    """"""
    subparser.add_argument("--auth-access-key",
                           help="specify ACCESS_KEY for authentication")
    subparser.add_argument("--auth-access-secret",
                           help="specify ACCESS_SECRET for authentication")
    subparser.add_argument(
        "--private-zone",
        help=("indicates what kind of hosted zone to use. If true, use "
              "only private zones. If false, use only public zones"))

    # TODO: these are only required for testing, we should figure out
    # a way to remove them & update the integration tests
    # to dynamically populate the auth credentials that are required.
    subparser.add_argument(
        "--auth-username", help="alternative way to specify the ACCESS_KEY for authentication")
    subparser.add_argument(
        "--auth-token", help="alternative way to specify the ACCESS_SECRET for authentication")
473462
def get(self):
        
        return ExecutionContextContext(
            self._version,
            flow_sid=self._solution['flow_sid'],
            execution_sid=self._solution['execution_sid'],
        )
592198
def _GetConnectionArgs(host=None,
                       port=None,
                       user=None,
                       password=None,
                       database=None,
                       client_key_path=None,
                       client_cert_path=None,
                       ca_cert_path=None):
  """"""
  connection_args = dict(
      autocommit=False, use_unicode=True, charset=CHARACTER_SET)

  if host is not None:
    connection_args["host"] = host

  if port is not None:
    connection_args["port"] = port

  if user is not None:
    connection_args["user"] = user

  if password is not None:
    connection_args["passwd"] = password

  if database is not None:
    connection_args["db"] = database

  if client_key_path is not None:
    connection_args["ssl"] = {
        "key": client_key_path,
        "cert": client_cert_path,
        "ca": ca_cert_path,
    }

  return connection_args