Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thrift.transport.TTransport.TTransportException: Called read on non-open pipe #74

Open
newdjangodev opened this issue Aug 7, 2020 · 1 comment
Labels

Comments

@newdjangodev
Copy link

newdjangodev commented Aug 7, 2020

I have a connection error. Any suggestions? Thank you

PS C:\WINDOWS\system32> python 'C:\Users\sampng\Desktop\python_script\superset.py'                                      Traceback (most recent call last):
  File "C:\Users\sampng\Desktop\python_script\superset.py", line 10, in <module>
    result=instance.client.query("select * from time")
  File "C:\Users\sampng\AppData\Local\Programs\Python\Python36\lib\site-packages\osquery\extensions\ExtensionManager.py", line 181, in query
    self.send_query(sql)
  File "C:\Users\sampng\AppData\Local\Programs\Python\Python36\lib\site-packages\osquery\extensions\ExtensionManager.py", line 190, in send_query
    self._oprot.trans.flush()
  File "C:\Users\sampng\AppData\Local\Programs\Python\Python36\lib\site-packages\thrift\transport\TTransport.py", line 179, in flush
    self.__trans.write(out)
  File "C:\Users\sampng\AppData\Local\Programs\Python\Python36\lib\site-packages\osquery\TPipe.py", line 128, in write
    message='Called read on non-open pipe')
thrift.transport.TTransport.TTransportException: Called read on non-open pipe

My Python script:

import os
import osquery

if __name__ == "__main__":
    # Spawn an osquery process using an ephemeral extension socket.
    instance = osquery.SpawnInstance(r"C:\Program Files\osquery\osqueryi.exe")
    instance.open()  # This may raise an exception

    # Issues queries and call osquery Thrift APIs.
    result=instance.client.query("select * from time")
    print (result)
@prasanthbazz
Copy link
Contributor

I believe you should spawn osqueryd process instead of osqueryi.
Try this:
instance = osquery.SpawnInstance(r"C:\Program Files\osquery\osqueryd\osqueryd.exe")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants