Repository: OpenCTI-Platform/connectors

Issue:
[import-report] Trouble parsing domains / URLs with capital letters
## Description

import-report appears to fail when parsing domains with capital letters. I've attached the txt file of domains I was trying to import below.  The import fails with the error "'list' object has no attribute 'values'". I played with the input file by removing domains that appeared to be causing issues, and the problematic domains were:

- kAty197.chickenkiller[.]com
- Soure7788.chickenkiller[.]com
- Engaction[.]com

## Environment

1. OS (where OpenCTI server runs): Ubuntu 18
2. OpenCTI version: OpenCTI 4.5.5
3. OpenCTI client: frontend
4. Other environment details: import-connector: rolling

## Reproducible Steps

Steps to create the smallest reproducible scenario:
1. Import txt file with domains/URLs with capital letters

## Expected Output

Domains / URLs are parsed as observables

## Actual Output

Import-report connector crashes, no observables are parsed unless the capital letters become lowercase or the offending domains are removed
 
## Additional information

I've attached 3 files:

- **AA21-200A_domains_failed.txt** : The original txt file, with domains including capital letters
- **AA21-200A_domains_success.txt** : The revised txt file, with no capital letters
- **errorlog.txt** : The error log, from one of the times when I tried to import a version of the original file (this was an iteration of troubleshooting, so the error log shows what happens when I input the txt file having removed the first two offending domains)

[AA21-200A_domains_success.txt](https://github.com/OpenCTI-Platform/connectors/files/7101092/AA21-200A_domains_success.txt)
[errorlog.txt](https://github.com/OpenCTI-Platform/connectors/files/7101093/errorlog.txt)
[AA21-200A_domains_failed.txt](https://github.com/OpenCTI-Platform/connectors/files/7101094/AA21-200A_domains_failed.txt)




Discussion:

Resolving patch:
diff --git a/internal-import-file/import-report/src/reportimporter/report_parser.py b/internal-import-file/import-report/src/reportimporter/report_parser.py
--- a/internal-import-file/import-report/src/reportimporter/report_parser.py
+++ b/internal-import-file/import-report/src/reportimporter/report_parser.py
@@ -181,9 +181,24 @@ def _extract_observable(self, observable: Observable, data: str) -> Dict:
             matches = lookup_function(data)
 
             for match in matches:
-                start = data.index(str(match))
+                match_str = str(match)
+                if match_str in data:
+                    start = data.index(match_str)
+                elif match_str in data.lower():
+                    self.helper.log_debug(
+                        f"External library manipulated the extracted value '{match_str}' from the "
+                        f"original text '{data}' to lower case"
+                    )
+                    start = data.lower().index(match_str)
+                else:
+                    self.helper.log_error(
+                        f"The extracted text '{match_str}' is not part of the original text '{data}'. "
+                        f"Please open a GitHub issue to report this problem!"
+                    )
+                    continue
+
                 ind_match = self._post_parse_observables(
-                    match, observable, (start, len(str(match)) + start)
+                    match, observable, (start, len(match_str) + start)
                 )
                 if ind_match:
                     list_matches[match] = ind_match


Test patch: