infomaniac
12/16/2020, 12:56 PMinfomaniac
12/16/2020, 1:15 PMinfomaniac
12/16/2020, 1:37 PMselect tbl_name FROM sqlite_temp_master WHERE type = "table";
infomaniac
12/16/2020, 1:40 PMpragma table_info("<table name>")
returns all the columnstheopolis
infomaniac
12/16/2020, 1:55 PMosquery_registry
returns a lot more tables though.infomaniac
12/16/2020, 1:55 PMselect sql.name AS 'from sqlite', reg.name as 'from osquery registry' FROM osquery_registry reg
LEFT JOIN sqlite_temp_master sql ON reg.name = sql.name
WHERE reg.active = 1
AND internal = 0
AND registry = 'table'
infomaniac
12/16/2020, 2:02 PMpragma table_info("<table>")
works for tables not included in sqlite_temp_master
- so I'll just use osquery_registry
then. thanks a lot!theopolis
osquery_tables
that structures the schema info.infomaniac
12/16/2020, 2:37 PMinfomaniac
12/16/2020, 2:38 PMtheopolis
theopolis
infomaniac
12/16/2020, 2:40 PMtheopolis
theopolis
theopolis
infomaniac
12/16/2020, 2:43 PMgetQueryColumns
to solve thattheopolis
infomaniac
12/16/2020, 2:43 PMosquery_registry
for now, but will cover osquery_tables
(or whatever) in the future?infomaniac
12/16/2020, 2:46 PMinfomaniac
12/16/2020, 3:20 PMosquery_
prefixinfomaniac
12/16/2020, 4:25 PMzwass
infomaniac
12/16/2020, 4:40 PMzwass
.schema table
. I wonder if that works via the API?infomaniac
12/16/2020, 4:54 PMinfomaniac
12/16/2020, 4:54 PM.schema
and .tables
are exactly what i need, but those do not work via the Thrift API, so I have to revert to plain ol' SQLseph
.table
and .schema
can be queried.seph
infomaniac
12/16/2020, 5:31 PMinfomaniac
12/16/2020, 5:32 PMseph
zwass
infomaniac
12/16/2020, 5:40 PM.tables
or .schema
over that API unless i'm mistakenseph
seph
seph
select name from osquery_registry where registry = 'table' and active = 1
to fetch the active tables for tab completion. Not sure it uses colunmnsinfomaniac
12/16/2020, 5:48 PMinfomaniac
12/16/2020, 5:48 PMPRAGMA
seems to be the only way to describe tables without using the shell builtins. how feasible is it to whitelist the table_info
pragma in light of that PR you linked earlier?
if it weakens the security stance then i can live without itseph
zwass
infomaniac
12/16/2020, 5:51 PMpragma
👍
thanks a lot!seph
.schema
does not work on the thrift socket.zwass
infomaniac
12/16/2020, 5:59 PMpragma
whitelistings - or the fact that the shell builtins don't work via Thrift?seph
seph
infomaniac
12/16/2020, 6:00 PMseph
sqlite_schema
should contain this. But does not. OTOH, I’m not really a sqlite expert.seph
sqlite_schema
tableinfomaniac
12/16/2020, 6:12 PM