target / huntlib

A Python library to help with some common threat hunting data analysis operations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Elasticsearch Connection Sending Unexpected Key

cgivre opened this issue · comments

Describe the bug
I just installed huntlib and attempted to connect to Elasticsearch.

To Reproduce

es_connection = ElasticDF(
                url="https://localhost:9200"
)

Results in:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[20], line 1
----> 1 es_connection = ElasticDF(
      2                 url="https://localhost:9200/"
      3 )

File ~/anaconda3/lib/python3.11/site-packages/huntlib/elastic.py:60, in ElasticDF.__init__(self, url, timeout, ssl, username, password, verify_certs, ca_certs)
     55 def __init__(self, url=None, timeout=250, ssl=False, username="", password="", verify_certs=True, ca_certs=None):
     56     '''
     57     Create the ElasticDF object and log into the Elastic server.
     58     '''
---> 60     self.es_conn = Elasticsearch(
     61         url,
     62         timeout=timeout,
     63         use_ssl=ssl,
     64         verify_certs=verify_certs,
     65         ca_certs=ca_certs,
     66         http_auth=(username, password)
     67     )

TypeError: Elasticsearch.__init__() got an unexpected keyword argument 'use_ssl'

Expected behavior
I would have expected huntlib to create an ES connection.

Desktop (please complete the following information):
macOS Sonoma.

I suspect the cause of this issue is an update in the underlying Elasticsearch dependency. We could either fix this by fixing the version of the ES module or modifying the constructor in huntlib.