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'
androguard.core.androconf.color_range(startcolor, goalcolor, steps)

wrapper for interpolate_tuple that accepts colors as html (“#CCCCC” and such)

androguard.core.androconf.debug(x)
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.error(x)

Print out a message and raise an exception TODO should this really raise an exception?

Parameters:x – String to be printed on stderr
androguard.core.androconf.get_debug()
androguard.core.androconf.info(x)
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)
androguard.core.androconf.load_api_specific_resource_module(resource_name, api)
androguard.core.androconf.long2int(l)
androguard.core.androconf.long2str(l)

Convert an integer to a string.

androguard.core.androconf.make_color_tuple(color)

turn something like “#000000” into 0,0,0 or “#FFFFFF into “255,255,255”

androguard.core.androconf.random_string()
androguard.core.androconf.remove_colors()

Remove colors from the output (no escape sequences)

androguard.core.androconf.rrmdir(directory)
androguard.core.androconf.save_colors()
androguard.core.androconf.save_to_disk(buff, output)
androguard.core.androconf.set_debug()
androguard.core.androconf.set_info()
androguard.core.androconf.set_lazy()
androguard.core.androconf.set_options(key, value)
androguard.core.androconf.str2long(s)

Convert a string to a long integer.

androguard.core.androconf.warning(x)

Print out message x and the current traceback (if any)

Parameters:x – String to be printed on stderr

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(input)

Transoform a typical xml format class into java format

Parameters:input – the input class name
Return type:string
androguard.core.bytecode.FormatClassToPython(input)
androguard.core.bytecode.FormatDescriptorToPython(input)
androguard.core.bytecode.FormatNameToPython(input)
class androguard.core.bytecode.MethodBC

Bases: object

show(value)
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)
class androguard.core.bytecode.TmpBlock(name)

Bases: object

get_name()
androguard.core.bytecode.Warning(msg)
androguard.core.bytecode.disable_print_colors()
androguard.core.bytecode.enable_print_colors(colors)
androguard.core.bytecode.method2dot(mx, colors={})

Export analysis method to dot format

@param mx : MethodAnalysis object @param colors : MethodAnalysis object

@rtype : dot format buffer (it is a subgraph (dict))

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 (MethodAnalysis object) – specify the MethodAnalysis object
  • raw (string) – use directly a dot raw buffer (optional)
androguard.core.bytecode.method2json(mx, directed_graph=False)
androguard.core.bytecode.method2json_direct(mx)
androguard.core.bytecode.method2json_undirect(mx)
androguard.core.bytecode.method2png(output, mx, raw=False)

Export method to a png file format

Parameters:
  • output (string) – output filename
  • mx (MethodAnalysis object) – 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)

Module contents