Initiate a site scan.

 @param [Fixnum] site_id Site ID to scan.
 @param [Boolean] blackout_override Optional. Given suffencent permissions, force bypass blackout and start scan.
 @return [Scan] Scan launch information.
420076
def scan_site(site_id, blackout_override = false)
      xml = make_xml('SiteScanRequest', 'site-id' => site_id)
      xml.add_attributes({ 'force' => true }) if blackout_override
      response = execute(xml)
      Scan.parse(response.res) if response.success
    end
665943
def create
      unless @reset_request.valid?
        render 'new' and return
      end

      @user = User.find_by(email: @reset_request.email)
      if @user && @user.enabled? && @user.activated?
        @user.create_reset_digest
        @user.send_password_reset_email request.remote_ip
      elsif @user
        if !@user.enabled?
          User.send_disabled_reset_email(email, request.remote_ip)
        elsif !@user.active?
          User.send_inactive_reset_email(email, request.remote_ip)
        else
          User.send_missing_reset_email(email, request.remote_ip)
        end
      else
        User.send_missing_reset_email(email, request.remote_ip)
      end

      flash[:info] = 'An email with password reset information has been sent to you.'
      redirect_to main_app.root_url
    end
1307082
public function _after_site_reactivated_callback( $context_blog_id = 0 ) {
            $this->_logger->entrance();

            $install = $this->get_install_by_blog_id( $context_blog_id );

            if ( ! is_object( $install ) ) {
                // Site not connected.
                return;
            }

            if ( ! self::is_site_active( $context_blog_id ) ) {
                // Site not yet active (can be in spam mode, archived, deleted...).
                return;
            }

            $current_blog_id = get_current_blog_id();

            $this->switch_to_blog( $context_blog_id );

            // Send re-activation event.
            $this->sync_install( array(
                'is_active' => true,
            ) );

            $this->switch_to_blog( $current_blog_id );
        }
966022
def start_executing_host_checks(self):
        
        # todo: #783 create a dedicated brok for global parameters
        if not self.my_conf.execute_host_checks:
            self.my_conf.modified_attributes |= DICT_MODATTR["MODATTR_ACTIVE_CHECKS_ENABLED"].value
            self.my_conf.execute_host_checks = True
            self.my_conf.explode_global_conf()
            self.daemon.update_program_status()
706002
def scan_site!
      add_pages_for_scan!
      while @pages_for_scan.size > 0
        page = convert_to_valid @pages_for_scan.pop
        next unless page
        @max_pages -= 1
        add_page convert_to_valid(page)
        return if @max_pages <= 0
        add_pages_for_scan!
        optimize_scan!
      end
    end
847558
def run(host,
        node,
        port,
        endpoint,
        tls,
        username,
        password,
        keyring,
        search_from,
        search_to,
        mode,
        output,
        follow,
        interval,
        limit,
        latency,
        stream,
        field,
        template_option,
        sort,
        asc,
        proxy,
        query):
    

    cfg = get_config()

    # Configure the graylog API object
    if node is not None:
        # The user specified a preconfigured node, take the config from there
        gl_api = api_from_config(cfg, node_name=node)
    else:
        if host is not None:
            # A manual host configuration is used
            if username is None:
                username = click.prompt("Enter username for {host}:{port}".format(host=host, port=port),
                                        default=getpass.getuser())
            if tls:
                scheme = "https"
            else:
                scheme = "http"

            if proxy:
                proxies = {scheme: proxy}
            else:
                proxies = None

            gl_api = api_from_host(host=host, port=port, endpoint=endpoint, username=username, scheme=scheme,
                                   proxies=proxies)
        else:
            if cfg.has_section("node:default"):
                gl_api = api_from_config(cfg)
            else:
                cli_error("Error: No host or node configuration specified and no default found.")

    if username is not None:
        gl_api.username = username

    if keyring and password is None:
        password = get_password_from_keyring(gl_api.host, gl_api.username)

    if password is None:
        password = click.prompt("Enter password for {username}@{api}".format(
            username=gl_api.username, api=gl_api), hide_input=True)

    gl_api.password = password

    if keyring:
        store_password_in_keyring(gl_api.host, gl_api.username, password)

    username = gl_api.username

    # Check if the query should be retrieved from the configuration
    if query[0] == ":":
        section_name = "query" + query
        template_options = dict(map(lambda t: tuple(str(t).split("=", 1)), template_option))
        query = get_templated_option(cfg, section_name, "query", template_options)

        if cfg.has_option(section_name, "limit"):
            limit = get_templated_option(cfg, section_name, "limit", template_options)

        if cfg.has_option(section_name, "from"):
            search_from = get_templated_option(cfg, section_name, "from", template_options)

        if cfg.has_option(section_name, "to"):
            search_to = get_templated_option(cfg, section_name, "to", template_options)

        if cfg.has_option(section_name, "sort"):
            sort = get_templated_option(cfg, section_name, "sort", template_options)

        if cfg.has_option(section_name, "asc"):
            asc = get_templated_option(cfg, section_name, "asc", template_options)

        if cfg.has_option(section_name, "fields"):
            field = get_templated_option(cfg, section_name, "fields", template_options).split(",")

        if cfg.has_option(section_name, "stream"):
            stream = get_templated_option(cfg, section_name, "stream", template_options)

    # Configure the base query
    sr = SearchRange(from_time=search_from, to_time=search_to)

    # Pass none if the list of fields is empty
    fields = None
    if field:
        fields = list(field)

    if limit <= 0:
        limit = None

    # Set limit to None, sort to none and start time to now, if follow is active
    if follow:
        limit = None
        sort = None
        sr.from_time = arrow.now('local').replace(seconds=-latency - 1)
        sr.to_time = arrow.now('local').replace(seconds=-latency)

    # Get the user permissions
    userinfo = gl_api.user_info(username)

    # If the permissions are not set or a stream is specified
    stream_filter = None
    if stream or (userinfo["permissions"] != ["*"] and gl_api.default_stream is None):
        if not stream:
            streams = gl_api.streams()["streams"]
            click.echo("Please select a stream to query:")
            for i, stream in enumerate(streams):
                click.echo("{}: Stream '{}' (id: {})".format(i, stream["title"], stream["id"]))
            i = click.prompt("Enter stream number:", type=int, default=0)
            stream = streams[i]["id"]
        stream_filter = "streams:{}".format(stream)

    # Create the initial query object
    q = SearchQuery(search_range=sr, query=query, limit=limit, filter=stream_filter, fields=fields, sort=sort,
                    ascending=asc)

    # Check the mode in which the program should run (dump, tail or interactive mode)
    if mode == "tail":
        if fields:
            formatter = tail_format(fields)
        else:
            formatter = tail_format()
    elif mode == "dump":
        formatter = dump_format()

    run_logprint(gl_api, q, formatter, follow, interval, latency, output)
288387
def load_target(cls, scheme, path, fragment, username,
                    password, hostname, port, query,
                    load_method, **kwargs):
        
        raise NotImplementedError("load_target must be overridden")
28345
def is_launch?(msg, exp_class)

      if exp_class != Ruote::Exp::DefineExpression
        false
      elsif %w[ launch regenerate ].include?(msg['action'])
        true
      else
        (msg['trigger'] == 'on_re_apply')
          # let re-apply "define" blocks, as in Ruote.define {}
      end
    end
726248
def opt_allow_select_scan(self, allow):
        
        allow = allow.lower() in ("true", "t", "yes", "y")
        self.conf["allow_select_scan"] = allow
        self.engine.allow_select_scan = allow
1060168
def on_site(self, site_id=None):
        
        if settings.PAGES_USE_SITE_ID:
            if not site_id:
                site_id = settings.SITE_ID
            return self.get_queryset().filter(sites=site_id)
        return self.all()
803736
void activateProbeProxyTarget() throws Exception {
        Method method = ReflectionHelper.getDeclaredMethod(
                                                           probeManagerImpl.getClass(),
                                                           ProbeMethodAdapter.FIRE_PROBE_METHOD_NAME,
                                                           long.class, Object.class, Object.class, Object.class);
        ReflectionHelper.setAccessible(method, true);
        if (!Type.getMethodDescriptor(method).equals(ProbeMethodAdapter.FIRE_PROBE_METHOD_DESC)) {
            throw new IncompatibleClassChangeError("Proxy method signature does not match byte code");
        }
        findProbeProxySetFireProbeTargetMethod().invoke(null, probeManagerImpl, method);
    }
364349
def add_scan_alarm(self, scan_id, host='', name='', value='', port='',
                       test_id='', severity='', qod=''):
        
        self.scan_collection.add_result(scan_id, ResultType.ALARM, host, name,
                                        value, port, test_id, severity, qod)
406634
def method_missing(name, *args, &block)
      if @resource.respond_to?(name)
        result = @resource.send(name, *args, &block)
        result.is_a?(Resource) ? ResourceAndAddress.new(result, @address.dup) : result
      else
        super
      end
    end
1010156
def activate(self, page=None):
        
        page = page or ''

        if '://' in page:
            self._iface.activate_overlay_url(page)

        else:
            self._iface.activate_overlay_game(page)
2088
def run(self):
        """"""
        self._log.info('Starting Pulsar Search Interface')
        # Instantiate a dummy authorizer for managing 'virtual' users
        authorizer = DummyAuthorizer()

        # Define a new user having full r/w permissions and a read-only
        # anonymous user
        authorizer.add_user(self._config['login']['user'],
                            self._config['login']['psswd'], '.',
                            perm=self._config['login']['perm'])
        authorizer.add_anonymous(os.getcwd())

        # Instantiate FTP handler class
        handler = FTPHandler
        handler.authorizer = authorizer
        handler.abstracted_fs = PulsarFileSystem

        # Define a customized banner (string returned when client connects)
        handler.banner = "SKA SDP pulsar search interface."

        # Instantiate FTP server class and listen on 0.0.0.0:7878
        address = (self._config['address']['listen'],
                   self._config['address']['port'])
        server = FTPServer(address, handler)

        # set a limit for connections
        server.max_cons = 256
        server.max_cons_per_ip = 5

        # start ftp server
        server.serve_forever()
1355395
def create_scan(self, scan_id, targets, options, vts):
        
        if self.scan_exists(scan_id):
            logger.info("Scan %s exists. Resuming scan.", scan_id)

        return self.scan_collection.create_scan(scan_id, targets, options, vts)
1226264
public void launchNewProviderWizard() {
        SecurityContext securityContext = securityFramework.getSecurityContext(getProxy().getNameToken());
        ResourceDescription resourceDescription = descriptionRegistry.lookup(PROVIDER_TEMPLATE);

        final DefaultWindow dialog = new DefaultWindow(
                Console.MESSAGES.newMessagingProvider());
        AddResourceDialog addDialog = new AddResourceDialog(securityContext, resourceDescription,
                new AddResourceDialog.Callback() {
                    @Override
                    public void onAdd(ModelNode payload) {
                        dialog.hide();
                        String name = payload.get("name").asString();
                        ResourceAddress fqAddress = PROVIDER_TEMPLATE.resolve(statementContext, name);
                        payload.get(OP).set(ADD);
                        payload.get(ADDRESS).set(fqAddress);

                        dispatcher.execute(new DMRAction(payload), new SimpleCallback<DMRResponse>() {
                            @Override
                            public void onFailure(Throwable caught) {
                                super.onFailure(caught);
                                loadProvider();
                            }

                            @Override
                            public void onSuccess(DMRResponse dmrResponse) {
                                Console.info(Console.MESSAGES
                                        .successfullyAddedMessagingProvider(name));
                                loadProvider();
                            }
                        });
                    }

                    @Override
                    public void onCancel() {
                        dialog.hide();
                    }
                })
                .addFactory("security-domain", attributeDescription ->  {
                    SuggestionResource suggestionResource = new SuggestionResource("security-domain", "Security domain", true,
                            Console.MODULES.getCapabilities().lookup(SECURITY_DOMAIN));
                    return suggestionResource.buildFormItem();
                })
                .include("security-enabled", "security-domain", "cluster-user", "cluster-password");

        dialog.setWidth(640);
        dialog.setHeight(480);
        dialog.setWidget(addDialog);
        dialog.setGlassEnabled(true);
        dialog.center();
    }