Skip to content
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

Script is running into errors #32

Open
rohan-zscaler opened this issue Dec 19, 2023 · 3 comments
Open

Script is running into errors #32

rohan-zscaler opened this issue Dec 19, 2023 · 3 comments

Comments

@rohan-zscaler
Copy link

12/19/2023 05:10:30 PM Successfully prepared 997 Indicators for Zscaler API
Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Users\eparra\Desktop\zscaler-FalconX-integration\intelbridge_main
.py", line 26, in
main()
File "C:\Users\eparra\Desktop\zscaler-FalconX-integration\intelbridge_main
.py", line 18, in main
intelbridge.start()
File "C:\Users\eparra\Desktop\zscaler-FalconX-integration\intelbridge\intelbridge.py", line 135, in start
deleted, loop = self.etl_loop(falcon, zs_token, deleted, loop)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\eparra\Desktop\zscaler-FalconX-integration\intelbridge\intelbridge.py", line 105, in etl_loop
ingestable, amount_rejected = self.prepare(zs_token, indicators)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\eparra\Desktop\zscaler-FalconX-integration\intelbridge\intelbridge.py", line 59, in prepare
prepared, amount_rejected_crwd = prepare_indicators(indicators)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\eparra\Desktop\zscaler-FalconX-integration\intelbridge\indicators\indicators.py", line 105, in prepare_indicators
write_rejected("regex filter rejected", rejected)
File "C:\Users\eparra\Desktop\zscaler-FalconX-integration\intelbridge\util\util.py", line 100, in write_rejected
f = open(data_file, 'a')
^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'logs/rejected_log/data_rejected_2023-12-19.log'

I had to comment following lines to make it work. Can you pls take a look at add the fix?

def write_rejected(message, entry):
95 """writes rejected URLs to a log file
96 """
97 # rejected_indicators_data = f"logs/rejected_log/data_rejected"
98 # data_file = rejected_indicators_data
99 # data_file = data_file + "_" + time.strftime("%Y-%m-%d", time.gmtime()) +".log"
100 # f = open(data_file, 'a')
101 # f.write(f"{time.strftime('%Y-%m-%d', time.gmtime())}: {message}: {entry}")
102 # f.close()
103 return

@jrandrusk
Copy link

This is a bug in that it's attempting to write to a non-existent directory. Quick fix is just to do amkdir rejected_logunder the logs directory and re-run the script. Would have thought this would have been fixed by now.

@rohan-zscaler
Copy link
Author

rohan-zscaler commented Dec 19, 2023 via email

@yaroslav-nakonechnikov
Copy link

yaroslav-nakonechnikov commented Feb 5, 2024

@rohan-zscaler @jrandrusk please review #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants