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

Issues Decrypting logs #63

Open
AntonioR98 opened this issue Aug 16, 2023 · 3 comments
Open

Issues Decrypting logs #63

AntonioR98 opened this issue Aug 16, 2023 · 3 comments

Comments

@AntonioR98
Copy link

I am using pycrytodome instead of pycryto on centos and currently not able to decrypt the logs that seen.

Saving file 2490_XXXXXXX.log locally to the 'fail' folder local variable 'uncompressed_and_decrypted_file_content' referenced before assignment Traceback (most recent call last):
File "LogsDownloader.py", line 224, in handle_file
decrypted_file = self.decrypt_file(result[1], logfile)
File "LogsDownloader.py", line 339, in decrypt_file
return uncompressed_and_decrypted_file_content
UnboundLocalError: local variable 'uncompressed_and_decrypted_file_content' referenced before assignment

2023-08-16 14:13:12,346 ERROR Failed to downloading index file and starting to download all the log files in it - write() argument must be str, not bytes, Traceback (most recent call last):
File "LogsDownloader.py", line 224, in handle_file
decrypted_file = self.decrypt_file(result[1], logfile)
File "LogsDownloader.py", line 339, in decrypt_file
return uncompressed_and_decrypted_file_content
UnboundLocalError: local variable 'uncompressed_and_decrypted_file_content' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "LogsDownloader.py", line 131, in get_log_files
self.first_time_scan()
File "LogsDownloader.py", line 200, in first_time_scan
success = self.handle_file(log_file_name)
File "LogsDownloader.py", line 237, in handle_file
file.write(result[1])
TypeError: write() argument must be str, not bytes

@dkalwat
Copy link

dkalwat commented Sep 15, 2023

Update line 131 to:
uncompressed_and_decrypted_file_content = zlib.decompressobj().decompress(AES.new(base64.b64decode(bytearray(content_decrypted_sym_key)), AES.MODE_CBC, (16 * "\x00").encode("utf8")).decrypt(file_log_content))

@joeymoore
Copy link
Contributor

@dkalwat have you implemented this code change on your own system? I ask because it looks like you are running the older 2.x version of the script and I am moving forward with the 3.0 version of the script.

@dkalwat
Copy link

dkalwat commented Sep 27, 2023

Yes, I made this change in the current version of the script

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