opencybersecurityalliance / stix-shifter

This project consists of an open source library allowing software to connect to data repositories using STIX Patterning, and return results as STIX Observations.
https://stix-shifter.readthedocs.io
Other
233 stars 232 forks source link

Error: stix_shifter_utils.utils.error_response ERROR unsupplied connector name connector error occurred: list index out of range #1608

Closed leexuan closed 3 months ago

leexuan commented 1 year ago

Has anyone encountered the following error report when executing this command "python main.py translate qradar query {} "[ipv4-addr:value = '127.0.0.1']""?

D:\stix-shifter>python main.py translate qradar query {} "[ipv4-addr:value = '127.0.0.1']"
 2023-10-23 19:43:27,668 stix_shifter_utils.utils.file_helper WARNING  Filepath for D:Git\GitIdeas\OCA\stix-shifter\stix_shifter_modules\qradar\stix_translation\json\aql_events_fields.json still does not exist. Returning empty json
 2023-10-23 19:43:27,672 stix_shifter_utils.utils.file_helper WARNING  Filepath for D:Git\GitIdeas\OCA\stix-shifter\stix_shifter_modules\qradar\stix_translation\json\aql_flows_fields.json still does not exist. Returning empty json
 2023-10-23 19:43:27,676 stix_shifter_modules.qradar.stix_translation.query_translator INFO     Converting STIX2 Pattern to ariel
 2023-10-23 19:43:27,680 stix_shifter.stix_translation.stix_translation ERROR    Caught exception: 'default' <class 'KeyError'>
 2023-10-23 19:43:27,680 stix_shifter_utils.utils.error_response ERROR    unsupplied connector name connector error occurred: list index out of range
Traceback (most recent call last):
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter\stix_translation\stix_translation.py", line 90, in translate_async    transform_result = await entry_point.transform_query(dialect, data)
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter_utils\utils\base_entry_point.py", line 196, in transform_query
    result = translator.transform_query(data)
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter_utils\modules\base\stix_translation\base_query_translator.py", line 120, in transform_query
    translated_queries = self.transform_antlr(data, antlr_parsing)
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter_modules\qradar\stix_translation\query_translator.py", line 31, in transform_antlr
    query_string = query_constructor.translate_pattern(
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter_modules\qradar\stix_translation\query_constructor.py", line 347, in translate_pattern
    select_statement = translated_where_statements.dmm.map_selections()
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter_modules\qradar\stix_translation\query_translator.py", line 16, in map_selections
    return ", ".join(self.select_fields['default'])
KeyError: 'default'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter_utils\utils\async_utils.py", line 20, in run_in_thread
    return loop.run_until_complete(callable(*args, **kwargs))
  File "D:\Env\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter\stix_translation\stix_translation.py", line 147, in translate_async
    ErrorResponder.fill_error(response, message_struct={'exception': ex}, connector=module)
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter_utils\utils\error_response.py", line 126, in fill_error
    ErrorResponder.call_module_error_mapper(message_struct, return_object, connector)
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter_utils\utils\error_response.py", line 136, in call_module_error_mapper
    module_path = 'stix_shifter_modules.' + caller_module_name[0] + '.' + caller_module_name[1] + '.error_mapper'
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Git\GitIdeas\OCA\stix-shifter\main.py", line 4, in <module>
    main()
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter\scripts\stix_shifter.py", line 355, in main
    result = translation.translate(
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter\stix_translation\stix_translation.py", line 167, in translate
    return run_in_thread(self.translate_async, module, translate_type, data_source, data, options, recursion_limit)
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter_utils\utils\async_utils.py", line 24, in run_in_thread
    ErrorResponder.fill_error(return_obj, error=ex, connector=connector)
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter_utils\utils\error_response.py", line 126, in fill_error
    ErrorResponder.call_module_error_mapper(message_struct, return_object, connector)
  File "D:\Git\GitIdeas\OCA\stix-shifter\stix_shifter_utils\utils\error_response.py", line 136, in call_module_error_mapper
    module_path = 'stix_shifter_modules.' + caller_module_name[0] + '.' + caller_module_name[1] + '.error_mapper'
IndexError: list index out of range
mdazam1942 commented 1 year ago

@leexuan this is a very common test command. It should work. Can you please update your fork from the latest develop and try again.

DerekRushton commented 3 months ago

@leexuan Is this still an issue? Given the age of the item and the lack of response, I plan to close this on the 22nd of August (next week).

leexuan commented 3 months ago

closed.