public function parse()
    {
        /*
         * Preflight validations
         */
        $modes = array_change_key_case(config("{$this->configBase}.collector.modes"), CASE_LOWER);
        if (empty($modes) || !is_array($modes)) {
            return $this->failed('No mode of operation configured, or mode config invalid');
        }

        $feeds = config("{$this->configBase}.feeds");
        if (empty($feeds) || !is_array($feeds)) {
            return $this->failed('No RBL feeds configured, or feed config invalid');
        }

        foreach ($feeds as $feedName => $feedConfig) {
            $validator = Validator::make(
                array_merge($feedConfig, ['name' => $feedName]),
                $this->rulesFeed
            );

            if ($validator->fails()) {
                return $this->failed(implode(' ', $validator->messages()->all()));
            }
        }
        $this->feeds = $feeds;

        /*
         * For each configured mode kick of a scanning process.
         */
        foreach ($modes as $mode) {
            if (!array_key_exists($mode, $this->allowedModes)) {
                return $this->failed("Configuration error detected. Mode {$mode} is not an option");
            }

            if ($this->allowedModes[$mode]) {
                $config = config("{$this->configBase}.collector.{$mode}");

                if (empty($config) || !is_array($config)) {
                    return $this->failed(
                        "Configuration error detected. The settings for mode {$mode} is empty or not an array"
                    );
                }

                foreach ($config as $configElement) {
                    $validator = Validator::make(
                        [ $mode => $configElement ],
                        [ $mode => $this->rulesConfig[$mode] ]
                    );

                    if ($validator->fails()) {
                        return $this->failed(implode(' ', $validator->messages()->all()));
                    }
                }

            } else {
                continue;
            }
        }

        switch($mode) {
            case "asns":
                $this->scanAsn($config);
                break;
            case "netblocks":
                $this->scanNetblock($config);
                break;
            case "ipaddresses":
                $this->scanAddresses($config);
                break;
            case "tickets":
                $this->scanTickets();
                break;
        }


        return $this->success();
    }
public function parse()
    {
        /*
         * Preflight validations
         */
        $modes = array_change_key_case(config("{$this->configBase}.collector.modes"), CASE_LOWER);
        if (empty($modes) || !is_array($modes)) {
            return $this->failed('No mode of operation configured, or mode config invalid');
        }

        $feeds = config("{$this->configBase}.feeds");
        if (empty($feeds) || !is_array($feeds)) {
            return $this->failed('No RBL feeds configured, or feed config invalid');
        }

        foreach ($feeds as $feedName => $feedConfig) {
            $validator = Validator::make(
                array_merge($feedConfig, ['name' => $feedName]),
                $this->rulesFeed
            );

            if ($validator->fails()) {
                return $this->failed(implode(' ', $validator->messages()->all()));
            }
        }
        $this->feeds = $feeds;

        /*
         * For each configured mode kick of a scanning process.
         */
        foreach ($modes as $mode) {
            if (!array_key_exists($mode, $this->allowedModes)) {
                return $this->failed("Configuration error detected. Mode {$mode} is not an option");
            }

            if ($this->allowedModes[$mode]) {
                $config = config("{$this->configBase}.collector.{$mode}");

                if (empty($config) || !is_array($config)) {
                    return $this->failed(
                        "Configuration error detected. The settings for mode {$mode} is empty or not an array"
                    );
                }

                foreach ($config as $configElement) {
                    $validator = Validator::make(
                        [ $mode => $configElement ],
                        [ $mode => $this->rulesConfig[$mode] ]
                    );

                    if ($validator->fails()) {
                        return $this->failed(implode(' ', $validator->messages()->all()));
                    }
                }

            } else {
                continue;
            }
        }

        switch($mode) {
            case "asns":
                $this->scanAsn($config);
                break;
            case "netblocks":
                $this->scanNetblock($config);
                break;
            case "ipaddresses":
                $this->scanAddresses($config);
                break;
            case "tickets":
                $this->scanTickets();
                break;
        }


        return $this->success();
    }
public function parse ( ) { /*
         * Preflight validations
         */ $ modes = array_change_key_case ( config ( "{$this->configBase}.collector.modes" ) , CASE_LOWER ) ; if ( empty ( $ modes ) || ! is_array ( $ modes ) ) { return $ this -> failed ( 'No mode of operation configured, or mode config invalid' ) ; } $ feeds = config ( "{$this->configBase}.feeds" ) ; if ( empty ( $ feeds ) || ! is_array ( $ feeds ) ) { return $ this -> failed ( 'No RBL feeds configured, or feed config invalid' ) ; } foreach ( $ feeds as $ feedName => $ feedConfig ) { $ validator = Validator :: make ( array_merge ( $ feedConfig , [ 'name' => $ feedName ] ) , $ this -> rulesFeed ) ; if ( $ validator -> fails ( ) ) { return $ this -> failed ( implode ( ' ' , $ validator -> messages ( ) -> all ( ) ) ) ; } } $ this -> feeds = $ feeds ; /*
         * For each configured mode kick of a scanning process.
         */ foreach ( $ modes as $ mode ) { if ( ! array_key_exists ( $ mode , $ this -> allowedModes ) ) { return $ this -> failed ( "Configuration error detected. Mode {$mode} is not an option" ) ; } if ( $ this -> allowedModes [ $ mode ] ) { $ config = config ( "{$this->configBase}.collector.{$mode}" ) ; if ( empty ( $ config ) || ! is_array ( $ config ) ) { return $ this -> failed ( "Configuration error detected. The settings for mode {$mode} is empty or not an array" ) ; } foreach ( $ config as $ configElement ) { $ validator = Validator :: make ( [ $ mode => $ configElement ] , [ $ mode => $ this -> rulesConfig [ $ mode ] ] ) ; if ( $ validator -> fails ( ) ) { return $ this -> failed ( implode ( ' ' , $ validator -> messages ( ) -> all ( ) ) ) ; } } } else { continue ; } } switch ( $ mode ) { case "asns" : $ this -> scanAsn ( $ config ) ; break ; case "netblocks" : $ this -> scanNetblock ( $ config ) ; break ; case "ipaddresses" : $ this -> scanAddresses ( $ config ) ; break ; case "tickets" : $ this -> scanTickets ( ) ; break ; } return $ this -> success ( ) ; }
Scan RBL zones

@return array    Returns array with failed or success data
(See collector-common/src/Collector.php) for more info.
Scan RBL zones