How to use the ip.selector function in ip

To help you get started, we’ve selected a few ip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wazuh / wazuh-kibana-app / public / services / api-tester.js View on Github external
async checkStored(data) {
    try {
      const configuration = this.wazuhConfig.getConfig();
      const timeout = configuration ? configuration.timeout : 20000;
      const headers = {
        headers: { 'Content-Type': 'application/json' },
        timeout: timeout || 20000
      };
      const payload = { id: data };
      const result = await this.$http.post(
        chrome.addBasePath('/api/check-stored-api'),
        payload,
        headers
      );

      this.appState.setPatternSelector(configuration['ip.selector']);

      if (result.error) {
        return Promise.reject(result);
      }
      return result;
    } catch (error) {
      if (((error || {}).data || {}).code === 3099) {
        // Do nothing
        return 3099;
      }
      if (error.status && error.status === -1) {
        this.wzMisc.setApiIsDown(true);
      }
      return Promise.reject(error);
    }
  }
github wazuh / wazuh-kibana-app / public / directives / wz-menu / wz-menu.js View on Github external
const load = async () => {
      try {
        const list = await patternHandler.getPatternList();
        if (!list) return;

        // Get the configuration to check if pattern selector is enabled
        const config = wazuhConfig.getConfig();
        appState.setPatternSelector(config['ip.selector']);

        // Abort if we have disabled the pattern selector
        if (!appState.getPatternSelector()) return;

        // Show the pattern selector
        $scope.showSelector = true;
        let filtered = false;
        // If there is no current pattern, fetch it
        if (!appState.getCurrentPattern()) {
          appState.setCurrentPattern(list[0].id);
        } else {
          // Check if the current pattern cookie is valid
          filtered = list.filter(item =>
            item.id.includes(appState.getCurrentPattern())
          );
          if (!filtered.length) appState.setCurrentPattern(list[0].id);
github wazuh / wazuh-kibana-app / public / controllers / settings / settings.js View on Github external
return this.apiEntries;
      }

      const tmpData = {
        user: this.formData.user,
        password: base64.encode(this.formData.password),
        url: this.formData.url,
        port: this.formData.port,
        cluster_info: {},
        insecure: 'true',
        extensions: {}
      };

      const config = this.wazuhConfig.getConfig();

      this.appState.setPatternSelector(config['ip.selector']);

      tmpData.extensions.audit = config['extensions.audit'];
      tmpData.extensions.pci = config['extensions.pci'];
      tmpData.extensions.gdpr = config['extensions.gdpr'];
      tmpData.extensions.hipaa = config['extensions.hipaa'];
      tmpData.extensions.nist = config['extensions.nist'];
      tmpData.extensions.oscap = config['extensions.oscap'];
      tmpData.extensions.ciscat = config['extensions.ciscat'];
      tmpData.extensions.aws = config['extensions.aws'];
      tmpData.extensions.virustotal = config['extensions.virustotal'];
      tmpData.extensions.osquery = config['extensions.osquery'];
      tmpData.extensions.docker = config['extensions.docker'];

      const checkData = await this.testAPI.check(tmpData);

      // API Check correct. Get Cluster info
github wazuh / wazuh-kibana-app / public / directives / wz-menu / wz-menu.js View on Github external
const load = async () => {
            try {
                // Get the configuration to check if pattern selector is enabled
                const config = wazuhConfig.getConfig();
                appState.setPatternSelector(config['ip.selector']);

                // Abort if we have disabled the pattern selector
                if(!appState.getPatternSelector()) return;

                // Show the pattern selector
                $rootScope.showSelector = true;
                let filtered = false;
                // If there is no current pattern, fetch it
                if(!appState.getCurrentPattern()) {
                    const currentPattern = await genericReq.request('GET', '/get-list');
                    if(!currentPattern.data.data.length){
                        wzMisc.setBlankScr('Sorry but no valid index patterns were found')
                        $location.search('tab',null);
                        $location.path('/blank-screen');
                        return;
                    }
github wazuh / wazuh-kibana-app / public / controllers / misc / health-check.js View on Github external
async load() {
    try {
      const configuration = this.wazuhConfig.getConfig();

      this.appState.setPatternSelector(configuration['ip.selector']);

      this.checks.pattern = configuration['checks.pattern'];
      this.checks.template = configuration['checks.template'];
      this.checks.api = configuration['checks.api'];
      this.checks.setup = configuration['checks.setup'];

      this.results.push(
        {
          id: 0,
          description: 'Check Wazuh API connection',
          status: this.checks.api ? 'Checking...' : 'disabled'
        },
        {
          id: 1,
          description: 'Check for Wazuh API version',
          status: this.checks.setup ? 'Checking...' : 'disabled'