* Call `set_catch_type` on both nodes to ensure the attribute is not empty
Nodes with `catch_type` set to the default `None` cause exceptions when the user requests human-readable source code.
Fix for issue #1079.
* Ensure nodes in the same catch edge inherit non-empty `catch_type` from each other
Some areas in the code call `add_catch_edge` without calling `set_catch_type`. Nodes with `catch_type` set to the default `None` cause exceptions when the user requests human-readable source code.
Fix for issue #1079.
* Convert `visit_ins` into a method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `write_inplace_if_possible` and `visit_expr` into methods
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `visit_arr_data` into a method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `visit_decl` into a method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `literal_null` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `literal_double` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `literal_float` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `literal_long` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `literal_hex_int` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `literal_int` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `literal_bool` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `literal_class` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `literal_string` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `parse_descriptor` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `_append` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `statement_block` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `switch_stmt` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `if_stmt` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `try_stmt` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `loop_stmt` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `jump_stmt` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `throw_stmt` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `return_stmt` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `local_decl_stmt` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `expression_stmt` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `dummy` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `var_decl` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `unary_postfix` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `unary_prefix` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `typen` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `parenthesis` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `method_invocation` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `local` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `literal` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `field_access` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `cast` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `binary_infix` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `assignment` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `array_initializer` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `array_creation` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* Convert `array_access` into a static method
This commit is part of a series of changes that convert functions in `androguard.decompiler.dast` into instance or static methods.
With the previous version of the code it was difficult to alter the functionality of the `JSONWriter` class.
For some methods in `JSONWriter`, expanding the behaviour would require re-implementing entire code blocks or using monkey patching.
Example:
In the original version of the code the `dast` module contains a function called `method_invocation`. It is used in another function called `visit_expr`. `visit_expr` is called by `JSONWriter` in `get_cond` and `visit_switch_node` instance methods.
If a developer wanted to add extra logic for cases when `JSONWriter` detects a method invocation (e.g. to dynamically log callers), the procedure would be very complicated:
1. Use some form of monkey patching to modify the `method_invocation` and `visit_expr` functions.
2. Override `get_cond` and `visit_switch_node` methods in a way that ensures the new versions of `method_invocation` and `visit_expr` are called.
If `method_invocation` is a method inside `JSONWriter`, the procedure is much simpler - the developer only needs to override `method_invocation`.
* progress on typing
* finish typing analysis.py
* progress on typing dex/__init__.py
* finish pass at dex.__init__.py typing
* more types
* more typing, and fix circular imports using 'if TYPE_CHECKING' checking
* begin to change Generator->Iterator for typing, begin to returns that are type|None to Union[type,None] since that convention started in Python3.10 and Androguard supports 3.9+, and note current circular import issue.
* type|None only works in Python3.10+, which is too high of an assumption for Androguard..change these to Union[type,None]
* withoffset->with_offset
* fix circular import issue due to adding imports for typing
* types for permission loading
* apply type hints to bytecode module
* convert | to Union for further backwards compatibility, progress towards typing axml
* finish typing axml
* order imports, standardize type|None -> Union[type,None]
* fix type for get_certificate_name_string param
* explicitly import Name for typing
* standardize type|None -> Union[type,None]
* type annotate main
* fix some inaccurate hints
* type hint fixes
* add imports for typing
* remove unused import
* remove explicit dependence on typing_extensions, as we can do self-referencing type hints using 'from __future__ import annotations'..however note that typing_extensions is still installed by some underlying package.
This commit replaces the outdated:
asn1crypto.keys.PublicKeyInfo().fingerprint call
With the new:
oscrypto.asymmetric.PublicKey().fingerprint call
ValueError/ve is properly excepted and when printed, it shows "Only DSA keys are generated using a hash algorithm, this key is RSA" for RSA signed apk's.
This commit satisfies the:
`asn1crypto._errors.APIException: asn1crypto.keys.PublicKeyInfo().fingerprint has been removed, please use oscrypto.asymmetric.PublicKey().fingerprint instead`
while still keeping the original behavior.