diff --git a/__tests__/getters/getArpCache.spec.ts b/__tests__/getters/getArpCache.spec.ts index ba5482c..61f0cdb 100644 --- a/__tests__/getters/getArpCache.spec.ts +++ b/__tests__/getters/getArpCache.spec.ts @@ -1,41 +1,41 @@ import { getArpCache } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; // Mock runOsquery function jest.mock('../../src/runOsquery', () => ({ - runOsquery: jest.fn(), - OsType: { - LINUX: 'linux', - DARWIN: 'darwin', - WINDOWS_NT: 'windows_nt', - }, + runOsquery: jest.fn(), + OsType: { + LINUX: 'linux', + DARWIN: 'darwin', + WINDOWS_NT: 'windows_nt', + }, })); describe('getArpCache', () => { - it('resolves with arp_cache table on success', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - const expectedArpCache = [ - { - address: '192.168.1.1', - mac: '00:0a:95:9d:68:16', - interface: 'eth0', - permanent: '0', - }, - ]; - mockRunOsquery.mockResolvedValue(JSON.stringify(expectedArpCache)); + it('resolves with arp_cache table on success', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + const expectedArpCache = [ + { + address: '192.168.1.1', + mac: '00:0a:95:9d:68:16', + interface: 'eth0', + permanent: '0', + }, + ]; + mockRunOsquery.mockResolvedValue(JSON.stringify(expectedArpCache)); - await expect(getArpCache()).resolves.toEqual(expectedArpCache); - expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM arp_cache', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - }); + await expect(getArpCache()).resolves.toEqual(expectedArpCache); + expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM arp_cache', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + }); - it('rejects with error on command failure', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - mockRunOsquery.mockRejectedValue('Command failed'); + it('rejects with error on command failure', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + mockRunOsquery.mockRejectedValue('Command failed'); - await expect(getArpCache()).rejects.toEqual('Command failed'); - }); + await expect(getArpCache()).rejects.toEqual('Command failed'); + }); }); diff --git a/__tests__/getters/getAtomPackages.test.ts b/__tests__/getters/getAtomPackages.test.ts index 627a798..fcc6567 100644 --- a/__tests__/getters/getAtomPackages.test.ts +++ b/__tests__/getters/getAtomPackages.test.ts @@ -1,5 +1,5 @@ import { getAtomPackages } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; jest.mock('../../src/runOSQuery', () => ({ runOsquery: jest.fn(), diff --git a/__tests__/getters/getAzureInstanceMetadata.test.ts b/__tests__/getters/getAzureInstanceMetadata.test.ts index d127af3..626cfde 100644 --- a/__tests__/getters/getAzureInstanceMetadata.test.ts +++ b/__tests__/getters/getAzureInstanceMetadata.test.ts @@ -1,51 +1,51 @@ import { getAzureInstanceMetadata } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; jest.mock('../../src/runOsquery', () => ({ - runOsquery: jest.fn(), - OsType: { - LINUX: 'linux', - DARWIN: 'darwin', - WINDOWS_NT: 'windows_nt', - }, + runOsquery: jest.fn(), + OsType: { + LINUX: 'linux', + DARWIN: 'darwin', + WINDOWS_NT: 'windows_nt', + }, })); describe('getAzureInstanceMetadata', () => { - it('resolves with azure_instance_metadata table on success', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - const expectedMetadata = [ - { - location: 'location', - name: 'name', - offer: 'offer', - publisher: 'publisher', - sku: 'sku', - version: 'version', - os_type: 'os_type', - platform_update_domain: 'platform_update_domain', - platform_fault_domain: 'platform_fault_domain', - vm_id: 'vm_id', - vm_size: 'vm_size', - subscription_id: 'subscription_id', - resource_group_name: 'resource_group_name', - placement_group_id: 'placement_group_id', - vm_scale_set_name: 'vm_scale_set_name', - zone: 'zone', - }, - ]; - mockRunOsquery.mockResolvedValue(JSON.stringify(expectedMetadata)); + it('resolves with azure_instance_metadata table on success', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + const expectedMetadata = [ + { + location: 'location', + name: 'name', + offer: 'offer', + publisher: 'publisher', + sku: 'sku', + version: 'version', + os_type: 'os_type', + platform_update_domain: 'platform_update_domain', + platform_fault_domain: 'platform_fault_domain', + vm_id: 'vm_id', + vm_size: 'vm_size', + subscription_id: 'subscription_id', + resource_group_name: 'resource_group_name', + placement_group_id: 'placement_group_id', + vm_scale_set_name: 'vm_scale_set_name', + zone: 'zone', + }, + ]; + mockRunOsquery.mockResolvedValue(JSON.stringify(expectedMetadata)); - await expect(getAzureInstanceMetadata()).resolves.toEqual(expectedMetadata); - expect(mockRunOsquery).toHaveBeenCalledWith( - 'SELECT * FROM azure_instance_metadata', - [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], - ); - }); + await expect(getAzureInstanceMetadata()).resolves.toEqual(expectedMetadata); + expect(mockRunOsquery).toHaveBeenCalledWith( + 'SELECT * FROM azure_instance_metadata', + [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], + ); + }); - it('rejects with error on command failure', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - mockRunOsquery.mockRejectedValue('Command failed'); + it('rejects with error on command failure', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + mockRunOsquery.mockRejectedValue('Command failed'); - await expect(getAzureInstanceMetadata()).rejects.toEqual('Command failed'); - }); + await expect(getAzureInstanceMetadata()).rejects.toEqual('Command failed'); + }); }); diff --git a/__tests__/getters/getAzureInstanceTags.test.ts b/__tests__/getters/getAzureInstanceTags.test.ts index d39a342..876deab 100644 --- a/__tests__/getters/getAzureInstanceTags.test.ts +++ b/__tests__/getters/getAzureInstanceTags.test.ts @@ -1,38 +1,38 @@ import { getAzureInstanceTags } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; jest.mock('../../src/runOsquery', () => ({ - runOsquery: jest.fn(), - OsType: { - LINUX: 'linux', - DARWIN: 'darwin', - WINDOWS_NT: 'windows_nt', - }, + runOsquery: jest.fn(), + OsType: { + LINUX: 'linux', + DARWIN: 'darwin', + WINDOWS_NT: 'windows_nt', + }, })); describe('getAzureInstanceTags', () => { - it('resolves with azure_instance_tags table on success', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - const expectedTags = [ - { - vm_id: 'vm_id', - key: 'key', - value: 'value', - }, - ]; - mockRunOsquery.mockResolvedValue(JSON.stringify(expectedTags)); + it('resolves with azure_instance_tags table on success', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + const expectedTags = [ + { + vm_id: 'vm_id', + key: 'key', + value: 'value', + }, + ]; + mockRunOsquery.mockResolvedValue(JSON.stringify(expectedTags)); - await expect(getAzureInstanceTags()).resolves.toEqual(expectedTags); - expect(mockRunOsquery).toHaveBeenCalledWith( - 'SELECT * FROM azure_instance_tags', - [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], - ); - }); + await expect(getAzureInstanceTags()).resolves.toEqual(expectedTags); + expect(mockRunOsquery).toHaveBeenCalledWith( + 'SELECT * FROM azure_instance_tags', + [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], + ); + }); - it('rejects with error on command failure', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - mockRunOsquery.mockRejectedValue('Command failed'); + it('rejects with error on command failure', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + mockRunOsquery.mockRejectedValue('Command failed'); - await expect(getAzureInstanceTags()).rejects.toEqual('Command failed'); - }); + await expect(getAzureInstanceTags()).rejects.toEqual('Command failed'); + }); }); diff --git a/__tests__/getters/getCarbonBlackInfo.test.ts b/__tests__/getters/getCarbonBlackInfo.test.ts index 9e5decc..9fe3564 100644 --- a/__tests__/getters/getCarbonBlackInfo.test.ts +++ b/__tests__/getters/getCarbonBlackInfo.test.ts @@ -1,58 +1,58 @@ import { getCarbonBlackInfo } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; jest.mock('../../src/runOsquery', () => ({ - runOsquery: jest.fn(), - OsType: { - LINUX: 'linux', - DARWIN: 'darwin', - WINDOWS_NT: 'windows_nt', - }, + runOsquery: jest.fn(), + OsType: { + LINUX: 'linux', + DARWIN: 'darwin', + WINDOWS_NT: 'windows_nt', + }, })); describe('getCarbonBlackInfo', () => { - it('resolves with carbon_black_info table on success', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - const expectedCarbonBlackInfo = [ - { - sensor_id: 1, - config_name: 'config_name', - collect_store_files: 1, - collect_module_loads: 1, - collect_module_info: 1, - collect_file_mods: 1, - collect_reg_mods: 1, - collect_net_conns: 1, - collect_processes: 1, - collect_cross_processes: 1, - collect_emet_events: 1, - collect_data_file_writes: 1, - collect_process_user_context: 1, - collect_sensor_operations: 1, - log_file_disk_quota_mb: 1, - log_file_disk_quota_percentage: 1, - protection_disabled: 1, - sensor_ip_addr: 'sensor_ip_addr', - sensor_backend_server: 'sensor_backend_server', - event_queue: 1, - binary_queue: 1, - }, - ]; - mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCarbonBlackInfo)); + it('resolves with carbon_black_info table on success', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + const expectedCarbonBlackInfo = [ + { + sensor_id: 1, + config_name: 'config_name', + collect_store_files: 1, + collect_module_loads: 1, + collect_module_info: 1, + collect_file_mods: 1, + collect_reg_mods: 1, + collect_net_conns: 1, + collect_processes: 1, + collect_cross_processes: 1, + collect_emet_events: 1, + collect_data_file_writes: 1, + collect_process_user_context: 1, + collect_sensor_operations: 1, + log_file_disk_quota_mb: 1, + log_file_disk_quota_percentage: 1, + protection_disabled: 1, + sensor_ip_addr: 'sensor_ip_addr', + sensor_backend_server: 'sensor_backend_server', + event_queue: 1, + binary_queue: 1, + }, + ]; + mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCarbonBlackInfo)); - await expect(getCarbonBlackInfo()).resolves.toEqual( - expectedCarbonBlackInfo, - ); - expect(mockRunOsquery).toHaveBeenCalledWith( - 'SELECT * FROM carbon_black_info', - [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], - ); - }); + await expect(getCarbonBlackInfo()).resolves.toEqual( + expectedCarbonBlackInfo, + ); + expect(mockRunOsquery).toHaveBeenCalledWith( + 'SELECT * FROM carbon_black_info', + [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], + ); + }); - it('rejects with error on command failure', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - mockRunOsquery.mockRejectedValue('Command failed'); + it('rejects with error on command failure', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + mockRunOsquery.mockRejectedValue('Command failed'); - await expect(getCarbonBlackInfo()).rejects.toEqual('Command failed'); - }); + await expect(getCarbonBlackInfo()).rejects.toEqual('Command failed'); + }); }); diff --git a/__tests__/getters/getCarves.test.ts b/__tests__/getters/getCarves.test.ts index 088bba3..bff5778 100644 --- a/__tests__/getters/getCarves.test.ts +++ b/__tests__/getters/getCarves.test.ts @@ -1,44 +1,44 @@ import { getCarves } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; jest.mock('../../src/runOsquery', () => ({ - runOsquery: jest.fn(), - OsType: { - LINUX: 'linux', - DARWIN: 'darwin', - WINDOWS_NT: 'windows_nt', - }, + runOsquery: jest.fn(), + OsType: { + LINUX: 'linux', + DARWIN: 'darwin', + WINDOWS_NT: 'windows_nt', + }, })); describe('getCarves', () => { - it('resolves with carves table on success', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - const expectedCarves = [ - { - time: 1234567890, - sha256: 'sha256', - size: 12345, - path: '/path/to/carve', - status: 'status', - carve_guid: 'guid', - request_id: 'request_id', - carve: 1, - }, - ]; - mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCarves)); + it('resolves with carves table on success', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + const expectedCarves = [ + { + time: 1234567890, + sha256: 'sha256', + size: 12345, + path: '/path/to/carve', + status: 'status', + carve_guid: 'guid', + request_id: 'request_id', + carve: 1, + }, + ]; + mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCarves)); - await expect(getCarves()).resolves.toEqual(expectedCarves); - expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM carves', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - }); + await expect(getCarves()).resolves.toEqual(expectedCarves); + expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM carves', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + }); - it('rejects with error on command failure', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - mockRunOsquery.mockRejectedValue('Command failed'); + it('rejects with error on command failure', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + mockRunOsquery.mockRejectedValue('Command failed'); - await expect(getCarves()).rejects.toEqual('Command failed'); - }); + await expect(getCarves()).rejects.toEqual('Command failed'); + }); }); diff --git a/__tests__/getters/getCertificates.test.ts b/__tests__/getters/getCertificates.test.ts index 69557c2..cf18584 100644 --- a/__tests__/getters/getCertificates.test.ts +++ b/__tests__/getters/getCertificates.test.ts @@ -1,59 +1,59 @@ import { getCertificates } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; jest.mock('../../src/runOsquery', () => ({ - runOsquery: jest.fn(), - OsType: { - LINUX: 'linux', - DARWIN: 'darwin', - WINDOWS_NT: 'windows_nt', - }, + runOsquery: jest.fn(), + OsType: { + LINUX: 'linux', + DARWIN: 'darwin', + WINDOWS_NT: 'windows_nt', + }, })); describe('getCertificates', () => { - it('resolves with certificates table on success', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - const expectedCertificates = [ - { - common_name: 'common_name', - subject: 'subject', - issuer: 'issuer', - ca: 1, - self_signed: 0, - not_valid_before: 'not_valid_before', - not_valid_after: 'not_valid_after', - signing_algorithm: 'signing_algorithm', - key_algorithm: 'key_algorithm', - key_strength: 'key_strength', - key_usage: 'key_usage', - subject_key_id: 'subject_key_id', - authority_key_id: 'authority_key_id', - sha1: 'sha1', - path: '/path/to/certificate', - serial: 'serial', - sid: 'sid', - store_location: 'store_location', - store: 'store', - username: 'username', - store_id: 'store_id', - issuer2: 'issuer2', - subject2: 'subject2', - }, - ]; - mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCertificates)); + it('resolves with certificates table on success', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + const expectedCertificates = [ + { + common_name: 'common_name', + subject: 'subject', + issuer: 'issuer', + ca: 1, + self_signed: 0, + not_valid_before: 'not_valid_before', + not_valid_after: 'not_valid_after', + signing_algorithm: 'signing_algorithm', + key_algorithm: 'key_algorithm', + key_strength: 'key_strength', + key_usage: 'key_usage', + subject_key_id: 'subject_key_id', + authority_key_id: 'authority_key_id', + sha1: 'sha1', + path: '/path/to/certificate', + serial: 'serial', + sid: 'sid', + store_location: 'store_location', + store: 'store', + username: 'username', + store_id: 'store_id', + issuer2: 'issuer2', + subject2: 'subject2', + }, + ]; + mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCertificates)); - await expect(getCertificates()).resolves.toEqual(expectedCertificates); - expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM certificates', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - }); + await expect(getCertificates()).resolves.toEqual(expectedCertificates); + expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM certificates', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + }); - it('rejects with error on command failure', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - mockRunOsquery.mockRejectedValue('Command failed'); + it('rejects with error on command failure', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + mockRunOsquery.mockRejectedValue('Command failed'); - await expect(getCertificates()).rejects.toEqual('Command failed'); - }); + await expect(getCertificates()).rejects.toEqual('Command failed'); + }); }); diff --git a/__tests__/getters/getChromeExtensionContentScripts.test.ts b/__tests__/getters/getChromeExtensionContentScripts.test.ts index a1d4c17..81b0e7c 100644 --- a/__tests__/getters/getChromeExtensionContentScripts.test.ts +++ b/__tests__/getters/getChromeExtensionContentScripts.test.ts @@ -1,50 +1,50 @@ import { getChromeExtensionContentScripts } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; jest.mock('../../src/runOsquery', () => ({ - runOsquery: jest.fn(), - OsType: { - LINUX: 'linux', - DARWIN: 'darwin', - WINDOWS_NT: 'windows_nt', - }, + runOsquery: jest.fn(), + OsType: { + LINUX: 'linux', + DARWIN: 'darwin', + WINDOWS_NT: 'windows_nt', + }, })); describe('getChromeExtensionContentScripts', () => { - it('resolves with chrome_extension_content_scripts table on success', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - const expectedChromeExtensionContentScripts = [ - { - browser_type: 'Chrome', - uid: 1000, - identifier: 'identifier', - version: '1.0', - script: '/path/to/script.js', - match: '*.example.com/*', - profile_path: '/path/to/profile', - path: '/path/to/extension', - referenced: 1, - }, - ]; - mockRunOsquery.mockResolvedValue( - JSON.stringify(expectedChromeExtensionContentScripts), - ); + it('resolves with chrome_extension_content_scripts table on success', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + const expectedChromeExtensionContentScripts = [ + { + browser_type: 'Chrome', + uid: 1000, + identifier: 'identifier', + version: '1.0', + script: '/path/to/script.js', + match: '*.example.com/*', + profile_path: '/path/to/profile', + path: '/path/to/extension', + referenced: 1, + }, + ]; + mockRunOsquery.mockResolvedValue( + JSON.stringify(expectedChromeExtensionContentScripts), + ); - await expect(getChromeExtensionContentScripts()).resolves.toEqual( - expectedChromeExtensionContentScripts, - ); - expect(mockRunOsquery).toHaveBeenCalledWith( - 'SELECT * FROM chrome_extension_content_scripts', - [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], - ); - }); + await expect(getChromeExtensionContentScripts()).resolves.toEqual( + expectedChromeExtensionContentScripts, + ); + expect(mockRunOsquery).toHaveBeenCalledWith( + 'SELECT * FROM chrome_extension_content_scripts', + [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], + ); + }); - it('rejects with error on command failure', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - mockRunOsquery.mockRejectedValue('Command failed'); + it('rejects with error on command failure', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + mockRunOsquery.mockRejectedValue('Command failed'); - await expect(getChromeExtensionContentScripts()).rejects.toEqual( - 'Command failed', - ); - }); + await expect(getChromeExtensionContentScripts()).rejects.toEqual( + 'Command failed', + ); + }); }); diff --git a/__tests__/getters/getChromeExtensions.test.ts b/__tests__/getters/getChromeExtensions.test.ts index 64e1d20..c62a679 100644 --- a/__tests__/getters/getChromeExtensions.test.ts +++ b/__tests__/getters/getChromeExtensions.test.ts @@ -1,64 +1,64 @@ import { getChromeExtensions } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; jest.mock('../../src/runOsquery', () => ({ - runOsquery: jest.fn(), - OsType: { - LINUX: 'linux', - DARWIN: 'darwin', - WINDOWS_NT: 'windows_nt', - }, + runOsquery: jest.fn(), + OsType: { + LINUX: 'linux', + DARWIN: 'darwin', + WINDOWS_NT: 'windows_nt', + }, })); describe('getChromeExtensions', () => { - it('resolves with chrome_extensions table on success', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - const expectedChromeExtensions = [ - { - browser_type: 'Chrome', - uid: 1000, - name: 'Extension Name', - profile: 'Profile', - profile_path: '/path/to/profile', - referenced_identifier: 'referenced_identifier', - identifier: 'identifier', - version: '1.0', - description: 'Extension Description', - default_locale: 'en', - current_locale: 'en', - update_url: 'https://update.url', - author: 'Author', - persistent: 1, - path: '/path/to/extension', - permissions: 'permissions', - permissions_json: '{}', - optional_permissions: 'optional_permissions', - optional_permissions_json: '{}', - manifest_hash: 'manifest_hash', - referenced: 1, - from_webstore: 'Yes', - state: 'Enabled', - install_time: 'install_time', - install_timestamp: 1234567890, - manifest_json: '{}', - key: 'key', - }, - ]; - mockRunOsquery.mockResolvedValue(JSON.stringify(expectedChromeExtensions)); + it('resolves with chrome_extensions table on success', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + const expectedChromeExtensions = [ + { + browser_type: 'Chrome', + uid: 1000, + name: 'Extension Name', + profile: 'Profile', + profile_path: '/path/to/profile', + referenced_identifier: 'referenced_identifier', + identifier: 'identifier', + version: '1.0', + description: 'Extension Description', + default_locale: 'en', + current_locale: 'en', + update_url: 'https://update.url', + author: 'Author', + persistent: 1, + path: '/path/to/extension', + permissions: 'permissions', + permissions_json: '{}', + optional_permissions: 'optional_permissions', + optional_permissions_json: '{}', + manifest_hash: 'manifest_hash', + referenced: 1, + from_webstore: 'Yes', + state: 'Enabled', + install_time: 'install_time', + install_timestamp: 1234567890, + manifest_json: '{}', + key: 'key', + }, + ]; + mockRunOsquery.mockResolvedValue(JSON.stringify(expectedChromeExtensions)); - await expect(getChromeExtensions()).resolves.toEqual( - expectedChromeExtensions, - ); - expect(mockRunOsquery).toHaveBeenCalledWith( - 'SELECT * FROM chrome_extensions', - [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], - ); - }); + await expect(getChromeExtensions()).resolves.toEqual( + expectedChromeExtensions, + ); + expect(mockRunOsquery).toHaveBeenCalledWith( + 'SELECT * FROM chrome_extensions', + [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], + ); + }); - it('rejects with error on command failure', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - mockRunOsquery.mockRejectedValue('Command failed'); + it('rejects with error on command failure', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + mockRunOsquery.mockRejectedValue('Command failed'); - await expect(getChromeExtensions()).rejects.toEqual('Command failed'); - }); + await expect(getChromeExtensions()).rejects.toEqual('Command failed'); + }); }); diff --git a/__tests__/getters/getCpuInfo.test.ts b/__tests__/getters/getCpuInfo.test.ts index aa61a69..3ad2968 100644 --- a/__tests__/getters/getCpuInfo.test.ts +++ b/__tests__/getters/getCpuInfo.test.ts @@ -1,50 +1,50 @@ import { getCpuInfo } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; jest.mock('../../src/runOsquery', () => ({ - runOsquery: jest.fn(), - OsType: { - LINUX: 'linux', - DARWIN: 'darwin', - WINDOWS_NT: 'windows_nt', - }, + runOsquery: jest.fn(), + OsType: { + LINUX: 'linux', + DARWIN: 'darwin', + WINDOWS_NT: 'windows_nt', + }, })); describe('getCpuInfo', () => { - it('resolves with cpu_info table on success', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - const expectedCpuInfo = [ - { - device_id: 'device_id', - model: 'model', - manufacturer: 'manufacturer', - processor_type: 'processor_type', - cpu_status: 1, - number_of_cores: '4', - logical_processors: 8, - address_width: '64', - current_clock_speed: 3600, - max_clock_speed: 5000, - socket_designation: 'socket_designation', - availability: 'availability', - number_of_efficiency_cores: 2, - number_of_performance_cores: 2, - }, - ]; - mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCpuInfo)); + it('resolves with cpu_info table on success', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + const expectedCpuInfo = [ + { + device_id: 'device_id', + model: 'model', + manufacturer: 'manufacturer', + processor_type: 'processor_type', + cpu_status: 1, + number_of_cores: '4', + logical_processors: 8, + address_width: '64', + current_clock_speed: 3600, + max_clock_speed: 5000, + socket_designation: 'socket_designation', + availability: 'availability', + number_of_efficiency_cores: 2, + number_of_performance_cores: 2, + }, + ]; + mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCpuInfo)); - await expect(getCpuInfo()).resolves.toEqual(expectedCpuInfo); - expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM cpu_info', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - }); + await expect(getCpuInfo()).resolves.toEqual(expectedCpuInfo); + expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM cpu_info', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + }); - it('rejects with error on command failure', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - mockRunOsquery.mockRejectedValue('Command failed'); + it('rejects with error on command failure', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + mockRunOsquery.mockRejectedValue('Command failed'); - await expect(getCpuInfo()).rejects.toEqual('Command failed'); - }); + await expect(getCpuInfo()).rejects.toEqual('Command failed'); + }); }); diff --git a/__tests__/getters/getCpuid.test.ts b/__tests__/getters/getCpuid.test.ts index 52e2146..f199b24 100644 --- a/__tests__/getters/getCpuid.test.ts +++ b/__tests__/getters/getCpuid.test.ts @@ -1,41 +1,41 @@ import { getCpuid } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; jest.mock('../../src/runOsquery', () => ({ - runOsquery: jest.fn(), - OsType: { - LINUX: 'linux', - DARWIN: 'darwin', - WINDOWS_NT: 'windows_nt', - }, + runOsquery: jest.fn(), + OsType: { + LINUX: 'linux', + DARWIN: 'darwin', + WINDOWS_NT: 'windows_nt', + }, })); describe('getCpuid', () => { - it('resolves with cpuid table on success', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - const expectedCpuid = [ - { - feature: 'feature', - value: 'value', - output_register: 'output_register', - output_bit: 1, - input_eax: 'input_eax', - }, - ]; - mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCpuid)); + it('resolves with cpuid table on success', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + const expectedCpuid = [ + { + feature: 'feature', + value: 'value', + output_register: 'output_register', + output_bit: 1, + input_eax: 'input_eax', + }, + ]; + mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCpuid)); - await expect(getCpuid()).resolves.toEqual(expectedCpuid); - expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM cpuid', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - }); + await expect(getCpuid()).resolves.toEqual(expectedCpuid); + expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM cpuid', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + }); - it('rejects with error on command failure', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - mockRunOsquery.mockRejectedValue('Command failed'); + it('rejects with error on command failure', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + mockRunOsquery.mockRejectedValue('Command failed'); - await expect(getCpuid()).rejects.toEqual('Command failed'); - }); + await expect(getCpuid()).rejects.toEqual('Command failed'); + }); }); diff --git a/__tests__/getters/getCurl.test.ts b/__tests__/getters/getCurl.test.ts index 6291d20..147e29f 100644 --- a/__tests__/getters/getCurl.test.ts +++ b/__tests__/getters/getCurl.test.ts @@ -1,46 +1,46 @@ import { getCurl } from '../../src/getters'; -import { runOsquery, OsType } from '../../src/runOSQuery'; +import { runOsquery, OsType } from '../../src/runOsquery'; const replacer = (key: any, value: { toString: () => any }) => - typeof value === 'bigint' ? value.toString() : value; + typeof value === 'bigint' ? value.toString() : value; jest.mock('../../src/runOsquery', () => ({ - runOsquery: jest.fn(), - OsType: { - LINUX: 'linux', - DARWIN: 'darwin', - WINDOWS_NT: 'windows_nt', - }, + runOsquery: jest.fn(), + OsType: { + LINUX: 'linux', + DARWIN: 'darwin', + WINDOWS_NT: 'windows_nt', + }, })); describe('getCurl', () => { - it('resolves with curl table on success', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - const expectedCurl = [ - { - url: 'url', - method: 'method', - user_agent: 'user_agent', - response_code: 200, - round_trip_time: 1000, - bytes: 5000, - result: 'result', - }, - ]; - mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCurl, replacer)); + it('resolves with curl table on success', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + const expectedCurl = [ + { + url: 'url', + method: 'method', + user_agent: 'user_agent', + response_code: 200, + round_trip_time: 1000, + bytes: 5000, + result: 'result', + }, + ]; + mockRunOsquery.mockResolvedValue(JSON.stringify(expectedCurl, replacer)); - await expect(getCurl()).resolves.toEqual(expectedCurl); - expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM curl', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - }); + await expect(getCurl()).resolves.toEqual(expectedCurl); + expect(mockRunOsquery).toHaveBeenCalledWith('SELECT * FROM curl', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + }); - it('rejects with error on command failure', async () => { - const mockRunOsquery = runOsquery as jest.MockedFunction; - mockRunOsquery.mockRejectedValue('Command failed'); + it('rejects with error on command failure', async () => { + const mockRunOsquery = runOsquery as jest.MockedFunction; + mockRunOsquery.mockRejectedValue('Command failed'); - await expect(getCurl()).rejects.toEqual('Command failed'); - }); + await expect(getCurl()).rejects.toEqual('Command failed'); + }); }); diff --git a/__tests__/runOsQuery.spec.ts b/__tests__/runOsQuery.spec.ts index c4ab17c..11a75e2 100644 --- a/__tests__/runOsQuery.spec.ts +++ b/__tests__/runOsQuery.spec.ts @@ -1,5 +1,5 @@ import * as os from 'os'; -import { runOsquery, OsType } from '../src/runOSQuery'; +import { runOsquery, OsType } from '../src/runOsquery'; import { run } from 'node:test'; // Mock child_process.exec diff --git a/coverage/coverage-summary.json b/coverage/coverage-summary.json index 0bbe94d..43e40a4 100644 --- a/coverage/coverage-summary.json +++ b/coverage/coverage-summary.json @@ -1,4 +1,4 @@ {"total": {"lines":{"total":1119,"covered":325,"skipped":0,"pct":29.04},"statements":{"total":1119,"covered":325,"skipped":0,"pct":29.04},"functions":{"total":279,"covered":15,"skipped":0,"pct":5.37},"branches":{"total":7,"covered":3,"skipped":0,"pct":42.85},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}} ,"/Users/kc/Desktop/Code/node-osquery/src/getters.ts": {"lines":{"total":1101,"covered":312,"skipped":0,"pct":28.33},"functions":{"total":275,"covered":12,"skipped":0,"pct":4.36},"statements":{"total":1101,"covered":312,"skipped":0,"pct":28.33},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}} -,"/Users/kc/Desktop/Code/node-osquery/src/runOSQuery.ts": {"lines":{"total":18,"covered":13,"skipped":0,"pct":72.22},"functions":{"total":4,"covered":3,"skipped":0,"pct":75},"statements":{"total":18,"covered":13,"skipped":0,"pct":72.22},"branches":{"total":7,"covered":3,"skipped":0,"pct":42.85}} +,"/Users/kc/Desktop/Code/node-osquery/src/runOsquery.ts": {"lines":{"total":18,"covered":13,"skipped":0,"pct":72.22},"functions":{"total":4,"covered":3,"skipped":0,"pct":75},"statements":{"total":18,"covered":13,"skipped":0,"pct":72.22},"branches":{"total":7,"covered":3,"skipped":0,"pct":42.85}} } diff --git a/src/getters.ts b/src/getters.ts index b269c61..51252c8 100644 --- a/src/getters.ts +++ b/src/getters.ts @@ -1,279 +1,279 @@ -import { OsType, runOsquery } from './runOSQuery'; +import { OsType, runOsquery } from './runOsquery'; import { - AccountPolicyData, - AcpiTables, - AdConfig, - Alf, - AlfExceptions, - AlfExplicitAuths, - AppCompatShims, - AppSchemes, - ApparmorEvents, - ApparmorProfiles, - Apps, - AptSources, - ArpCache, - Asl, - AtomPackage, - Augeas, - Authenticode, - AuthorizationMechanisms, - Authorizations, - AuthorizedKeys, - Autoexec, - AzureInstanceMetadata, - AzureInstanceTag, - BackgroundActivitiesModerator, - Battery, - BitlockerInfo, - BlockDevices, - BpfProcessEvents, - BpfSocketEvents, - BrowserPlugins, - CPUID, - CPUInfo, - CarbonBlackInfo, - Carve, - Certificate, - ChassisInfo, - ChocolateyPackages, - ChromeExtension, - ChromeExtensionContentScript, - Connectivity, - CpuTime, - Crashes, - Crontab, - CupsDestinations, - CupsJobs, - Curl, - CurlCertificate, - DebPackages, - DefaultEnvironment, - DeviceFile, - DeviceFirmware, - DeviceHash, - DevicePartitions, - DiskEncryption, - DiskEvent, - DiskInfo, - DnsCache, - DnsResolvers, - DockerContainerEnvs, - DockerContainerFsChanges, - DockerContainerLabels, - DockerContainerMounts, - DockerContainerNetworks, - DockerContainerPorts, - DockerContainerProcesses, - DockerContainerStats, - DockerContainers, - DockerImageHistory, - DockerImageLabels, - DockerImageLayers, - DockerImages, - DockerInfo, - DockerNetworkLabels, - DockerNetworks, - DockerVersion, - DockerVolumeLabels, - DockerVolumes, - Drivers, - Ec2InstanceMetadata, - Ec2InstanceTags, - EsProcessEvent, - EsProcessFileEvent, - EtcHosts, - EtcProtocols, - EtcServices, - EventTap, - ExtendedAttributes, - FanSpeedSensor, - FileEvents, - FirefoxAddon, - Gatekeeper, - GatekeeperApprovedApps, - Group, - HardwareEvents, - Hash, - HomebrewPackages, - HvciStatus, - IBridgeInfo, - IOKitDeviceTree, - IOKitRegistry, - IeExtensions, - IntelMeInfo, - InterfaceAddresses, - InterfaceDetails, - InterfaceIpv6, - Iptables, - KernelExtensions, - KernelInfo, - KernelKeys, - KernelModules, - KernelPanics, - KeychainAcls, - KeychainItems, - KnownHosts, - KvaSpeculativeInfo, - Last, - Launchd, - LaunchdOverrides, - ListeningPorts, - LoadAverage, - LocationServices, - LoggedInUsers, - LogicalDrives, - LogonSessions, - LxdCertificates, - LxdCluster, - LxdClusterMembers, - LxdImages, - LxdInstanceConfig, - LxdInstanceDevices, - LxdInstances, - LxdNetworks, - LxdStoragePools, - Magic, - ManagedPolicies, - MdDevices, - MdDrives, - MdPersonalities, - Mdfind, - Mdls, - MemoryArrayMappedAddresses, - MemoryArrays, - MemoryDeviceMappedAddresses, - MemoryDevices, - MemoryErrorInfo, - MemoryInfo, - MemoryMap, - Mounts, - Msr, - NTDomains, - NTFSACLPermissions, - NTFSJournalEvents, - NfsShares, - NpmPackages, - Nvram, - OemStrings, - OfficeMRU, - OsVersion, - OsqueryEvents, - OsqueryExtensions, - OsqueryFlags, - OsqueryInfo, - OsqueryPacks, - OsqueryRegistry, - OsquerySchedule, - PackageBom, - PackageInstallHistory, - PackageReceipt, - PasswordPolicy, - Patches, - PciDevices, - PhysicalDiskPerformance, - Pipes, - PlatformInfo, - PlistEntry, - PortageKeywords, - PortagePackages, - PortageUse, - PowerSensor, - PowershellEvents, - Preferences, - Prefetch, - ProcessEnvs, - ProcessEtwEvents, - ProcessEvents, - ProcessFileEvents, - ProcessMemoryMap, - ProcessNamespaces, - ProcessOpenFiles, - ProcessOpenPipes, - ProcessOpenSockets, - Processes, - Programs, - PrometheusMetrics, - PythonPackages, - QuickLookCache, - Registry, - Routes, - RpmPackageFiles, - RpmPackages, - RunningApps, - SafariExtensions, - Sandboxes, - ScheduledTask, - ScreenLock, - SeccompEvents, - SecureBoot, - SecurityProfileInfo, - SelinuxEvents, - SelinuxSettings, - Services, - Shadow, - SharedFolder, - SharedMemory, - SharedResources, - SharingPreferences, - ShellHistory, - Shellbags, - Shimcache, - Signature, - SipConfig, - SmbiosTables, - SmcKeys, - SocketEvents, - SshConfigs, - StartupItems, - Sudoers, - SuidBin, - SyslogEvent, - SystemControls, - SystemExtensions, - SystemInfo, - SystemdUnit, - TemperatureSensor, - Time, - TimeMachineBackup, - TimeMachineDestinations, - TpmInfo, - UlimitInfo, - UnifiedLog, - Uptime, - UsbDevices, - UserAssist, - UserEvents, - UserGroups, - UserInteractionEvents, - UserSshKeys, - Users, - VideoInfo, - VirtualMemoryInfo, - WifiNetworks, - WifiStatus, - WifiSurvey, - WinBaseObj, - WindowsCrashes, - WindowsEventlog, - WindowsEvents, - WindowsFirewallRules, - WindowsOptionalFeatures, - WindowsSecurityCenter, - WindowsSecurityProducts, - WindowsUpdateHistory, - WmiBiosInfo, - WmiCliEventConsumers, - WmiEventFilters, - WmiFilterConsumerBinding, - WmiScriptEventConsumers, - XProtectEntries, - XProtectMeta, - XProtectReports, - YCloudInstanceMetadata, - Yara, - YaraEvents, - YumSource, + AccountPolicyData, + AcpiTables, + AdConfig, + Alf, + AlfExceptions, + AlfExplicitAuths, + AppCompatShims, + AppSchemes, + ApparmorEvents, + ApparmorProfiles, + Apps, + AptSources, + ArpCache, + Asl, + AtomPackage, + Augeas, + Authenticode, + AuthorizationMechanisms, + Authorizations, + AuthorizedKeys, + Autoexec, + AzureInstanceMetadata, + AzureInstanceTag, + BackgroundActivitiesModerator, + Battery, + BitlockerInfo, + BlockDevices, + BpfProcessEvents, + BpfSocketEvents, + BrowserPlugins, + CPUID, + CPUInfo, + CarbonBlackInfo, + Carve, + Certificate, + ChassisInfo, + ChocolateyPackages, + ChromeExtension, + ChromeExtensionContentScript, + Connectivity, + CpuTime, + Crashes, + Crontab, + CupsDestinations, + CupsJobs, + Curl, + CurlCertificate, + DebPackages, + DefaultEnvironment, + DeviceFile, + DeviceFirmware, + DeviceHash, + DevicePartitions, + DiskEncryption, + DiskEvent, + DiskInfo, + DnsCache, + DnsResolvers, + DockerContainerEnvs, + DockerContainerFsChanges, + DockerContainerLabels, + DockerContainerMounts, + DockerContainerNetworks, + DockerContainerPorts, + DockerContainerProcesses, + DockerContainerStats, + DockerContainers, + DockerImageHistory, + DockerImageLabels, + DockerImageLayers, + DockerImages, + DockerInfo, + DockerNetworkLabels, + DockerNetworks, + DockerVersion, + DockerVolumeLabels, + DockerVolumes, + Drivers, + Ec2InstanceMetadata, + Ec2InstanceTags, + EsProcessEvent, + EsProcessFileEvent, + EtcHosts, + EtcProtocols, + EtcServices, + EventTap, + ExtendedAttributes, + FanSpeedSensor, + FileEvents, + FirefoxAddon, + Gatekeeper, + GatekeeperApprovedApps, + Group, + HardwareEvents, + Hash, + HomebrewPackages, + HvciStatus, + IBridgeInfo, + IOKitDeviceTree, + IOKitRegistry, + IeExtensions, + IntelMeInfo, + InterfaceAddresses, + InterfaceDetails, + InterfaceIpv6, + Iptables, + KernelExtensions, + KernelInfo, + KernelKeys, + KernelModules, + KernelPanics, + KeychainAcls, + KeychainItems, + KnownHosts, + KvaSpeculativeInfo, + Last, + Launchd, + LaunchdOverrides, + ListeningPorts, + LoadAverage, + LocationServices, + LoggedInUsers, + LogicalDrives, + LogonSessions, + LxdCertificates, + LxdCluster, + LxdClusterMembers, + LxdImages, + LxdInstanceConfig, + LxdInstanceDevices, + LxdInstances, + LxdNetworks, + LxdStoragePools, + Magic, + ManagedPolicies, + MdDevices, + MdDrives, + MdPersonalities, + Mdfind, + Mdls, + MemoryArrayMappedAddresses, + MemoryArrays, + MemoryDeviceMappedAddresses, + MemoryDevices, + MemoryErrorInfo, + MemoryInfo, + MemoryMap, + Mounts, + Msr, + NTDomains, + NTFSACLPermissions, + NTFSJournalEvents, + NfsShares, + NpmPackages, + Nvram, + OemStrings, + OfficeMRU, + OsVersion, + OsqueryEvents, + OsqueryExtensions, + OsqueryFlags, + OsqueryInfo, + OsqueryPacks, + OsqueryRegistry, + OsquerySchedule, + PackageBom, + PackageInstallHistory, + PackageReceipt, + PasswordPolicy, + Patches, + PciDevices, + PhysicalDiskPerformance, + Pipes, + PlatformInfo, + PlistEntry, + PortageKeywords, + PortagePackages, + PortageUse, + PowerSensor, + PowershellEvents, + Preferences, + Prefetch, + ProcessEnvs, + ProcessEtwEvents, + ProcessEvents, + ProcessFileEvents, + ProcessMemoryMap, + ProcessNamespaces, + ProcessOpenFiles, + ProcessOpenPipes, + ProcessOpenSockets, + Processes, + Programs, + PrometheusMetrics, + PythonPackages, + QuickLookCache, + Registry, + Routes, + RpmPackageFiles, + RpmPackages, + RunningApps, + SafariExtensions, + Sandboxes, + ScheduledTask, + ScreenLock, + SeccompEvents, + SecureBoot, + SecurityProfileInfo, + SelinuxEvents, + SelinuxSettings, + Services, + Shadow, + SharedFolder, + SharedMemory, + SharedResources, + SharingPreferences, + ShellHistory, + Shellbags, + Shimcache, + Signature, + SipConfig, + SmbiosTables, + SmcKeys, + SocketEvents, + SshConfigs, + StartupItems, + Sudoers, + SuidBin, + SyslogEvent, + SystemControls, + SystemExtensions, + SystemInfo, + SystemdUnit, + TemperatureSensor, + Time, + TimeMachineBackup, + TimeMachineDestinations, + TpmInfo, + UlimitInfo, + UnifiedLog, + Uptime, + UsbDevices, + UserAssist, + UserEvents, + UserGroups, + UserInteractionEvents, + UserSshKeys, + Users, + VideoInfo, + VirtualMemoryInfo, + WifiNetworks, + WifiStatus, + WifiSurvey, + WinBaseObj, + WindowsCrashes, + WindowsEventlog, + WindowsEvents, + WindowsFirewallRules, + WindowsOptionalFeatures, + WindowsSecurityCenter, + WindowsSecurityProducts, + WindowsUpdateHistory, + WmiBiosInfo, + WmiCliEventConsumers, + WmiEventFilters, + WmiFilterConsumerBinding, + WmiScriptEventConsumers, + XProtectEntries, + XProtectMeta, + XProtectReports, + YCloudInstanceMetadata, + Yara, + YaraEvents, + YumSource, } from './types/table_interfaces'; // 🍎🐧🪟 @@ -284,13 +284,13 @@ import { * @return A Promise that resolves with the arp_cache table, or rejects with an error message. */ export async function getArpCache(): Promise { - const output = await runOsquery('SELECT * FROM arp_cache', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const arpCache: ArpCache[] = JSON.parse(output); - return arpCache; + const output = await runOsquery('SELECT * FROM arp_cache', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const arpCache: ArpCache[] = JSON.parse(output); + return arpCache; } /** @@ -299,13 +299,13 @@ export async function getArpCache(): Promise { * @return A Promise that resolves with the atom_packages table, or rejects with an error message. */ export async function getAtomPackages(): Promise { - const output = await runOsquery('SELECT * FROM atom_packages', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const atomPackages: AtomPackage[] = JSON.parse(output); - return atomPackages; + const output = await runOsquery('SELECT * FROM atom_packages', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const atomPackages: AtomPackage[] = JSON.parse(output); + return atomPackages; } /** @@ -314,15 +314,15 @@ export async function getAtomPackages(): Promise { * @return A Promise that resolves with the azure_instance_metadata table, or rejects with an error message. */ export async function getAzureInstanceMetadata(): Promise< - AzureInstanceMetadata[] + AzureInstanceMetadata[] > { - const output = await runOsquery('SELECT * FROM azure_instance_metadata', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const azureInstanceMetadata: AzureInstanceMetadata[] = JSON.parse(output); - return azureInstanceMetadata; + const output = await runOsquery('SELECT * FROM azure_instance_metadata', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const azureInstanceMetadata: AzureInstanceMetadata[] = JSON.parse(output); + return azureInstanceMetadata; } /** @@ -331,13 +331,13 @@ export async function getAzureInstanceMetadata(): Promise< * @return A Promise that resolves with the azure_instance_tags table, or rejects with an error message. */ export async function getAzureInstanceTags(): Promise { - const output = await runOsquery('SELECT * FROM azure_instance_tags', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const azureInstanceTags: AzureInstanceTag[] = JSON.parse(output); - return azureInstanceTags; + const output = await runOsquery('SELECT * FROM azure_instance_tags', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const azureInstanceTags: AzureInstanceTag[] = JSON.parse(output); + return azureInstanceTags; } /** @@ -346,13 +346,13 @@ export async function getAzureInstanceTags(): Promise { * @return A Promise that resolves with the carbon_black_info table, or rejects with an error message. */ export async function getCarbonBlackInfo(): Promise { - const output = await runOsquery('SELECT * FROM carbon_black_info', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const carbonBlackInfo: CarbonBlackInfo[] = JSON.parse(output); - return carbonBlackInfo; + const output = await runOsquery('SELECT * FROM carbon_black_info', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const carbonBlackInfo: CarbonBlackInfo[] = JSON.parse(output); + return carbonBlackInfo; } /** @@ -361,13 +361,13 @@ export async function getCarbonBlackInfo(): Promise { * @return A Promise that resolves with the carves table, or rejects with an error message. */ export async function getCarves(): Promise { - const output = await runOsquery('SELECT * FROM carves', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const carves: Carve[] = JSON.parse(output); - return carves; + const output = await runOsquery('SELECT * FROM carves', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const carves: Carve[] = JSON.parse(output); + return carves; } /** @@ -376,13 +376,13 @@ export async function getCarves(): Promise { * @return A Promise that resolves with the certificates table, or rejects with an error message. */ export async function getCertificates(): Promise { - const output = await runOsquery('SELECT * FROM certificates', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const certificates: Certificate[] = JSON.parse(output); - return certificates; + const output = await runOsquery('SELECT * FROM certificates', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const certificates: Certificate[] = JSON.parse(output); + return certificates; } /** @@ -391,15 +391,15 @@ export async function getCertificates(): Promise { * @return A Promise that resolves with the chrome_extension_content_scripts table, or rejects with an error message. */ export async function getChromeExtensionContentScripts(): Promise< - ChromeExtensionContentScript[] + ChromeExtensionContentScript[] > { - const output = await runOsquery( - 'SELECT * FROM chrome_extension_content_scripts', - [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], - ); - const chromeExtensionContentScripts: ChromeExtensionContentScript[] = - JSON.parse(output); - return chromeExtensionContentScripts; + const output = await runOsquery( + 'SELECT * FROM chrome_extension_content_scripts', + [OsType.LINUX, OsType.DARWIN, OsType.WINDOWS_NT], + ); + const chromeExtensionContentScripts: ChromeExtensionContentScript[] = + JSON.parse(output); + return chromeExtensionContentScripts; } /** @@ -408,13 +408,13 @@ export async function getChromeExtensionContentScripts(): Promise< * @return A Promise that resolves with the chrome_extensions table, or rejects with an error message. */ export async function getChromeExtensions(): Promise { - const output = await runOsquery('SELECT * FROM chrome_extensions', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const chromeExtensions: ChromeExtension[] = JSON.parse(output); - return chromeExtensions; + const output = await runOsquery('SELECT * FROM chrome_extensions', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const chromeExtensions: ChromeExtension[] = JSON.parse(output); + return chromeExtensions; } /** @@ -423,13 +423,13 @@ export async function getChromeExtensions(): Promise { * @return A Promise that resolves with the cpu_info table, or rejects with an error message. */ export async function getCpuInfo(): Promise { - const output = await runOsquery('SELECT * FROM cpu_info', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const cpuInfo: CPUInfo[] = JSON.parse(output); - return cpuInfo; + const output = await runOsquery('SELECT * FROM cpu_info', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const cpuInfo: CPUInfo[] = JSON.parse(output); + return cpuInfo; } /** @@ -438,13 +438,13 @@ export async function getCpuInfo(): Promise { * @return A Promise that resolves with the cpuid table, or rejects with an error message. */ export async function getCpuid(): Promise { - const output = await runOsquery('SELECT * FROM cpuid', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const cpuid: CPUID[] = JSON.parse(output); - return cpuid; + const output = await runOsquery('SELECT * FROM cpuid', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const cpuid: CPUID[] = JSON.parse(output); + return cpuid; } /** @@ -453,13 +453,13 @@ export async function getCpuid(): Promise { * @return A Promise that resolves with the curl table, or rejects with an error message. */ export async function getCurl(): Promise { - const output = await runOsquery('SELECT * FROM curl', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const curl: Curl[] = JSON.parse(output); - return curl; + const output = await runOsquery('SELECT * FROM curl', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const curl: Curl[] = JSON.parse(output); + return curl; } /** @@ -468,13 +468,13 @@ export async function getCurl(): Promise { * @return A Promise that resolves with the curl_certificate table, or rejects with an error message. */ export async function getCurlCertificate(): Promise { - const output = await runOsquery('SELECT * FROM curl_certificate', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const curlCertificate: CurlCertificate[] = JSON.parse(output); - return curlCertificate; + const output = await runOsquery('SELECT * FROM curl_certificate', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const curlCertificate: CurlCertificate[] = JSON.parse(output); + return curlCertificate; } /** @@ -483,13 +483,13 @@ export async function getCurlCertificate(): Promise { * @return A Promise that resolves with the ec2_instance_metadata table, or rejects with an error message. */ export async function getEc2InstanceMetadata(): Promise { - const output = await runOsquery('SELECT * FROM ec2_instance_metadata', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const ec2InstanceMetadata: Ec2InstanceMetadata[] = JSON.parse(output); - return ec2InstanceMetadata; + const output = await runOsquery('SELECT * FROM ec2_instance_metadata', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const ec2InstanceMetadata: Ec2InstanceMetadata[] = JSON.parse(output); + return ec2InstanceMetadata; } /** @@ -498,13 +498,13 @@ export async function getEc2InstanceMetadata(): Promise { * @return A Promise that resolves with the ec2_instance_tags table, or rejects with an error message. */ export async function getEc2InstanceTags(): Promise { - const output = await runOsquery('SELECT * FROM ec2_instance_tags', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const ec2InstanceTags: Ec2InstanceTags[] = JSON.parse(output); - return ec2InstanceTags; + const output = await runOsquery('SELECT * FROM ec2_instance_tags', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const ec2InstanceTags: Ec2InstanceTags[] = JSON.parse(output); + return ec2InstanceTags; } /** @@ -513,13 +513,13 @@ export async function getEc2InstanceTags(): Promise { * @return A Promise that resolves with the etc_hosts table, or rejects with an error message. */ export async function getEtcHosts(): Promise { - const output = await runOsquery('SELECT * FROM etc_hosts', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const etcHosts: EtcHosts[] = JSON.parse(output); - return etcHosts; + const output = await runOsquery('SELECT * FROM etc_hosts', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const etcHosts: EtcHosts[] = JSON.parse(output); + return etcHosts; } /** @@ -528,13 +528,13 @@ export async function getEtcHosts(): Promise { * @return A Promise that resolves with the etc_protocols table, or rejects with an error message. */ export async function getEtcProtocols(): Promise { - const output = await runOsquery('SELECT * FROM etc_protocols', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const etcProtocols: EtcProtocols[] = JSON.parse(output); - return etcProtocols; + const output = await runOsquery('SELECT * FROM etc_protocols', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const etcProtocols: EtcProtocols[] = JSON.parse(output); + return etcProtocols; } /** @@ -543,13 +543,13 @@ export async function getEtcProtocols(): Promise { * @return A Promise that resolves with the etc_services table, or rejects with an error message. */ export async function getEtcServices(): Promise { - const output = await runOsquery('SELECT * FROM etc_services', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const etcServices: EtcServices[] = JSON.parse(output); - return etcServices; + const output = await runOsquery('SELECT * FROM etc_services', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const etcServices: EtcServices[] = JSON.parse(output); + return etcServices; } /** @@ -558,13 +558,13 @@ export async function getEtcServices(): Promise { * @return A Promise that resolves with the file table, or rejects with an error message. */ export async function getFile(): Promise { - const output = await runOsquery('SELECT * FROM file', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const file: File[] = JSON.parse(output); - return file; + const output = await runOsquery('SELECT * FROM file', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const file: File[] = JSON.parse(output); + return file; } /** @@ -573,13 +573,13 @@ export async function getFile(): Promise { * @return A Promise that resolves with the Firefox addons table, or rejects with an error message. */ export async function getFirefoxAddons(): Promise { - const output = await runOsquery('SELECT * FROM firefox_addons', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const firefoxAddons: FirefoxAddon[] = JSON.parse(output); - return firefoxAddons; + const output = await runOsquery('SELECT * FROM firefox_addons', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const firefoxAddons: FirefoxAddon[] = JSON.parse(output); + return firefoxAddons; } /** @@ -588,13 +588,13 @@ export async function getFirefoxAddons(): Promise { * @return A Promise that resolves with the groups table, or rejects with an error message. */ export async function getGroups(): Promise { - const output = await runOsquery('SELECT * FROM groups', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const groups: Group[] = JSON.parse(output); - return groups; + const output = await runOsquery('SELECT * FROM groups', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const groups: Group[] = JSON.parse(output); + return groups; } /** @@ -603,13 +603,13 @@ export async function getGroups(): Promise { * @return A Promise that resolves with the hash data, or rejects with an error message. */ export async function getHash(): Promise { - const output = await runOsquery('SELECT * FROM hash', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const hashes: Hash[] = JSON.parse(output); - return hashes; + const output = await runOsquery('SELECT * FROM hash', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const hashes: Hash[] = JSON.parse(output); + return hashes; } /** @@ -618,13 +618,13 @@ export async function getHash(): Promise { * @return A Promise that resolves with the network interface data, or rejects with an error message. */ export async function getInterfaceAddresses(): Promise { - const output = await runOsquery('SELECT * FROM interface_addresses', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const interfaceAddresses: InterfaceAddresses[] = JSON.parse(output); - return interfaceAddresses; + const output = await runOsquery('SELECT * FROM interface_addresses', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const interfaceAddresses: InterfaceAddresses[] = JSON.parse(output); + return interfaceAddresses; } /** @@ -633,13 +633,13 @@ export async function getInterfaceAddresses(): Promise { * @return A Promise that resolves with the network interface details, or rejects with an error message. */ export async function getInterfaceDetails(): Promise { - const output = await runOsquery('SELECT * FROM interface_details', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const interfaceDetails: InterfaceDetails[] = JSON.parse(output); - return interfaceDetails; + const output = await runOsquery('SELECT * FROM interface_details', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const interfaceDetails: InterfaceDetails[] = JSON.parse(output); + return interfaceDetails; } /** @@ -648,13 +648,13 @@ export async function getInterfaceDetails(): Promise { * @return A Promise that resolves with the kernel information, or rejects with an error message. */ export async function getKernelInfo(): Promise { - const output = await runOsquery('SELECT * FROM kernel_info', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const kernelInfo: KernelInfo = JSON.parse(output); - return kernelInfo; + const output = await runOsquery('SELECT * FROM kernel_info', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const kernelInfo: KernelInfo = JSON.parse(output); + return kernelInfo; } /** @@ -663,13 +663,13 @@ export async function getKernelInfo(): Promise { * @return A Promise that resolves with the listening ports data, or rejects with an error message. */ export async function getListeningPorts(): Promise { - const output = await runOsquery('SELECT * FROM listening_ports', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const listeningPorts: ListeningPorts[] = JSON.parse(output); - return listeningPorts; + const output = await runOsquery('SELECT * FROM listening_ports', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const listeningPorts: ListeningPorts[] = JSON.parse(output); + return listeningPorts; } /** @@ -678,13 +678,13 @@ export async function getListeningPorts(): Promise { * @return A Promise that resolves with the logged in users data, or rejects with an error message. */ export async function getLoggedInUsers(): Promise { - const output = await runOsquery('SELECT * FROM logged_in_users', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const loggedInUsers: LoggedInUsers[] = JSON.parse(output); - return loggedInUsers; + const output = await runOsquery('SELECT * FROM logged_in_users', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const loggedInUsers: LoggedInUsers[] = JSON.parse(output); + return loggedInUsers; } /** @@ -693,13 +693,13 @@ export async function getLoggedInUsers(): Promise { * @return A Promise that resolves with the memory devices data, or rejects with an error message. */ export async function getMemoryDevices(): Promise { - const output = await runOsquery('SELECT * FROM memory_devices', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const memoryDevices: MemoryDevices[] = JSON.parse(output); - return memoryDevices; + const output = await runOsquery('SELECT * FROM memory_devices', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const memoryDevices: MemoryDevices[] = JSON.parse(output); + return memoryDevices; } /** @@ -708,13 +708,13 @@ export async function getMemoryDevices(): Promise { * @return A Promise that resolves with the Npm packages data, or rejects with an error message. */ export async function getNpmPackages(): Promise { - const output = await runOsquery('SELECT * FROM npm_packages', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const npmPackages: NpmPackages[] = JSON.parse(output); - return npmPackages; + const output = await runOsquery('SELECT * FROM npm_packages', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const npmPackages: NpmPackages[] = JSON.parse(output); + return npmPackages; } /** @@ -723,13 +723,13 @@ export async function getNpmPackages(): Promise { * @return A Promise that resolves with the OS version data, or rejects with an error message. */ export async function getOsVersion(): Promise { - const output = await runOsquery('SELECT * FROM os_version', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const osVersion: OsVersion = JSON.parse(output)[0]; // Should only be one row - return osVersion; + const output = await runOsquery('SELECT * FROM os_version', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const osVersion: OsVersion = JSON.parse(output)[0]; // Should only be one row + return osVersion; } /** @@ -738,13 +738,13 @@ export async function getOsVersion(): Promise { * @return A Promise that resolves with the OS query events data, or rejects with an error message. */ export async function getOsqueryEvents(): Promise { - const output = await runOsquery('SELECT * FROM osquery_events', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const osqueryEvents: OsqueryEvents[] = JSON.parse(output); - return osqueryEvents; + const output = await runOsquery('SELECT * FROM osquery_events', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const osqueryEvents: OsqueryEvents[] = JSON.parse(output); + return osqueryEvents; } /** @@ -753,13 +753,13 @@ export async function getOsqueryEvents(): Promise { * @return A Promise that resolves with the OS query extensions data, or rejects with an error message. */ export async function getOsqueryExtensions(): Promise { - const output = await runOsquery('SELECT * FROM osquery_extensions', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const osqueryExtensions: OsqueryExtensions[] = JSON.parse(output); - return osqueryExtensions; + const output = await runOsquery('SELECT * FROM osquery_extensions', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const osqueryExtensions: OsqueryExtensions[] = JSON.parse(output); + return osqueryExtensions; } /** @@ -768,13 +768,13 @@ export async function getOsqueryExtensions(): Promise { * @return A Promise that resolves with the OS query flags data, or rejects with an error message. */ export async function getOsqueryFlags(): Promise { - const output = await runOsquery('SELECT * FROM osquery_flags', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const osqueryFlags: OsqueryFlags[] = JSON.parse(output); - return osqueryFlags; + const output = await runOsquery('SELECT * FROM osquery_flags', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const osqueryFlags: OsqueryFlags[] = JSON.parse(output); + return osqueryFlags; } /** @@ -783,13 +783,13 @@ export async function getOsqueryFlags(): Promise { * @return A Promise that resolves with the OS query info data, or rejects with an error message. */ export async function getOsqueryInfo(): Promise { - const output = await runOsquery('SELECT * FROM osquery_info', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const osqueryInfo: OsqueryInfo = JSON.parse(output); - return osqueryInfo; + const output = await runOsquery('SELECT * FROM osquery_info', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const osqueryInfo: OsqueryInfo = JSON.parse(output); + return osqueryInfo; } /** @@ -798,13 +798,13 @@ export async function getOsqueryInfo(): Promise { * @return A Promise that resolves with the osquery packs data, or rejects with an error message. */ export async function getOsqueryPacks(): Promise { - const output = await runOsquery('SELECT * FROM osquery_packs', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const osqueryPacks: OsqueryPacks[] = JSON.parse(output); - return osqueryPacks; + const output = await runOsquery('SELECT * FROM osquery_packs', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const osqueryPacks: OsqueryPacks[] = JSON.parse(output); + return osqueryPacks; } /** @@ -813,13 +813,13 @@ export async function getOsqueryPacks(): Promise { * @return A Promise that resolves with the osquery registry data, or rejects with an error message. */ export async function getOsqueryRegistry(): Promise { - const output = await runOsquery('SELECT * FROM osquery_registry', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const osqueryRegistry: OsqueryRegistry[] = JSON.parse(output); - return osqueryRegistry; + const output = await runOsquery('SELECT * FROM osquery_registry', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const osqueryRegistry: OsqueryRegistry[] = JSON.parse(output); + return osqueryRegistry; } /** @@ -828,13 +828,13 @@ export async function getOsqueryRegistry(): Promise { * @return A Promise that resolves with the osquery schedule data, or rejects with an error message. */ export async function getOsquerySchedule(): Promise { - const output = await runOsquery('SELECT * FROM osquery_schedule', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const osquerySchedule: OsquerySchedule[] = JSON.parse(output); - return osquerySchedule; + const output = await runOsquery('SELECT * FROM osquery_schedule', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const osquerySchedule: OsquerySchedule[] = JSON.parse(output); + return osquerySchedule; } /** @@ -843,13 +843,13 @@ export async function getOsquerySchedule(): Promise { * @return A Promise that resolves with the platform info data, or rejects with an error message. */ export async function getPlatformInfo(): Promise { - const output = await runOsquery('SELECT * FROM platform_info', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const platformInfo: PlatformInfo[] = JSON.parse(output); - return platformInfo; + const output = await runOsquery('SELECT * FROM platform_info', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const platformInfo: PlatformInfo[] = JSON.parse(output); + return platformInfo; } /** @@ -858,13 +858,13 @@ export async function getPlatformInfo(): Promise { * @return A Promise that resolves with the process memory map data, or rejects with an error message. */ export async function getProcessMemoryMap(): Promise { - const output = await runOsquery('SELECT * FROM process_memory_map', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const processMemoryMap: ProcessMemoryMap[] = JSON.parse(output); - return processMemoryMap; + const output = await runOsquery('SELECT * FROM process_memory_map', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const processMemoryMap: ProcessMemoryMap[] = JSON.parse(output); + return processMemoryMap; } /** @@ -873,13 +873,13 @@ export async function getProcessMemoryMap(): Promise { * @return A Promise that resolves with the process open sockets data, or rejects with an error message. */ export async function getProcessOpenSockets(): Promise { - const output = await runOsquery('SELECT * FROM process_open_sockets', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const processOpenSockets: ProcessOpenSockets[] = JSON.parse(output); - return processOpenSockets; + const output = await runOsquery('SELECT * FROM process_open_sockets', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const processOpenSockets: ProcessOpenSockets[] = JSON.parse(output); + return processOpenSockets; } /** @@ -888,13 +888,13 @@ export async function getProcessOpenSockets(): Promise { * @return A Promise that resolves with the processes data, or rejects with an error message. */ export async function getProcesses(): Promise { - const output = await runOsquery('SELECT * FROM processes', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const processes: Processes[] = JSON.parse(output); - return processes; + const output = await runOsquery('SELECT * FROM processes', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const processes: Processes[] = JSON.parse(output); + return processes; } /** @@ -903,13 +903,13 @@ export async function getProcesses(): Promise { * @return A Promise that resolves with the Python packages data, or rejects with an error message. */ export async function getPythonPackages(): Promise { - const output = await runOsquery('SELECT * FROM python_packages', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const pythonPackages: PythonPackages[] = JSON.parse(output); - return pythonPackages; + const output = await runOsquery('SELECT * FROM python_packages', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const pythonPackages: PythonPackages[] = JSON.parse(output); + return pythonPackages; } /** @@ -918,13 +918,13 @@ export async function getPythonPackages(): Promise { * @return A Promise that resolves with the route table data, or rejects with an error message. */ export async function getRoutes(): Promise { - const output = await runOsquery('SELECT * FROM routes', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const routes: Routes[] = JSON.parse(output); - return routes; + const output = await runOsquery('SELECT * FROM routes', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const routes: Routes[] = JSON.parse(output); + return routes; } /** @@ -933,13 +933,13 @@ export async function getRoutes(): Promise { * @return A Promise that resolves with the Secure Boot data, or rejects with an error message. */ export async function getSecureBoot(): Promise { - const output = await runOsquery('SELECT * FROM secureboot', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const secureBoot: SecureBoot[] = JSON.parse(output); - return secureBoot; + const output = await runOsquery('SELECT * FROM secureboot', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const secureBoot: SecureBoot[] = JSON.parse(output); + return secureBoot; } /** @@ -948,13 +948,13 @@ export async function getSecureBoot(): Promise { * @return A Promise that resolves with the SSH configurations data, or rejects with an error message. */ export async function getSshConfigs(): Promise { - const output = await runOsquery('SELECT * FROM ssh_configs', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const sshConfigs: SshConfigs[] = JSON.parse(output); - return sshConfigs; + const output = await runOsquery('SELECT * FROM ssh_configs', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const sshConfigs: SshConfigs[] = JSON.parse(output); + return sshConfigs; } /** @@ -963,13 +963,13 @@ export async function getSshConfigs(): Promise { * @return A Promise that resolves with the startup items data, or rejects with an error message. */ export async function getStartupItems(): Promise { - const output = await runOsquery('SELECT * FROM startup_items', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const startupItems: StartupItems[] = JSON.parse(output); - return startupItems; + const output = await runOsquery('SELECT * FROM startup_items', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const startupItems: StartupItems[] = JSON.parse(output); + return startupItems; } /** @@ -978,13 +978,13 @@ export async function getStartupItems(): Promise { * @return A Promise that resolves with the system info data, or rejects with an error message. */ export async function getSystemInfo(): Promise { - const output = await runOsquery('SELECT * FROM system_info', [ - OsType.LINUX, - OsType.DARWIN, - OsType.WINDOWS_NT, - ]); - const systemInfo: SystemInfo = JSON.parse(output); - return systemInfo; + const output = await runOsquery('SELECT * FROM system_info', [ + OsType.LINUX, + OsType.DARWIN, + OsType.WINDOWS_NT, + ]); + const systemInfo: SystemInfo = JSON.parse(output); + return systemInfo; } /** @@ -993,13 +993,13 @@ export async function getSystemInfo(): Promise { * @return A Promise that resolves with the time data, or rejects with an error message. */ export async function getTime(): Promise