Forum Discussion
3 years ago
Locally on my laptop or another system that has node installed with a few npm packages. I would run it locally like this "node compliance-count.js".
This is on a new datasource and then selecting upload script file. I tried adding "node" as a parameter.
cleaned up script below
const axios = require('axios'); const https = require('https'); const _ = require('lodash'); const usKEY = 'theapikey' const us_auth = { username: usKEY, password: '' } const agent = new https.Agent({ rejectUnauthorized: false }); axios.get("https://x.x.x.x/api/v1/system/active-users?number=400", {auth: us_auth, httpsAgent: agent}) .then(function (response) { const usData = response.data['active-users']["active-user-records"]["active-user-record"]; const allFiltered = _.filter(usData, {'endpoint-security-status': 'Not Compliant\nPassed Policies: \nFailed Policies: Crowdstrike\nEliminated Roles: '}); console.log(allFiltered) console.log(allFiltered.length) })
Related Content
- 7 months ago
- 10 months ago