androguard.core package¶
Subpackages¶
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': {'BRANCH_TRUE': '\x1b[32m', 'OFFSET_ADDR': '\x1b[32m', 'NOTE': '\x1b[31m', 'NORMAL': '\x1b[0m', 'EXCEPTION': '\x1b[36m', 'BRANCH': '\x1b[34m', 'BRANCH_FALSE': '\x1b[31m', 'OFFSET': '\x1b[33m', 'INSTRUCTION_NAME': '\x1b[33m', 'OUTPUT': {'meth': '\x1b[36m', 'literal': '\x1b[32m', 'type': '\x1b[34m', 'string': '\x1b[31m', 'offset': '\x1b[35m', 'normal': '\x1b[0m', 'raw': '\x1b[31m', 'field': '\x1b[32m', 'registers': '\x1b[0m'}, 'BB': '\x1b[35m'}, 'DEFAULT_API': 16, 'DEOBFUSCATED_STRING': True, 'ENGINE': 'python', 'LAZY_ANALYSIS': False, 'MAGIC_PATH_FILE': None, 'OPTIONS_FERNFLOWER': {'asc': '1', 'dgs': '1'}, 'PRETTY_SHOW': 1, 'PRINT_FCT': <built-in method write of _io.TextIOWrapper object at 0x7f483c39b630>, '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 @rtype : “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)¶
-
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:
object-
end()¶
-
get_idx()¶
-
read(size)¶
-
readNullString(size)¶
-
read_at(offset, size)¶
-
read_b(size)¶
-
set_idx(idx)¶
-
size()¶
-
-
androguard.core.bytecode.Exit(msg)¶
-
androguard.core.bytecode.FormatClassToJava(i)¶ Transform a typical xml format class into java format
Parameters: i – the input class name Return type: string
-
androguard.core.bytecode.FormatClassToPython(i)¶
-
androguard.core.bytecode.FormatDescriptorToPython(i)¶
-
androguard.core.bytecode.FormatNameToPython(i)¶
-
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.method2dot(mx, colors=None)¶ Export analysis method to dot format
Parameters: - mx –
MethodAnalysis - colors – dict of colors to use, if colors is None the default colors are used
Returns: a string which contains the dot graph
- mx –
-
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 object - raw (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 –
MethodAnalysis - directed_graph – True if a directed graph should be created (default: False)
Returns: - mx –
-
androguard.core.bytecode.method2json_direct(mx)¶ Parameters: mx – MethodAnalysisReturns:
-
androguard.core.bytecode.method2json_undirect(mx)¶ Parameters: mx – MethodAnalysisReturns:
-
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 object - raw (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 – DalvikVMFormatReturns: