2021-09-10 19:06:37 +00:00
|
|
|
import PropTypes from "prop-types";
|
2024-07-09 13:18:00 +00:00
|
|
|
import { QueryablePlatform, QueryableDisplayPlatform } from "./platform";
|
2021-09-10 19:06:37 +00:00
|
|
|
|
|
|
|
|
export default PropTypes.shape({
|
|
|
|
|
columns: PropTypes.arrayOf(
|
|
|
|
|
PropTypes.shape({
|
|
|
|
|
description: PropTypes.string,
|
|
|
|
|
name: PropTypes.string,
|
|
|
|
|
type: PropTypes.string,
|
|
|
|
|
})
|
|
|
|
|
),
|
|
|
|
|
description: PropTypes.string,
|
|
|
|
|
name: PropTypes.string,
|
|
|
|
|
platform: PropTypes.string,
|
|
|
|
|
});
|
|
|
|
|
|
2022-10-14 16:45:57 +00:00
|
|
|
export type ColumnType =
|
|
|
|
|
| "integer"
|
|
|
|
|
| "bigint"
|
|
|
|
|
| "double"
|
|
|
|
|
| "text"
|
2024-03-26 16:37:08 +00:00
|
|
|
| "unsigned_bigint"
|
|
|
|
|
| "STRING"
|
|
|
|
|
| "string"; // TODO: Why do we have type string, STRING, and text in schema.json?
|
2022-10-14 16:45:57 +00:00
|
|
|
|
2024-07-09 13:18:00 +00:00
|
|
|
// TODO: Replace with one or the other once osquery_fleet_schema.json follows one type or other
|
|
|
|
|
export type TableSchemaPlatform = QueryableDisplayPlatform | QueryablePlatform;
|
2022-10-14 16:45:57 +00:00
|
|
|
export interface IQueryTableColumn {
|
2021-09-10 19:06:37 +00:00
|
|
|
name: string;
|
2022-10-14 16:45:57 +00:00
|
|
|
description: string;
|
|
|
|
|
type: ColumnType;
|
2021-09-10 19:06:37 +00:00
|
|
|
hidden: boolean;
|
|
|
|
|
required: boolean;
|
|
|
|
|
index: boolean;
|
2024-07-09 13:18:00 +00:00
|
|
|
platforms?: TableSchemaPlatform[];
|
2022-10-14 16:45:57 +00:00
|
|
|
requires_user_context?: boolean;
|
2021-09-10 19:06:37 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-14 16:45:57 +00:00
|
|
|
export interface IOsQueryTable {
|
2021-09-10 19:06:37 +00:00
|
|
|
name: string;
|
2022-10-14 16:45:57 +00:00
|
|
|
description: string;
|
2021-09-10 19:06:37 +00:00
|
|
|
url: string;
|
2024-07-09 13:18:00 +00:00
|
|
|
platforms: TableSchemaPlatform[];
|
2021-09-10 19:06:37 +00:00
|
|
|
evented: boolean;
|
|
|
|
|
cacheable: boolean;
|
2022-10-14 16:45:57 +00:00
|
|
|
columns: IQueryTableColumn[];
|
|
|
|
|
examples?: string;
|
|
|
|
|
notes?: string;
|
2023-06-16 15:38:52 +00:00
|
|
|
hidden?: boolean;
|
2021-09-10 19:06:37 +00:00
|
|
|
}
|
2022-03-21 16:51:00 +00:00
|
|
|
|
2023-06-07 16:01:59 +00:00
|
|
|
// Also used for testing
|
2022-10-14 16:45:57 +00:00
|
|
|
export const DEFAULT_OSQUERY_TABLE: IOsQueryTable = {
|
2022-03-21 16:51:00 +00:00
|
|
|
name: "users",
|
|
|
|
|
description:
|
|
|
|
|
"Local user accounts (including domain accounts that have logged on locally (Windows)).",
|
|
|
|
|
url: "https://github.com/osquery/osquery/blob/master/specs/users.table",
|
2023-06-07 16:01:59 +00:00
|
|
|
platforms: ["darwin", "linux", "windows", "chrome"],
|
2022-03-21 16:51:00 +00:00
|
|
|
evented: false,
|
|
|
|
|
cacheable: false,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
name: "uid",
|
|
|
|
|
description: "User ID",
|
|
|
|
|
type: "bigint",
|
|
|
|
|
hidden: false,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "gid",
|
|
|
|
|
description: "Group ID (unsigned)",
|
|
|
|
|
type: "bigint",
|
|
|
|
|
hidden: false,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
2023-06-07 16:01:59 +00:00
|
|
|
platforms: ["macOS", "Windows", "Linux"],
|
2022-03-21 16:51:00 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "uid_signed",
|
|
|
|
|
description: "User ID as int64 signed (Apple)",
|
|
|
|
|
type: "bigint",
|
|
|
|
|
hidden: false,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
2023-06-07 16:01:59 +00:00
|
|
|
platforms: ["macOS", "Windows", "Linux"],
|
2022-03-21 16:51:00 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "gid_signed",
|
|
|
|
|
description: "Default group ID as int64 signed (Apple)",
|
|
|
|
|
type: "bigint",
|
|
|
|
|
hidden: false,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
2023-06-07 16:01:59 +00:00
|
|
|
platforms: ["macOS", "Windows", "Linux"],
|
2022-03-21 16:51:00 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "username",
|
|
|
|
|
description: "Username",
|
|
|
|
|
type: "text",
|
|
|
|
|
hidden: false,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "description",
|
|
|
|
|
description: "Optional user description",
|
|
|
|
|
type: "text",
|
|
|
|
|
hidden: false,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
2023-06-07 16:01:59 +00:00
|
|
|
platforms: ["macOS", "Windows", "Linux"],
|
2022-03-21 16:51:00 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "directory",
|
|
|
|
|
description: "User's home directory",
|
|
|
|
|
type: "text",
|
|
|
|
|
hidden: false,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
2023-06-07 16:01:59 +00:00
|
|
|
platforms: ["macOS", "Windows", "Linux"],
|
2022-03-21 16:51:00 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "shell",
|
|
|
|
|
description: "User's configured default shell",
|
|
|
|
|
type: "text",
|
|
|
|
|
hidden: false,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
2023-06-07 16:01:59 +00:00
|
|
|
platforms: ["macOS", "Windows", "Linux"],
|
2022-03-21 16:51:00 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "uuid",
|
|
|
|
|
description: "User's UUID (Apple) or SID (Windows)",
|
|
|
|
|
type: "text",
|
|
|
|
|
hidden: false,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "type",
|
|
|
|
|
description:
|
|
|
|
|
"Whether the account is roaming (domain), local, or a system profile",
|
|
|
|
|
type: "text",
|
|
|
|
|
hidden: true,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
2023-06-07 16:01:59 +00:00
|
|
|
platforms: ["Windows"],
|
2022-03-21 16:51:00 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "is_hidden",
|
|
|
|
|
description: "IsHidden attribute set in OpenDirectory",
|
|
|
|
|
type: "integer",
|
|
|
|
|
hidden: false,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
2023-06-07 16:01:59 +00:00
|
|
|
platforms: ["macOS"],
|
2022-03-21 16:51:00 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "pid_with_namespace",
|
|
|
|
|
description: "Pids that contain a namespace",
|
|
|
|
|
type: "integer",
|
|
|
|
|
hidden: true,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
|
|
|
|
},
|
2023-06-07 16:01:59 +00:00
|
|
|
{
|
|
|
|
|
name: "email",
|
|
|
|
|
description: "Email",
|
|
|
|
|
type: "text",
|
|
|
|
|
hidden: false,
|
|
|
|
|
required: false,
|
|
|
|
|
index: false,
|
|
|
|
|
platforms: ["chrome"],
|
|
|
|
|
},
|
2022-03-21 16:51:00 +00:00
|
|
|
],
|
2023-06-07 16:01:59 +00:00
|
|
|
notes: "",
|
|
|
|
|
examples:
|
|
|
|
|
"List users that have interactive access via a shell that isn't false.\n```\nSELECT * FROM users WHERE shell!='/usr/bin/false';\n```",
|
2022-03-21 16:51:00 +00:00
|
|
|
};
|