Open w4rc0n opened 2 years ago
from OTXv2 import OTXv2
try: with open('config.json', 'r') as file: config = json.load(file) except: quit('config.json not found, or unreadable.')
otx = OTXv2(config['otx_api_key'])
pulses = otx.get_my_pulses(max_items=200) -> pulses = otx.get_my_pulses(query='', max_items=200) print(pulses)
In trying to use some simple python like this:
The result would always be an empty list:
[]
No matter what arguments I passed to theget_my_pulses
function.I started digging into the source OTXv2 library. And hacked together the equivalent necessary functions using the
requests library
Which yielded a more expected response
214
which is accurate.Upon digging more into the OTXv2 library functions, I hacked this together to give me just the necessary bits so that I could place some print statements and find what URLs were being formed.
This yielded URLs consistently like this, uring the create_url() function:
q=
is not a valid API query parameter according to the OTX API documentation: https://otx.alienvault.com/apionly
limit
,page
, 'since`.I'm haven't completely learned the OTXv2 code base, but I don't see anywhere were
q=
is supposed to be formatted into something the API accepts out of the above list of valid queries.If you provide any sort of data by passing it in with
get_my_pulses(query=<anything>)
it always formats the URL ashttps://otx.alienvault.com/api/v1/pulses/my?limit=50&q=<anything>
which the API responds to with 0 results.Am I missing something?
Note: I saw similar issues with
get_user_pulses()
but it appears to be virtually identical just with a different API endpoint URL.