Add disk_info table to chromeos (#12344)

This commit is contained in:
Sharon Katz 2023-06-26 15:40:37 -04:00 committed by GitHub
parent 044935b02f
commit 519982990c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2186 additions and 23625 deletions

View File

@ -4,6 +4,7 @@ import * as SQLite from "wa-sqlite";
// Alphabetical order
import Table from "./tables/Table";
import TableChromeExtensions from "./tables/chrome_extensions";
import TableDiskInfo from "./tables/disk_info";
import TableGeolocation from "./tables/geolocation";
import TableNetworkInterfaces from "./tables/network_interfaces";
import TableOsqueryInfo from "./tables/osquery_info";
@ -28,6 +29,7 @@ export default class VirtualDatabase {
db,
new TableChromeExtensions(sqlite3, db)
);
VirtualDatabase.register(sqlite3, db, new TableDiskInfo(sqlite3, db));
VirtualDatabase.register(sqlite3, db, new TableGeolocation(sqlite3, db));
VirtualDatabase.register(
sqlite3,

View File

@ -0,0 +1,20 @@
import Table from "./Table";
export default class TableDiskInfo extends Table {
name = "disk_info";
columns = ["capacity", "id", "name", "type"];
async generate() {
let rows = [];
const disks = (await chrome.system.storage.getInfo()) as chrome.system.storage.StorageUnitInfo[];
for (let d of disks) {
rows.push({
capacity: d.capacity,
id: d.id,
name: d.name,
type: d.type,
});
}
return rows;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
name: disk_info
platforms:
- windows
- chrome
description: Retrieve basic information about the physical disks of a system.
examples: >-
```
SELECT * FROM disk_info;
```
columns:
- name: disk_size
type: bigint
description: Size of the disk.
required: false
- name: id
type: text
description: The unique identifier of the drive on the system.
required: false
- name: name
type: text
description: The label of the disk object.
required: false
- name: type
type: text
description: The interface type of the disk.
required: false
- name: partitions
platforms:
- windows
- name: disk_index
platforms:
- windows
- name: pnp_device_id
platforms:
- windows
- name: manufacturer
platforms:
- windows
- name: hardware_model
platforms:
- windows
- name: serial
platforms:
- windows
- name: description
platforms:
- windows
evented: false