DERQ(1) | General Commands Manual | DERQ(1) |
derq
— Query and
manipulate DER entitlements.
derq |
query [--pretty ]
[--raw ] [--xml ]
[-f format]
[-i input]
[-o output] ⟨query
statements⟩
|
derq |
csops [-p
pid] [-o
output] [--xml ]
⟨query statements⟩
|
derq |
macho [-i
input] [-o
output] [--xml ]
⟨query statements⟩ |
The derq
command queries DER encoded
entitlements using the CoreEntitlements library.
It currently supports querying from a Mach-O, file / input stream, as well as directly from a process using csops(2).
After a succesful execution of the query statements on the
input , derq
will output the
active DER context to the output.
A list of flags and their descriptions:
--pretty
derq
will print the active context
in a textual representation to stderr.--raw
derq
to treat the input as a raw DER
object. Particularly this means that if a V1 entitlements is passed in,
the active context will be set to the outer metadata object, and not the
inner entitlements dictionary.--xml
-i
input-o
outputderq
should use stdout for
output.-p
pidderq
should extract the DER entitlements blob to
be used as input.-f
formatDERQL has very simplistic syntax that consists of a series of operations that are executed one after another. Execution stops either when the last operation is executed or an operation induces the execution engine into an invalid state. There are many operations that can produce an invalid state, such as selecting a key that doesn't exist, or indexing an array past the bounds. Invalid state is also produced when a matching operation fails.
Currently derq
supports 4 operations:
% derq query -i - -o -
1
Will select the second element in the array passed in on stdin and output the selected value to stdout.
% derq query
application-identifier
Will select the value that belongs to the key "application-identifier" from the dictionary passed in on stdin and output the selected value to stdout.
% derq query get-task-allow
Will return a valid boolean only if the value for the key "get-task-allow" is a boolean and has the value of true.
% derq query
useractivity-team-identifier =appleiwork
Will return a valid string only if the value for the key "useractivity-team-identifier" is exactly equal to "appleiwork".
% derq query -i
application.entitlements 0 =secret-entitlement
% derq csops -pid 666
com.apple.application-identifier
=P9Z4AN7VHQ.com.apple.radar.gm
% derq query
com.apple.security.iokit-user-client-class 0
=AppleImage4UserClient
The derq
utility exits 0 on
success, and >0 if an error occurs.
In particular EX_DATAERR (66) is returned if the query could not be satisfied or resulted in invalid state.
The correct pronunciation of derq
sounds
similar to "dirk".
February 10, 2021 | Darwin |