-
Notifications
You must be signed in to change notification settings - Fork 45
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
Linux images: ValueError: invalid literal for int() with base 10: 'None' #736
Comments
Unable to reproduce, it is possible to get a sample file that contains this issue? |
I found the line in the journal, but I can't share. The issue was caused by a line created by ansible, where the uid is set to the word "None". Dissect tries to parse this to an Integer. The check in "/usr/local/lib/python3.9/dist-packages/dissect/target/plugins/os/unix/log/journal.py" line 261 checks if the variable is None, but not if the contained string is 'None'. An easy fix would be to check if the value is the string None. Tried this and it worked: |
okay, just let's add a comment then to clarify okay, for the rest your patch looks good. |
Hello there!
I get this error quite often when I try to get information about linux images (e.g. ip adresses):
Traceback (most recent call last):
File "/usr/local/bin/target-query", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.9/dist-packages/dissect/target/tools/utils.py", line 255, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/dissect/target/tools/query.py", line 384, in main
raise e
File "/usr/local/lib/python3.9/dist-packages/dissect/target/tools/query.py", line 373, in main
for record_entries in entry:
File "/usr/local/lib/python3.9/dist-packages/dissect/target/plugins/general/osinfo.py", line 28, in osinfo
value = getattr(self.target._os, os_func)
File "/usr/local/lib/python3.9/dist-packages/dissect/target/helpers/cache.py", line 228, in cache_wrapper
return cache.call(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/dissect/target/helpers/cache.py", line 104, in call
func_cache[key] = self.func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/dissect/target/plugins/os/unix/linux/_os.py", line 44, in ips
for ip in parse_unix_dhcp_log_messages(self.target):
File "/usr/local/lib/python3.9/dist-packages/dissect/target/helpers/network_managers.py", line 533, in parse_unix_dhcp_log_messages
for record in messages:
File "/usr/local/lib/python3.9/dist-packages/dissect/target/plugins/os/unix/log/journal.py", line 428, in journal
uid=get_optional(entry.get("uid"), int),
File "/usr/local/lib/python3.9/dist-packages/dissect/target/plugins/os/unix/log/journal.py", line 261, in get_optional
return to_type(value) if value else None
ValueError: invalid literal for int() with base 10: 'None'
Is there a way to fix this?
The text was updated successfully, but these errors were encountered: