-
Notifications
You must be signed in to change notification settings - Fork 53
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
Data retrieval from the TAXII server with a TAXII client #101
Comments
Hi @ManuelZe, Thanks for creating a new issue and expanding on this. I have a lot more info and can hopefully pinpoint the issue. I assume the incorrect output you're getting is:
What line in your code is actually producing this output? Is it
or is it
With that information I should be able to figure out your issue. Thanks |
@ManuelZe are you still having this issue? Could you indicate which line in the code is causing the error? |
Hi, I am facing the same issue as described above, it's just that i am using a different URL (http://hailataxii.com/taxii-discovery-service). the error comes in the line "server.title". I tried with different feeds but got different errors like (HTTP 500, 406, 400) etc with different urls. I tried with postman and i got same error HTTP 400 I am not sure what should be the value of the X-TAXII-Content-Type header Console log when trying with taxii2client Traceback (most recent call last): |
Hi @rohits144, I believe this is a different issue. Hailataxii is a TAXII 1.x server, while this client is designed for TAXII 2.x. Cabby is a good TAXII 1.x client. If you're intending to use TAXII 2.x instead you'll need to connect to a TAXII 2.x server, such as medallion or FreeTAXII. |
I am seeing this issue when trying to connect the cti-taxii-client/taxii2client/common.py Line 249 in 2c73aa5
@ManuelZe Let me know what I can do to help remediate this. Traceback: Error: Unexpected Response. Got Content-Type: 'application/taxii+json; charset=utf-8; version=2.1' for Accept: 'application/vnd.oasis.taxii+json; version=2.0' If you are trying to contact a TAXII 2.0 Server use 'from taxii2client.v20 import X' If you are trying to contact a TAXII 2.1 Server use 'from taxii2client.v21 import X' traceback: Traceback (most recent call last): File "", line 11834, in main File "", line 12180, in initialise File "", line 12123, in init_roots File "", line 12119, in init_roots File "", line 12133, in set_api_root File "/usr/local/lib/python3.9/site-packages/taxii2client/v20/init.py", line 753, in api_roots self._ensure_loaded() File "/usr/local/lib/python3.9/site-packages/taxii2client/v20/init.py", line 769, in _ensure_loaded self.refresh() File "/usr/local/lib/python3.9/site-packages/taxii2client/v20/init.py", line 805, in refresh response = self.__raw = self._conn.get(self.url) File "/usr/local/lib/python3.9/site-packages/taxii2client/common.py", line 319, in get raise TAXIIServiceException(msg.format(content_type, accept)) taxii2client.exceptions.TAXIIServiceException: Unexpected Response. Got Content-Type: 'application/taxii+json; charset=utf-8; version=2.1' for Accept: 'application/vnd.oasis.taxii+json; version=2.0' If you are trying to contact a TAXII 2.0 Server use 'from taxii2client.v20 import X' If you are trying to contact a TAXII 2.1 Server use 'from taxii2client.v21 import X' (85) |
@TechBurn0ut you have a different issue. Looks like you are using the 2.0 client to connect to a 2.1 server. Try importing from taxii2client.v21 instead. |
@TechBurn0ut from taxii2client.v21 import Server Initialize the TAXII serverserver = Server(url='http://192.168.204.114:8080/taxii2/', user='user', password='password') api_root = server.api_roots[0] desired_collection = None response = desired_collection.get_object() taxii2client.exceptions.TAXIIServiceException: Unexpected Response. Got Content-Type: 'application/json; charset=utf-8' for Accept: 'application/taxii+json;version=2.1' |
Looks like the content type that the server sent you is not compliant with either TAXII 2.0 or 2.1. TAXII 2.0 requires something like Some of the API methods have an cti-taxii-client/taxii2client/v21/__init__.py Line 606 in 54dabad
But it seems like their TAXII server should be sending spec compliant response headers! [1] https://docs.oasis-open.org/cti/taxii/v2.0/taxii-v2.0.html#_Toc496542707 Edit: I am just looking at the code, not running tests on non-compliant servers, but using a custom value for cti-taxii-client/taxii2client/common.py Lines 296 to 297 in 54dabad
|
I am currently experiencing the same problem currently. But with version 2.1 of Taxii. Except that for me, I have
Content-Type: 'text / plain' for Accept: 'application / taxii + json; version = 2.1'
If you are trying to contact a TAXII 2.0 Server use 'from taxii2client.v20 import X'
If you are trying to contact a TAXII 2.1 Server use 'from taxii2client.v21 import X'
Could someone help me please?
I am using the medallion for TAXII server configuration.
As well as data extraction with the TAXII client developed by OASIS
Here is the data extraction code
`
from django.shortcuts import render
from taxii2client.v21 import Server
import requests
from taxii2client.v21 import Collection, as_pages
HEADERS = { 'Accept: application/taxii+json;version=2.1'}
def getinfo(request):
server = Server(url = 'http://127.0.0.1:5000/taxii2/', user='admin', password='Password0')
`
TAXII Server : Medallion : server
TAXII Client : Client
The text was updated successfully, but these errors were encountered: