Fix AttributeError in warn_about_older_operating_systems when device_state not yet set#788
Open
uceka wants to merge 1 commit intosensepost:masterfrom
Open
Conversation
…state not yet set warn_about_older_operating_systems() is called from the start command before device_state.platform and device_state.version are populated (e.g. when connecting to a remote frida-server). This caused: AttributeError: 'DeviceState' object has no attribute 'platform' Guard with getattr(..., None) and return early when platform or version are not set, so the version warnings are skipped until device state is available. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix AttributeError in
warn_about_older_operating_systemswhen device_state is not yet setProblem
When running
objection -N -h <host> -n "<app>" start(network/remote connection), the following error occurs:warn_about_older_operating_systems()is invoked from thestartcommand beforedevice_state.platformanddevice_state.versionare populated.DeviceStatedoes not initialize these in__init__; they are set later viaset_platform()/set_version(). When connecting to a remote frida-server, the state may not be ready at the time the warning runs.Solution
getattr(device_state, 'platform', None)andgetattr(device_state, 'version', None)to safely read attributes.None, skipping the Android/iOS version warnings until device state is available.platformandversionvariables in the conditionals and format strings to avoid repeated attribute access.Testing
objection -N -h 127.0.0.1 -n "Iru Access" startAttributeErrorand the REPL works as expected.