We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b1304d0 commit 33c1d31Copy full SHA for 33c1d31
examples/run.py
@@ -0,0 +1,25 @@
1
+#!/usr/bin/env python
2
+"""
3
+simple script which runs a query from stdin
4
5
+
6
+import sys
7
+import osquery
8
9
+if __name__ == "__main__":
10
+ if len(sys.argv) != 2:
11
+ print("Usage: %s \"query\"" % sys.argv[0])
12
+ sys.exit(1)
13
+ CLIENT = osquery.ExtensionClient()
14
+ CLIENT.open()
15
+ RESULTS = CLIENT.extension_client().query(sys.argv[1])
16
+ if RESULTS.status.code != 0:
17
+ print("Error running the query: %s" % RESULTS.status.message)
18
19
20
+ for row in RESULTS.response:
21
+ print("=" * 80)
22
+ for key, val in row.iteritems():
23
+ print("%s => %s" % (key, val))
24
+ if len(RESULTS.response) > 0:
25
0 commit comments