AlienVault-OTX / OTX-Python-SDK

The Python SDK for AlienVault OTX
Other
357 stars 162 forks source link

EOF occurred in violation of protocol while Pulling pulses #29

Open npormambi opened 7 years ago

npormambi commented 7 years ago

Hello,

I am using pthon2.7, when I use pulses = otx.getall() It gives below error, Traceback (most recent call last): File "otx.py", line 7, in pulses = otx.getall() File "/usr/local/lib/python2.7/dist-packages/OTXv2.py", line 236, in getall json_data = self.get(next_page_url) File "/usr/local/lib/python2.7/dist-packages/OTXv2.py", line 81, in get raise e urllib2.URLError: <urlopen error [Errno 8] _ssl.c:510: EOF occurred in violation of protocol>

Anyone is aware of this issue, I tried the same with python3.4 as well still getting same error Running ubuntu 14.04

Thanks, Npormambi

npormambi commented 7 years ago

@chrisdoman any update on this.

npormambi commented 7 years ago

@chrisdoman this is something helpful to fix the issue http://stackoverflow.com/questions/32115607/python-3-4-ssl-error-urlopen-error-eof-occurred-in-violation-of-protocol-ssl-c

chrisdoman commented 7 years ago

Thanks npormambi. No update yet but I am looking into it and will update soon.

chrisdoman commented 7 years ago

Hi,

I've ran the SDK on Ubuntu 14.04 with python 2.7 and I'm not getting this error. Looking into it, this may be an issue with the OpenSSL library on your machine.

There are a couple of work arounds you might want to try, though I can't test these to confirm they will work here-

import ssl ssl.PROTOCOL_SSLv23 = ssl.PROTOCOL_TLSv1

Thanks,

npormambi commented 7 years ago

@chrisdoman working with python 2.7 and ubuntu 14.04, but still getting the same error. screenshot from 2017-03-06 09 13 59

alaaalii commented 7 years ago

What is the output of python --version and python -c "import ssl; print ssl.OPENSSL_VERSION"?

npormambi commented 7 years ago

@alaaalii please check the required output belo screenshot from 2017-03-06 15 35 06

alaaalii commented 7 years ago

@npormambi I've also tried on Ubuntu 14.04 with the same python version and openssl. Can you try running your Python script using python otx.py not python2.7 otx.py? I'm hoping python is pointing to something else in your path.

npormambi commented 7 years ago

@alaaalii thanks a lot it worked :) do you know whats the exact issue is in this case? Because I want to work with python 3, how can i avoid this issue? Just one more thing I wanna add here, some times I get the below error, but some times it works perfectly fine (at the moment its working :)) ![image](https://cloud.g otx error ithubusercontent.com/assets/16058609/24035483/bea39ada-0b1b-11e7-8a32-5adf6a8abd59.png)

alaaalii commented 7 years ago

@npormambi I don't understand, so you still sometimes get the error when using python otx.py? But you always get the error when you run python2.7 otx.py? What I suspected was: you might somehow have two versions of Python2.7 installed. Try rerunning the commands I mentioned earlier but using python2.7, so python2.7 --version and python2.7 -c "import ssl; print ssl.OPENSSL_VERSION" and see if it's different than what you pasted before.

If this is a machine owned by you, and it is safe to do so, I advise you to also make sure packages in your Ubuntu are up to date by running sudo apt-get update && sudo apt-get upgrade. You could also simply just remove all versions of Python and reinstall from scratch. This is obviously not the best way of troubleshooting this, but if it's working with python and not python2.7 then it's something in your setup.

npormambi commented 7 years ago

@alaaalii Thanks for the update. Its been week now, i am not facing any issues. If i do in future will definitely try solution suggested by you. Thanks a lot :)

ghost commented 7 years ago

Also the output of alias python2.7 and which python2.7 would be interesting in comparison with the smae outputs with python instead of python2.7.

npormambi commented 7 years ago

@wagner-certat Please find the below outputs otx error

ghost commented 7 years ago

To get the target of symbolic links you can use ls -l $(which python) and ls -l $(which python2.7)

You can copy and paste the in/output from the terminal to your comment, use the code-markup.

npormambi commented 7 years ago

@wagner-certat image

ghost commented 7 years ago

Then both are the same and the assumption by @alaaalii can't be proven.