androguard.core package¶
Subpackages¶
- androguard.core.analysis package
- Submodules
- androguard.core.analysis.analysis module
AnalysisAnalysis.add()Analysis.create_ipython_exports()Analysis.create_xref()Analysis.find_classes()Analysis.find_fields()Analysis.find_methods()Analysis.find_strings()Analysis.get_call_graph()Analysis.get_class_analysis()Analysis.get_classes()Analysis.get_external_classes()Analysis.get_field_analysis()Analysis.get_fields()Analysis.get_internal_classes()Analysis.get_method()Analysis.get_method_analysis()Analysis.get_method_analysis_by_name()Analysis.get_method_by_name()Analysis.get_methods()Analysis.get_strings()Analysis.get_strings_analysis()Analysis.is_class_present()
BasicBlocksClassAnalysisClassAnalysis.AddFXrefRead()ClassAnalysis.AddFXrefWrite()ClassAnalysis.AddMXrefFrom()ClassAnalysis.AddMXrefTo()ClassAnalysis.AddXrefFrom()ClassAnalysis.AddXrefTo()ClassAnalysis.extendsClassAnalysis.get_fake_method()ClassAnalysis.get_field_analysis()ClassAnalysis.get_fields()ClassAnalysis.get_method_analysis()ClassAnalysis.get_methods()ClassAnalysis.get_nb_methods()ClassAnalysis.get_vm_class()ClassAnalysis.get_xref_from()ClassAnalysis.get_xref_to()ClassAnalysis.implementsClassAnalysis.is_android_api()ClassAnalysis.is_external()ClassAnalysis.name
DVMBasicBlockDVMBasicBlock.add_note()DVMBasicBlock.clear_notes()DVMBasicBlock.get_end()DVMBasicBlock.get_exception_analysis()DVMBasicBlock.get_instructions()DVMBasicBlock.get_last()DVMBasicBlock.get_last_length()DVMBasicBlock.get_method()DVMBasicBlock.get_name()DVMBasicBlock.get_nb_instructions()DVMBasicBlock.get_next()DVMBasicBlock.get_notes()DVMBasicBlock.get_prev()DVMBasicBlock.get_special_ins()DVMBasicBlock.get_start()DVMBasicBlock.push()DVMBasicBlock.set_childs()DVMBasicBlock.set_exception_analysis()DVMBasicBlock.set_fathers()DVMBasicBlock.set_notes()DVMBasicBlock.show()
ExceptionAnalysisExceptionsExternalClassExternalMethodFieldClassAnalysisMethodAnalysisMethodClassAnalysisMethodClassAnalysis.AddXrefFrom()MethodClassAnalysis.AddXrefTo()MethodClassAnalysis.accessMethodClassAnalysis.descriptorMethodClassAnalysis.get_method()MethodClassAnalysis.get_xref_from()MethodClassAnalysis.get_xref_to()MethodClassAnalysis.is_android_api()MethodClassAnalysis.is_external()MethodClassAnalysis.name
StringAnalysisis_ascii_obfuscation()
- androguard.core.analysis.auto module
AndroAutoDefaultAndroAnalysisDefaultAndroAnalysis.analysis_adex()DefaultAndroAnalysis.analysis_apk()DefaultAndroAnalysis.analysis_app()DefaultAndroAnalysis.analysis_arsc()DefaultAndroAnalysis.analysis_axml()DefaultAndroAnalysis.analysis_dex()DefaultAndroAnalysis.analysis_dey()DefaultAndroAnalysis.crash()DefaultAndroAnalysis.create_adex()DefaultAndroAnalysis.create_apk()DefaultAndroAnalysis.create_arsc()DefaultAndroAnalysis.create_axml()DefaultAndroAnalysis.create_dex()DefaultAndroAnalysis.create_dey()DefaultAndroAnalysis.dump()DefaultAndroAnalysis.dump_file()DefaultAndroAnalysis.fetcher()DefaultAndroAnalysis.filter_file()DefaultAndroAnalysis.finish()
DefaultAndroLogDirectoryAndroAnalysis
- Module contents
- androguard.core.api_specific_resources package
- androguard.core.bytecodes package
- Submodules
- androguard.core.bytecodes.apk module
APKAPK.filesAPK.find_tags()APK.find_tags_from_xml()APK.get_activities()APK.get_all_attribute_value()APK.get_all_dex()APK.get_android_manifest_axml()APK.get_android_manifest_xml()APK.get_android_resources()APK.get_androidversion_code()APK.get_androidversion_name()APK.get_app_icon()APK.get_app_name()APK.get_attribute_value()APK.get_certificate()APK.get_certificate_der()APK.get_certificates()APK.get_certificates_der_v2()APK.get_certificates_der_v3()APK.get_certificates_v1()APK.get_certificates_v2()APK.get_certificates_v3()APK.get_declared_permissions()APK.get_declared_permissions_details()APK.get_details_permissions()APK.get_dex()APK.get_dex_names()APK.get_effective_target_sdk_version()APK.get_element()APK.get_elements()APK.get_features()APK.get_file()APK.get_filename()APK.get_files()APK.get_files_crc32()APK.get_files_information()APK.get_files_types()APK.get_intent_filters()APK.get_libraries()APK.get_main_activities()APK.get_main_activity()APK.get_max_sdk_version()APK.get_min_sdk_version()APK.get_package()APK.get_permissions()APK.get_providers()APK.get_public_keys_der_v2()APK.get_public_keys_der_v3()APK.get_public_keys_v2()APK.get_public_keys_v3()APK.get_raw()APK.get_receivers()APK.get_requested_aosp_permissions()APK.get_requested_aosp_permissions_details()APK.get_requested_permissions()APK.get_requested_third_party_permissions()APK.get_services()APK.get_signature()APK.get_signature_name()APK.get_signature_names()APK.get_signatures()APK.get_target_sdk_version()APK.get_uses_implied_permission_list()APK.get_value_from_tag()APK.is_androidtv()APK.is_leanback()APK.is_multidex()APK.is_signed()APK.is_signed_v1()APK.is_signed_v2()APK.is_signed_v3()APK.is_tag_matched()APK.is_valid_APK()APK.is_wearable()APK.new_zip()APK.parse_signatures_or_digests()APK.parse_v2_signing_block()APK.parse_v2_v3_signature()APK.parse_v3_signing_block()APK.read_uint32_le()APK.show()
APKV2SignedDataAPKV2SignerAPKV3SignedDataAPKV3SignerBrokenAPKErrorErrorFileNotPresentensure_final_value()get_apkid()parse_lxml_dom()show_Certificate()
- androguard.core.bytecodes.dvm module
AnnotationElementAnnotationItemAnnotationOffItemAnnotationSetItemAnnotationSetRefItemAnnotationSetRefListAnnotationsDirectoryItemAnnotationsDirectoryItem.get_annotated_fields_size()AnnotationsDirectoryItem.get_annotated_methods_size()AnnotationsDirectoryItem.get_annotated_parameters_size()AnnotationsDirectoryItem.get_class_annotations_off()AnnotationsDirectoryItem.get_field_annotations()AnnotationsDirectoryItem.get_length()AnnotationsDirectoryItem.get_method_annotations()AnnotationsDirectoryItem.get_obj()AnnotationsDirectoryItem.get_off()AnnotationsDirectoryItem.get_parameter_annotations()AnnotationsDirectoryItem.get_raw()AnnotationsDirectoryItem.reload()AnnotationsDirectoryItem.set_off()AnnotationsDirectoryItem.show()
ClassDataItemClassDataItem.get_direct_methods()ClassDataItem.get_direct_methods_size()ClassDataItem.get_fields()ClassDataItem.get_instance_fields()ClassDataItem.get_instance_fields_size()ClassDataItem.get_length()ClassDataItem.get_methods()ClassDataItem.get_obj()ClassDataItem.get_off()ClassDataItem.get_raw()ClassDataItem.get_static_fields()ClassDataItem.get_static_fields_size()ClassDataItem.get_virtual_methods()ClassDataItem.get_virtual_methods_size()ClassDataItem.reload()ClassDataItem.set_off()ClassDataItem.set_static_fields()ClassDataItem.show()
ClassDefItemClassDefItem.get_access_flags()ClassDefItem.get_access_flags_string()ClassDefItem.get_annotations_off()ClassDefItem.get_ast()ClassDefItem.get_class_data()ClassDefItem.get_class_data_off()ClassDefItem.get_class_idx()ClassDefItem.get_fields()ClassDefItem.get_interfaces()ClassDefItem.get_interfaces_off()ClassDefItem.get_length()ClassDefItem.get_methods()ClassDefItem.get_name()ClassDefItem.get_obj()ClassDefItem.get_raw()ClassDefItem.get_source()ClassDefItem.get_source_ext()ClassDefItem.get_source_file_idx()ClassDefItem.get_static_values_off()ClassDefItem.get_superclass_idx()ClassDefItem.get_superclassname()ClassDefItem.reload()ClassDefItem.set_name()ClassDefItem.show()ClassDefItem.source()
ClassHDefItemClassManagerClassManager.add_type_item()ClassManager.get_all_engine()ClassManager.get_ascii_string()ClassManager.get_class_data_item()ClassManager.get_code()ClassManager.get_debug_off()ClassManager.get_encoded_array_item()ClassManager.get_engine()ClassManager.get_field()ClassManager.get_field_ref()ClassManager.get_item_by_offset()ClassManager.get_lazy_analysis()ClassManager.get_method()ClassManager.get_method_ref()ClassManager.get_next_offset_item()ClassManager.get_obj_by_offset()ClassManager.get_odex_format()ClassManager.get_proto()ClassManager.get_raw_string()ClassManager.get_string()ClassManager.get_string_by_offset()ClassManager.get_type()ClassManager.get_type_list()ClassManager.get_type_ref()ClassManager.set_decompiler()ClassManager.set_hook_class_name()ClassManager.set_hook_field_name()ClassManager.set_hook_method_name()ClassManager.set_hook_string()
CodeItemConstStringDBGBytecodeDCodeDalvikCodeDalvikCode.add_inote()DalvikCode.get_bc()DalvikCode.get_debug()DalvikCode.get_debug_info_off()DalvikCode.get_handlers()DalvikCode.get_ins_size()DalvikCode.get_insns_size()DalvikCode.get_instruction()DalvikCode.get_length()DalvikCode.get_obj()DalvikCode.get_off()DalvikCode.get_outs_size()DalvikCode.get_raw()DalvikCode.get_registers_size()DalvikCode.get_size()DalvikCode.get_tries()DalvikCode.get_tries_size()DalvikCode.reload()DalvikCode.set_idx()DalvikCode.set_off()DalvikCode.show()
DalvikOdexVMFormatDalvikVMFormatDalvikVMFormat.colorize_operands()DalvikVMFormat.create_python_export()DalvikVMFormat.disassemble()DalvikVMFormat.fix_checksums()DalvikVMFormat.get_BRANCH_DVM_OPCODES()DalvikVMFormat.get_all_fields()DalvikVMFormat.get_api_version()DalvikVMFormat.get_class()DalvikVMFormat.get_class_manager()DalvikVMFormat.get_classes()DalvikVMFormat.get_classes_def_item()DalvikVMFormat.get_classes_names()DalvikVMFormat.get_cm_field()DalvikVMFormat.get_cm_method()DalvikVMFormat.get_cm_string()DalvikVMFormat.get_cm_type()DalvikVMFormat.get_codes_item()DalvikVMFormat.get_debug_info_item()DalvikVMFormat.get_determineException()DalvikVMFormat.get_determineNext()DalvikVMFormat.get_field()DalvikVMFormat.get_field_descriptor()DalvikVMFormat.get_fields()DalvikVMFormat.get_fields_class()DalvikVMFormat.get_fields_id_item()DalvikVMFormat.get_format()DalvikVMFormat.get_format_type()DalvikVMFormat.get_header_item()DalvikVMFormat.get_len_methods()DalvikVMFormat.get_method()DalvikVMFormat.get_method_by_idx()DalvikVMFormat.get_method_descriptor()DalvikVMFormat.get_methods()DalvikVMFormat.get_methods_class()DalvikVMFormat.get_methods_descriptor()DalvikVMFormat.get_methods_id_item()DalvikVMFormat.get_operand_html()DalvikVMFormat.get_regex_strings()DalvikVMFormat.get_string_data_item()DalvikVMFormat.get_strings()DalvikVMFormat.get_strings_unicode()DalvikVMFormat.get_vmanalysis()DalvikVMFormat.list_classes_hierarchy()DalvikVMFormat.print_classes_hierarchy()DalvikVMFormat.save()DalvikVMFormat.set_decompiler()DalvikVMFormat.set_vmanalysis()DalvikVMFormat.show()
DebugInfoItemDebugInfoItemEmptyEncodedAnnotationEncodedArrayEncodedArrayItemEncodedCatchHandlerEncodedCatchHandlerListEncodedFieldEncodedField.adjust_idx()EncodedField.get_access_flags()EncodedField.get_access_flags_string()EncodedField.get_class_name()EncodedField.get_descriptor()EncodedField.get_field_idx()EncodedField.get_field_idx_diff()EncodedField.get_init_value()EncodedField.get_name()EncodedField.get_obj()EncodedField.get_raw()EncodedField.get_size()EncodedField.load()EncodedField.reload()EncodedField.set_init_value()EncodedField.set_name()EncodedField.show()
EncodedMethodEncodedMethod.access_flagsEncodedMethod.add_inote()EncodedMethod.add_note()EncodedMethod.adjust_idx()EncodedMethod.code_offEncodedMethod.each_params_by_register()EncodedMethod.get_access_flags()EncodedMethod.get_access_flags_string()EncodedMethod.get_address()EncodedMethod.get_class_name()EncodedMethod.get_code()EncodedMethod.get_code_off()EncodedMethod.get_debug()EncodedMethod.get_descriptor()EncodedMethod.get_information()EncodedMethod.get_instruction()EncodedMethod.get_instructions()EncodedMethod.get_length()EncodedMethod.get_locals()EncodedMethod.get_method_idx()EncodedMethod.get_method_idx_diff()EncodedMethod.get_name()EncodedMethod.get_raw()EncodedMethod.get_short_string()EncodedMethod.get_size()EncodedMethod.get_source()EncodedMethod.get_triple()EncodedMethod.is_cached_instructions()EncodedMethod.load()EncodedMethod.method_idx_diffEncodedMethod.reload()EncodedMethod.set_code_idx()EncodedMethod.set_instructions()EncodedMethod.set_name()EncodedMethod.show()EncodedMethod.show_info()EncodedMethod.show_notes()EncodedMethod.source()
EncodedTypeAddrPairEncodedValueErrorExportObjectFakeNopFieldAnnotationFieldHIdItemFieldIdItemFieldIdItem.get_class_idx()FieldIdItem.get_class_name()FieldIdItem.get_descriptor()FieldIdItem.get_length()FieldIdItem.get_list()FieldIdItem.get_name()FieldIdItem.get_name_idx()FieldIdItem.get_obj()FieldIdItem.get_raw()FieldIdItem.get_type()FieldIdItem.get_type_idx()FieldIdItem.reload()FieldIdItem.show()
FieldIdItemInvalidFillArrayDataFillArrayData.add_note()FillArrayData.get_data()FillArrayData.get_formatted_operands()FillArrayData.get_hex()FillArrayData.get_length()FillArrayData.get_name()FillArrayData.get_notes()FillArrayData.get_op_value()FillArrayData.get_operands()FillArrayData.get_output()FillArrayData.get_raw()FillArrayData.show()FillArrayData.show_buff()
HeaderItemInstructionInstruction.get_formatted_operands()Instruction.get_hex()Instruction.get_kind()Instruction.get_length()Instruction.get_literals()Instruction.get_name()Instruction.get_op_value()Instruction.get_operands()Instruction.get_output()Instruction.get_raw()Instruction.get_ref_kind()Instruction.get_translated_kind()Instruction.show()Instruction.show_buff()
Instruction10tInstruction10xInstruction11nInstruction11xInstruction12xInstruction20bcInstruction20tInstruction21cInstruction21hInstruction21sInstruction21tInstruction22bInstruction22cInstruction22csInstruction22sInstruction22tInstruction22xInstruction23xInstruction30tInstruction31cInstruction31iInstruction31tInstruction32xInstruction35cInstruction35miInstruction35msInstruction3rcInstruction3rmiInstruction3rmsInstruction40scInstruction41cInstruction51lInstruction52cInstruction5rcInstructionInvalidInvalidInstructionLinearSweepAlgorithmMapItemMapListMethodAnnotationMethodHIdItemMethodIdItemMethodIdItem.get_class_idx()MethodIdItem.get_class_name()MethodIdItem.get_descriptor()MethodIdItem.get_length()MethodIdItem.get_list()MethodIdItem.get_name()MethodIdItem.get_name_idx()MethodIdItem.get_obj()MethodIdItem.get_proto()MethodIdItem.get_proto_idx()MethodIdItem.get_raw()MethodIdItem.get_real_descriptor()MethodIdItem.get_triple()MethodIdItem.reload()MethodIdItem.show()
MethodIdItemInvalidOdexDependenciesOdexHeaderItemOffObjPackedSwitchPackedSwitch.add_note()PackedSwitch.get_formatted_operands()PackedSwitch.get_hex()PackedSwitch.get_keys()PackedSwitch.get_length()PackedSwitch.get_name()PackedSwitch.get_notes()PackedSwitch.get_op_value()PackedSwitch.get_operands()PackedSwitch.get_output()PackedSwitch.get_raw()PackedSwitch.get_targets()PackedSwitch.get_values()PackedSwitch.show()PackedSwitch.show_buff()
ParameterAnnotationProtoHIdItemProtoIdItemProtoIdItem.get_length()ProtoIdItem.get_obj()ProtoIdItem.get_parameters_off()ProtoIdItem.get_parameters_off_value()ProtoIdItem.get_raw()ProtoIdItem.get_return_type_idx()ProtoIdItem.get_return_type_idx_value()ProtoIdItem.get_shorty_idx()ProtoIdItem.get_shorty_idx_value()ProtoIdItem.reload()ProtoIdItem.show()
ProtoIdItemInvalidSparseSwitchSparseSwitch.add_note()SparseSwitch.get_formatted_operands()SparseSwitch.get_hex()SparseSwitch.get_keys()SparseSwitch.get_length()SparseSwitch.get_name()SparseSwitch.get_notes()SparseSwitch.get_op_value()SparseSwitch.get_operands()SparseSwitch.get_output()SparseSwitch.get_raw()SparseSwitch.get_targets()SparseSwitch.get_values()SparseSwitch.show()SparseSwitch.show_buff()
StringDataItemStringIdItemTryItemTypeHIdItemTypeIdItemTypeItemTypeListUnresolvedclean_name_instruction()determineException()determineNext()get_access_flags_string()get_byte()get_bytecodes_method()get_bytecodes_methodx()get_extented_instruction()get_instruction()get_instruction_payload()get_kind()get_optimized_instruction()get_params_info()get_sbyte()get_type()read_null_terminated_string()readsleb128()readuleb128()readuleb128p1()static_operand_instruction()writesleb128()writeuleb128()
- androguard.core.bytecodes.axml module
ARSCComplexARSCHeaderARSCParserARSCParser.ResourceResolverARSCParser.get_bool_resources()ARSCParser.get_color_resources()ARSCParser.get_dimen_resources()ARSCParser.get_id()ARSCParser.get_id_resources()ARSCParser.get_integer_resources()ARSCParser.get_items()ARSCParser.get_locales()ARSCParser.get_packages_names()ARSCParser.get_public_resources()ARSCParser.get_res_configs()ARSCParser.get_res_id_by_key()ARSCParser.get_resolved_res_configs()ARSCParser.get_resolved_strings()ARSCParser.get_resource_bool()ARSCParser.get_resource_color()ARSCParser.get_resource_dimen()ARSCParser.get_resource_id()ARSCParser.get_resource_integer()ARSCParser.get_resource_string()ARSCParser.get_resource_style()ARSCParser.get_resource_xml_name()ARSCParser.get_string()ARSCParser.get_string_resources()ARSCParser.get_strings_resources()ARSCParser.get_type_configs()ARSCParser.get_types()ARSCParser.parse_id()
ARSCResStringPoolRefARSCResTableConfigARSCResTableEntryARSCResTablePackageARSCResTypeARSCResTypeSpecAXMLParserAXMLParser.commentAXMLParser.getAttributeCount()AXMLParser.getAttributeName()AXMLParser.getAttributeNamespace()AXMLParser.getAttributeUri()AXMLParser.getAttributeValue()AXMLParser.getAttributeValueData()AXMLParser.getAttributeValueType()AXMLParser.getName()AXMLParser.getPrefix()AXMLParser.getText()AXMLParser.is_valid()AXMLParser.nameAXMLParser.namespaceAXMLParser.nsmapAXMLParser.text
AXMLPrinterPackageContextResParserErrorStringBlockcomplexToFloat()format_value()get_arsc_info()
- androguard.core.bytecodes.mutf8 module
- Module contents
- androguard.core.resources package
Submodules¶
androguard.core.androconf module¶
- class androguard.core.androconf.Color¶
Bases:
object- Black = '\x1b[30m'¶
- Blue = '\x1b[34m'¶
- Bold = '\x1b[1m'¶
- Cyan = '\x1b[36m'¶
- Green = '\x1b[32m'¶
- Grey = '\x1b[37m'¶
- Normal = '\x1b[0m'¶
- Purple = '\x1b[35m'¶
- Red = '\x1b[31m'¶
- Yellow = '\x1b[33m'¶
- class androguard.core.androconf.Configuration¶
Bases:
object- instance = {'BIN_DED': 'ded.sh', 'BIN_DEX2JAR': 'dex2jar.sh', 'BIN_FERNFLOWER': 'fernflower.jar', 'BIN_JAD': 'jad', 'BIN_JADX': 'jadx', 'BIN_JARSIGNER': 'jarsigner', 'BIN_WINEJAD': 'jad.exe', 'COLORS': {'BB': '\x1b[35m', 'BRANCH': '\x1b[34m', 'BRANCH_FALSE': '\x1b[31m', 'BRANCH_TRUE': '\x1b[32m', 'EXCEPTION': '\x1b[36m', 'INSTRUCTION_NAME': '\x1b[33m', 'NORMAL': '\x1b[0m', 'NOTE': '\x1b[31m', 'OFFSET': '\x1b[33m', 'OFFSET_ADDR': '\x1b[32m', 'OUTPUT': {'field': '\x1b[32m', 'literal': '\x1b[32m', 'meth': '\x1b[36m', 'normal': '\x1b[0m', 'offset': '\x1b[35m', 'raw': '\x1b[31m', 'registers': '\x1b[0m', 'string': '\x1b[31m', 'type': '\x1b[34m'}}, 'DEFAULT_API': 16, 'OPTIONS_FERNFLOWER': {'asc': '1', 'dgs': '1'}, 'PRINT_FCT': <built-in method write of _io.TextIOWrapper object>, 'RECODE_ASCII_STRING': False, 'RECODE_ASCII_STRING_METH': None, 'SESSION': None, 'TMP_DIRECTORY': '/tmp'}¶
- exception androguard.core.androconf.InvalidResourceError¶
Bases:
ExceptionInvalid Resource Erorr is thrown by load_api_specific_resource_module
- androguard.core.androconf.color_range(startcolor, goalcolor, steps)¶
wrapper for interpolate_tuple that accepts colors as html (“#CCCCC” and such)
- androguard.core.androconf.default_colors(obj)¶
- androguard.core.androconf.disable_colors()¶
Disable colors from the output (color = normal)
- androguard.core.androconf.enable_colors(colors)¶
- androguard.core.androconf.interpolate_tuple(startcolor, goalcolor, steps)¶
Take two RGB color sets and mix them over a specified number of steps. Return the list
- androguard.core.androconf.is_android(filename)¶
Return the type of the file
:param filename : the filename :returns: “APK”, “DEX”, None
- androguard.core.androconf.is_android_raw(raw)¶
Returns a string that describes the type of file, for common Android specific formats
- androguard.core.androconf.is_ascii_problem(s)¶
Test if a string contains other chars than ASCII
- Parameters:
s – a string to test
- Returns:
True if string contains other chars than ASCII, False otherwise
- androguard.core.androconf.load_api_specific_resource_module(resource_name, api=None)¶
Load the module from the JSON files and return a dict, which might be empty if the resource could not be loaded.
If no api version is given, the default one from the CONF dict is used.
- Parameters:
resource_name – Name of the resource to load
api – API version
- Returns:
dict
- androguard.core.androconf.make_color_tuple(color)¶
turn something like “#000000” into 0,0,0 or “#FFFFFF into “255,255,255”
- androguard.core.androconf.remove_colors()¶
Remove colors from the output (no escape sequences)
- androguard.core.androconf.rrmdir(directory)¶
Recursivly delete a directory
- Parameters:
directory – directory to remove
- androguard.core.androconf.save_colors()¶
- androguard.core.androconf.set_options(key, value)¶
Deprecated since version 3.3.5: Use
CONF[key] = valueinstead
- androguard.core.androconf.show_logging(level=20)¶
enable log messages on stdout
We will catch all messages here! From all loggers…
androguard.core.bytecode module¶
- class androguard.core.bytecode.Buff(offset, buff)¶
Bases:
object
- class androguard.core.bytecode.BuffHandle(buff)¶
Bases:
objectBuffHandle is a wrapper around bytes. It gives the ability to jump in the byte stream, just like with BytesIO.
- add_idx(idx)¶
Advance the current offset by idx
- Parameters:
idx (int) – number of bytes to advance
- end()¶
Test if the current offset is at the end or over the buffer boundary
- Return type:
bool
- get_buff()¶
Return the whole buffer
- Return type:
bytearray
- get_idx()¶
Get the current offset in the buffer
- Return type:
int
- read(size)¶
Read from the current offset a total number of size bytes and increment the offset by size
- Parameters:
size (int) – length of bytes to read
- Return type:
bytearray
- readNullString(size)¶
Read a String with length size at the current offset
- Parameters:
size (int) – length of the string
- Return type:
bytearray
- read_at(offset, size)¶
Read bytes from the given offset with length size without incrementing the current offset
- Parameters:
offset (int) – offset to start reading
size (int) – length of bytes to read
- Return type:
bytearray
- read_b(size)¶
Read bytes with length size without incrementing the current offset
- Parameters:
size (int) – length to read in bytes
- Return type:
bytearray
- readat(off)¶
Read all bytes from the start of off until the end of the buffer
- Parameters:
off (int) – starting offset
- Return type:
bytearray
- save(filename)¶
Save the current buffer to filename
Exisiting files with the same name will be overwritten.
- Parameters:
filename (str) – the name of the file to save to
- set_buff(buff)¶
Overwrite the current buffer with the content of buff
- Parameters:
buff (bytearray) – the new buffer
- set_idx(idx)¶
Set the current offset in the buffer
- Parameters:
idx (int) – offset to set
- size()¶
Get the total size of the buffer
- Return type:
int
- androguard.core.bytecode.Exit(msg)¶
- androguard.core.bytecode.FormatClassToJava(i)¶
Transform a java class name into the typed variant found in DEX files.
example:
>>> FormatClassToJava('java.lang.Object') 'Ljava/lang/Object;'
- Parameters:
i – the input class name
- Return type:
str
- androguard.core.bytecode.FormatClassToPython(i)¶
Transform a typed class name into a form which can be used as a python attribute
example:
>>> FormatClassToPython('Lfoo/bar/foo/Barfoo$InnerClass;') 'Lfoo_bar_foo_Barfoo_InnerClass'
- Parameters:
i – classname to transform
- Return type:
str
- androguard.core.bytecode.FormatDescriptorToPython(i)¶
Format a descriptor into a form which can be used as a python attribute
example:
>>> FormatDescriptorToPython('(Ljava/lang/Long; Ljava/lang/Long; Z Z)V') 'Ljava_lang_LongLjava_lang_LongZZV
- Parameters:
i – name to transform
- Return type:
str
- androguard.core.bytecode.FormatNameToPython(i)¶
Transform a (method) name into a form which can be used as a python attribute
example:
>>> FormatNameToPython('<clinit>') 'clinit'
- Parameters:
i – name to transform
- Return type:
str
- class androguard.core.bytecode.Node(n, s)¶
Bases:
object
- androguard.core.bytecode.PrettyShow(m_a, basic_blocks, notes={})¶
- androguard.core.bytecode.PrettyShowEx(exceptions)¶
- class androguard.core.bytecode.SV(size, buff)¶
Bases:
object- get_value()¶
- get_value_buff()¶
- set_value(attr)¶
- class androguard.core.bytecode.SVs(size, ntuple, buff)¶
Bases:
object- get_value()¶
- get_value_buff()¶
- set_value(attr)¶
- androguard.core.bytecode.disable_print_colors()¶
- androguard.core.bytecode.enable_print_colors(colors)¶
- androguard.core.bytecode.get_package_class_name(name)¶
Return package and class name in a java variant from a typed variant name.
If no package could be found, the package is an empty string.
example:
>>> get_package_class_name('Ljava/lang/Object;') ('java.lang', 'Object')
- Parameters:
name – the name
- Return type:
tuple
- Returns:
- androguard.core.bytecode.method2dot(mx, colors=None)¶
Export analysis method to dot format
- Parameters:
mx –
MethodAnalysiscolors – dict of colors to use, if colors is None the default colors are used
- Returns:
a string which contains the dot graph
- androguard.core.bytecode.method2format(output, _format='png', mx=None, raw=None)¶
Export method to a specific file format
@param output : output filename @param _format : format type (png, jpg …) (default : png) @param mx : specify the MethodAnalysis object @param raw : use directly a dot raw buffer if None
- androguard.core.bytecode.method2jpg(output, mx, raw=False)¶
Export method to a jpg file format
- Parameters:
output (string) – output filename
mx (
MethodAnalysisobject) – specify the MethodAnalysis objectraw (string) – use directly a dot raw buffer (optional)
- androguard.core.bytecode.method2json(mx, directed_graph=False)¶
Create directed or undirected graph in the json format.
- Parameters:
mx –
MethodAnalysisdirected_graph – True if a directed graph should be created (default: False)
- Returns:
- androguard.core.bytecode.method2json_direct(mx)¶
- Parameters:
mx –
MethodAnalysis- Returns:
- androguard.core.bytecode.method2json_undirect(mx)¶
- Parameters:
mx –
MethodAnalysis- Returns:
- androguard.core.bytecode.method2png(output, mx, raw=False)¶
Export method to a png file format
- Parameters:
output (string) – output filename
mx (
MethodAnalysisobject) – specify the MethodAnalysis objectraw (string) – use directly a dot raw buffer
- androguard.core.bytecode.object_to_bytes(obj)¶
Convert a object to a bytearray or call get_raw() of the object if no useful type was found.
- androguard.core.bytecode.vm2json(vm)¶
Get a JSON representation of a DEX file
- Parameters:
vm –
DalvikVMFormat- Returns: