Skip to content

Add new syscollector requests#728

Merged
jesuslinares merged 10 commits into3.5from
dev-3.3-syscollector-api-calls
Jul 25, 2018
Merged

Add new syscollector requests#728
jesuslinares merged 10 commits into3.5from
dev-3.3-syscollector-api-calls

Conversation

@Lifka
Copy link
Contributor

@Lifka Lifka commented Jun 5, 2018

Hello team,

this PR solves the issue wazuh/wazuh-api#84.

More details in Wazuh-API repository: wazuh/wazuh-api#89.

Regards.

@Lifka Lifka requested a review from jesuslinares June 5, 2018 16:31
@jesuslinares jesuslinares requested review from mgmacias95 and removed request for jesuslinares June 12, 2018 11:12
@jesuslinares jesuslinares self-assigned this Jun 12, 2018
@Lifka Lifka changed the base branch from master to 3.4 June 14, 2018 09:20
@mgmacias95 mgmacias95 changed the base branch from 3.4 to 3.5 July 9, 2018 21:43
Copy link
Contributor

@mgmacias95 mgmacias95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @Lifka,

Array responses are not being nested. Is there a reason for this?

# curl -u foo:bar "localhost:55000/syscollector/000/ports?pretty"
{
   "error": 0,
   "data": {
      "totalItems": 14,
      "items": [
         {
            "scan_id": 1587362939,
            "protocol": "tcp",
            "local_ip": "0.0.0.0",
            "scan_time": "2018/07/14 00:10:17",
            "local_port": 5601,
            "state": "listening",
            "tx_queue": 0,
            "rx_queue": 0,
            "inode": 22222,
            "remote_port": 0,
            "remote_ip": "0.0.0.0"
         },
         {
            "scan_id": 1587362939,
            "protocol": "tcp",
            "local_ip": "127.0.0.53",
            "scan_time": "2018/07/14 00:10:17",
            "local_port": 53,
            "state": "listening",
            "tx_queue": 0,
            "rx_queue": 0,
            "inode": 15924,
            "remote_port": 0,
            "remote_ip": "0.0.0.0"
         },

Best regards,
Marta

request = "{} limit {} offset {}".format(query_lower, step, off)
response.extend(self.__send(request))
except ValueError:
request = "{} limit {} offset {}".format(query_lower, step//2, off)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an exception handler to prevent "incomplete JSON errors". If a JSON comes incomplete from Wazuh DB, the half of items is requested.

@jesuslinares jesuslinares merged this pull request into 3.5 Jul 25, 2018
@jesuslinares jesuslinares deleted the dev-3.3-syscollector-api-calls branch July 25, 2018 17:36
vikman90 pushed a commit that referenced this pull request Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants