Skip to content

Commit

Permalink
Merge pull request #29 from JupiterOne/DEVICE-23-lastSeenOn
Browse files Browse the repository at this point in the history
DEVICE-23 - Add new properties to `addigy_hostagent`
  • Loading branch information
austinkelleher authored May 12, 2023
2 parents 29a615d + 51fa761 commit 6617504
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 6 deletions.
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ and this project adheres to

## [Unreleased]

1.1.0 - 2023-05-12

### Added

- New properties added to entities:

| Entity | Properties |
| ------------------ | -------------------------------------------------------------------- |
| `addigy_hostagent` | `serialNumber`, `macAddress`, `wifiMacAddress`, `ethernetMacAddress` |
| `user_endpoint` | `macAddress`, `wifiMacAddress`, `ethernetMacAddress` |

[1.0.3] - 2023-01-27

### Fixed
Expand All @@ -20,9 +31,9 @@ and this project adheres to

- New properties added to entities:

| Entity | Properties |
| --------------- | --------------------------------------------- |
| `addigy_device` | `totalMemory`, `totalDiskSpace`, `lastOnline` |
| Entity | Properties |
| ------------------ | --------------------------------------------- |
| `addigy_hostagent` | `totalMemory`, `totalDiskSpace`, `lastOnline` |

[1.0.1] - 2022-01-06

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jupiterone/graph-addigy",
"version": "1.0.3",
"version": "1.1.0",
"description": "A JupiterOne Integration for ingesting data from Addigy",
"license": "MPL-2.0",
"main": "src/index.js",
Expand Down
8 changes: 8 additions & 0 deletions src/steps/devices/converter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ describe('#createHostAgentEntity', () => {
'Total Memory (GB)': '23',
'Total Disk Space (GB)': '150',
'Last Online': '2021-12-03T19:40:20.551Z',
'Wifi MAC Address': '00:1B:44:11:3A:B7',
'Ethernet MAC Address': '00:1C:44:11:3A:B7',
} as any;

const entity = createHostAgentEntity(device as Device);
Expand All @@ -26,10 +28,16 @@ describe('#createHostAgentEntity', () => {
id: 'agent-id',
name: 'name',
displayName: 'name',
serial: 'SerialNumber',
serialNumber: 'SerialNumber',
wifiMacAddress: '00:1B:44:11:3A:B7',
ethernetMacAddress: '00:1C:44:11:3A:B7',
macAddress: ['00:1C:44:11:3A:B7', '00:1B:44:11:3A:B7'],
policyId: '12334',
totalMemory: '23',
totalDiskSpace: '150',
lastOnline: 1638560420551,
lastSeenOn: 1638560420551,
_rawData: [
{
name: 'default',
Expand Down
32 changes: 30 additions & 2 deletions src/steps/devices/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export function createHostAgentEntityIdentifier(id: string): string {
}

export function createHostAgentEntity(device: Device): Entity {
const serialNumber = device['Serial Number'];
const wifiMacAddress = device['Wifi MAC Address'];
const ethernetMacAddress = device['Ethernet MAC Address'];
const lastSeenOn = parseTimePropertyValue(device['Last Online']);

return createIntegrationEntity({
entityData: {
source: device,
Expand All @@ -26,7 +31,14 @@ export function createHostAgentEntity(device: Device): Entity {
category: device['Device Model Name'],
make: 'Apple',
model: device['Hardware Model'],
serial: device['Serial Number'],
serial: serialNumber,
serialNumber,
ethernetMacAddress,
wifiMacAddress,
macAddress: getEntityMacAddressValue({
ethernetMacAddress,
wifiMacAddress,
}),
policyId: device['policy_id'],
function: ['endpoint-protection'],
appleSilicon: device['Is Apple Silicon'],
Expand All @@ -36,8 +48,24 @@ export function createHostAgentEntity(device: Device): Entity {
platform: device['OS Platform'] || undefined,
totalMemory: device['Total Memory (GB)'] || undefined,
totalDiskSpace: device['Total Disk Space (GB)'] || undefined,
lastOnline: parseTimePropertyValue(device['Last Online']),
lastOnline: lastSeenOn,
lastSeenOn,
},
},
});
}

function getEntityMacAddressValue({
wifiMacAddress,
ethernetMacAddress,
}: {
ethernetMacAddress: string | undefined;
wifiMacAddress: string | undefined;
}) {
const macAddress: string[] = [];

if (ethernetMacAddress) macAddress.push(ethernetMacAddress);
if (wifiMacAddress) macAddress.push(wifiMacAddress);

return macAddress.length > 0 ? macAddress : undefined;
}
6 changes: 6 additions & 0 deletions src/steps/devices/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export function createHostAgentProtectsHostRelationship(
model: device['Hardware Model'],
serial: device['Serial Number'], // This is needed by Device Schema
serialNumber: device['Serial Number'],

ethernetMacAddress: agentEntity.ethernetMacAddress as
| string
| undefined,
wifiMacAddress: agentEntity.ethernetMacAddress as string | undefined,
macAddress: agentEntity.macAddress as string[] | undefined,
},
},
});
Expand Down

0 comments on commit 6617504

Please sign in to comment.