Skip to content

Cannot start process from path: /usr/local/bin/osqueryd #90

Description

@pathikrit

I installed osquery using:

$ brew install osquery

Verified it works:

$ osqueryi
Using a virtual database. Need help, type'.help'
osquery>selecttimestamp from time;
+------------------------------+
| timestamp |
+------------------------------+
| Mon Apr 17 15:36:50 2023 UTC |
+------------------------------+

Copied the code from README:

importosqueryif__name__=="__main__":
instance=osquery.SpawnInstance()
instance.open()
instance.client.query("select timestamp from time;")

When I ran above code, I get this error:

Traceback (mostrecentcalllast):
File"main.py", line5, in<module>instance.open()
File"./venv/lib/python3.8/site-packages/osquery/management.py", line137, inopenraiseException("Cannot start process from path: %s"% (self.path))
Exception: Cannotstartprocessfrompath: /usr/local/bin/osqueryd

I then noticed that osqueryi is simply a symlink to osqueryd which the above is looking for:

$ ls -a /usr/local/bin/osqueryi
lrwxr-xr-x 52 root 17 Apr 11:20 /usr/local/bin/osqueryi -> /opt/osquery/lib/osquery.app/Contents/MacOS/osqueryd

So I tried this:

importosqueryif__name__=="__main__":
instance=osquery.SpawnInstance("/usr/local/bin/osqueryi")
instance.open()
instance.client.query("select timestamp from time;")

But, now I get different error:

Traceback (mostrecentcalllast):
File"./main.py", line6, in<module>instance.client.query("select timestamp from time;")
File"./venv/lib/python3.8/site-packages/osquery/extensions/ExtensionManager.py", line181, inqueryself.send_query(sql)
File"./venv/lib/python3.8/site-packages/osquery/extensions/ExtensionManager.py", line190, insend_queryself._oprot.trans.flush()
File"./venv/lib/python3.8/site-packages/thrift/transport/TTransport.py", line179, influshself.__trans.write(out)
File"./venv/lib/python3.8/site-packages/thrift/transport/TSocket.py", line172, inwriteraiseTTransportException(type=TTransportException.NOT_OPEN,
thrift.transport.TTransport.TTransportException: Transportnotopen

What am I doing wrong? Why is running code from the README doesn't work??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions